From: Michal Ludvig <mludvig@suse.cz>
To: Mark Kettenis <kettenis@chello.nl>
Cc: GDB Patches <gdb-patches@sources.redhat.com>
Subject: [RFC/i385newframe] Fix sigtramp unwinder.
Date: Wed, 28 May 2003 14:39:00 -0000 [thread overview]
Message-ID: <3ED4CA1B.2000004@suse.cz> (raw)
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
Hi,
this patch fixes x86_64_linux_sigcontext_addr() which returned wrong
address, and consequently enables unwinding from signal handlers.
Detailed explanation of this change is in the comment in the patch.
OK to apply?
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
[-- Attachment #2: unwind-sigctx-1.diff --]
[-- Type: text/plain, Size: 1806 bytes --]
2003-05-28 Michal Ludvig <mludvig@suse.cz>
* x86-64-linux-tdep.c (x86_64_linux_sigcontext_addr):
Correctly determine sigcontext address.
Index: x86-64-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/x86-64-linux-tdep.c,v
retrieving revision 1.17.18.1
diff -u -p -c -r1.17.18.1 x86-64-linux-tdep.c
*** x86-64-linux-tdep.c 17 May 2003 15:09:15 -0000 1.17.18.1
--- x86-64-linux-tdep.c 28 May 2003 14:32:12 -0000
*************** x86_64_linux_sigcontext_addr (struct fra
*** 110,124 ****
CORE_ADDR sp, ucontext_addr;
char buf[8];
frame_unwind_register (next_frame, SP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 8);
! /* The sigcontext structure is part of the user context. A pointer
! to the user context is passed as the third argument to the signal
! handler. */
! read_memory (sp + 16, buf, 8);
! ucontext_addr = extract_unsigned_integer (buf, 8);
! return ucontext_addr + X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
}
\f
--- 110,126 ----
CORE_ADDR sp, ucontext_addr;
char buf[8];
+ /* The sigcontext structure is part of the user context. A pointer
+ to the user context is passed as the third argument to the signal
+ handler, i.e. in register RDX. Unfortunately RDX isn't a callee
+ saved register and so it's unwound value isn't reliable.
+ Fortunately struct ucontext is right above the return address from
+ the signal handler, i.e. also unwound RSP points to the user context
+ and we can use it instead of RDX. */
frame_unwind_register (next_frame, SP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 8);
! return sp + X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
}
\f
next reply other threads:[~2003-05-28 14:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-28 14:39 Michal Ludvig [this message]
2003-05-28 20:57 ` Mark Kettenis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ED4CA1B.2000004@suse.cz \
--to=mludvig@suse.cz \
--cc=gdb-patches@sources.redhat.com \
--cc=kettenis@chello.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox