aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-05-15 21:06:50 +0000
committerMark Kettenis <kettenis@gnu.org>2004-05-15 21:06:50 +0000
commit0fe85704c41edcaec1c672f3fe45413e4b15fa04 (patch)
tree1baf78866dcd142481adb47d2598e3fd827c221c
parentc5ae18403c9158335f36fa792c10cce9cbbec3f3 (diff)
downloadgdb-0fe85704c41edcaec1c672f3fe45413e4b15fa04.zip
gdb-0fe85704c41edcaec1c672f3fe45413e4b15fa04.tar.gz
gdb-0fe85704c41edcaec1c672f3fe45413e4b15fa04.tar.bz2
* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Replace hexadecimal
offset with decimal offset. (amd64obsd_sigcontext_addr): Return correct address for entire signal trampoline.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/amd64obsd-tdep.c22
2 files changed, 24 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9f546b4..04e8da8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2004-05-15 Mark Kettenis <kettenis@gnu.org>
+ * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Replace hexadecimal
+ offset with decimal offset.
+ (amd64obsd_sigcontext_addr): Return correct address for entire
+ signal trampoline.
+
* vax-tdep.c (vax_frame_num_args): Use get_frame_base_address
instead of get_frame_base.
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index af110b3..f9e0f69 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -109,7 +109,7 @@ amd64obsd_sigtramp_p (struct frame_info *next_frame)
/* If we can't read the instructions at START_PC, return zero. */
buf = alloca (sizeof sigreturn);
- if (target_read_memory (start_pc + 0x7, buf, sizeof sigreturn))
+ if (target_read_memory (start_pc + 7, buf, sizeof sigreturn))
return 0;
/* Check for sigreturn(2). */
@@ -125,9 +125,25 @@ amd64obsd_sigtramp_p (struct frame_info *next_frame)
static CORE_ADDR
amd64obsd_sigcontext_addr (struct frame_info *next_frame)
{
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+ ULONGEST offset = (pc & (amd64obsd_page_size - 1));
+
/* The %rsp register points at `struct sigcontext' upon entry of a
- signal trampoline. */
- return frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
+ signal trampoline. The relevant part of the trampoline is
+
+ call *%rax
+ movq %rsp, %rdi
+ pushq %rdi
+ movq $SYS_sigreturn,%rax
+ int $0x80
+
+ (see /usr/src/sys/arch/amd64/amd64/locore.S). The `pushq'
+ instruction clobbers %rsp, but its value is saved in `%rdi'. */
+
+ if (offset > 6)
+ return frame_unwind_register_unsigned (next_frame, AMD64_RDI_REGNUM);
+ else
+ return frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
}
/* OpenBSD 3.5 or later. */