aboutsummaryrefslogtreecommitdiff
path: root/gdb/amd64obsd-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-05-29 15:09:18 +0000
committerMark Kettenis <kettenis@gnu.org>2004-05-29 15:09:18 +0000
commit4cd28409c59439cd62643969269796adf87290d8 (patch)
tree8a9bf90ea467c54ce82a330ba6e36048af17e847 /gdb/amd64obsd-tdep.c
parent45d134d8e0a87f4d4731db14c2340fd143db12b3 (diff)
downloadgdb-4cd28409c59439cd62643969269796adf87290d8.zip
gdb-4cd28409c59439cd62643969269796adf87290d8.tar.gz
gdb-4cd28409c59439cd62643969269796adf87290d8.tar.bz2
* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Adjust for new
assembler in OpenBSD 3.5-current. (amd64obsd_sigcontext_addr): Likewise.
Diffstat (limited to 'gdb/amd64obsd-tdep.c')
-rw-r--r--gdb/amd64obsd-tdep.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index c1574cd..0c742a2 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -104,12 +104,15 @@ amd64obsd_sigtramp_p (struct frame_info *next_frame)
return 0;
/* If we can't read the instructions at START_PC, return zero. */
- buf = alloca (sizeof sigreturn);
- if (target_read_memory (start_pc + 7, buf, sizeof sigreturn))
+ buf = alloca ((sizeof sigreturn) + 1);
+ if (target_read_memory (start_pc + 6, buf, (sizeof sigreturn) + 1))
return 0;
- /* Check for sigreturn(2). */
- if (memcmp (buf, sigreturn, sizeof sigreturn))
+ /* Check for sigreturn(2). Depending on how the assembler encoded
+ the `movq %rsp, %rdi' instruction, the code starts at offset 6 or
+ 7. */
+ if (memcmp (buf, sigreturn, sizeof sigreturn)
+ && memcpy (buf + 1, sigreturn, sizeof sigreturn))
return 0;
return 1;
@@ -136,7 +139,7 @@ amd64obsd_sigcontext_addr (struct frame_info *next_frame)
(see /usr/src/sys/arch/amd64/amd64/locore.S). The `pushq'
instruction clobbers %rsp, but its value is saved in `%rdi'. */
- if (offset > 6)
+ if (offset > 5)
return frame_unwind_register_unsigned (next_frame, AMD64_RDI_REGNUM);
else
return frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);