aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2011-12-17 12:22:06 +0000
committerMark Kettenis <kettenis@gnu.org>2011-12-17 12:22:06 +0000
commit0dcddd842290db06a165943ea7a5e335bd3f3ccb (patch)
tree4a886224f102601522b6ec73188cebaeae4fba52
parent3e290cb1d1ecfda5e58742e0bdf3a6b76b9a2d74 (diff)
downloadgdb-0dcddd842290db06a165943ea7a5e335bd3f3ccb.zip
gdb-0dcddd842290db06a165943ea7a5e335bd3f3ccb.tar.gz
gdb-0dcddd842290db06a165943ea7a5e335bd3f3ccb.tar.bz2
* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Detect new signal
trampoline to be introduced in OpenBSD 5.0.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/amd64obsd-tdep.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b2bf063..296feb7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-17 Mark Kettenis <kettenis@gnu.org>
+
+ * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Detect new signal
+ trampoline to be introduced in OpenBSD 5.0.
+
2011-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix build regression from the PR threads/10729 fix.
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index 2ff5c8f..e66cd2b 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -88,12 +88,18 @@ amd64obsd_sigtramp_p (struct frame_info *this_frame)
{
CORE_ADDR pc = get_frame_pc (this_frame);
CORE_ADDR start_pc = (pc & ~(amd64obsd_page_size - 1));
- const gdb_byte sigreturn[] =
+ const gdb_byte osigreturn[] =
{
0x48, 0xc7, 0xc0,
0x67, 0x00, 0x00, 0x00, /* movq $SYS_sigreturn, %rax */
0xcd, 0x80 /* int $0x80 */
};
+ const gdb_byte sigreturn[] =
+ {
+ 0x48, 0xc7, 0xc0,
+ 0x67, 0x00, 0x00, 0x00, /* movq $SYS_sigreturn, %rax */
+ 0x0f, 0x05 /* syscall */
+ };
size_t buflen = (sizeof sigreturn) + 1;
gdb_byte *buf;
char *name;
@@ -116,9 +122,12 @@ amd64obsd_sigtramp_p (struct frame_info *this_frame)
/* Check for sigreturn(2). Depending on how the assembler encoded
the `movq %rsp, %rdi' instruction, the code starts at offset 6 or
- 7. */
+ 7. OpenBSD 5.0 and later use the `syscall' instruction. Older
+ versions use `int $0x80'. Check for both. */
if (memcmp (buf, sigreturn, sizeof sigreturn)
- && memcpy (buf + 1, sigreturn, sizeof sigreturn))
+ && memcmp (buf + 1, sigreturn, sizeof sigreturn)
+ && memcmp (buf, osigreturn, sizeof osigreturn)
+ && memcmp (buf + 1, osigreturn, sizeof osigreturn))
return 0;
return 1;