From: David Daney <ddaney@caviumnetworks.com>
To: gdb-patches@sourceware.org
Cc: "Pinski, Andrew" <Andrew.Pinski@caviumnetworks.com>
Subject: [PATCH] Make mips-linux signal frame unwinding more robust.
Date: Mon, 22 Feb 2010 18:36:00 -0000 [thread overview]
Message-ID: <4B82CEC4.2010607@caviumnetworks.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]
Greetings,
The current signal frame unwinding code in mips-linux-tdep.c assumes a
constant offset from the signal return trampoline to the signal frame.
The assumption does not hold for all kernels. Specifically those that
have to be compiled with ICACHE_REFILLS_WORKAROUND_WAR set (SGI O2 for
example). In the near future, it is likely that the assumption will
cease to hold universally, as we are attempting to move the signal
return trampoline off the stack entirely.
The libgcc unwinder already gets this right by using the signal frame's
SP to locate the sigcontext.
This patch makes gdb follow suit and find the sigcontext_base using the
signal frame's SP rather than an offset from the trampoline.
Tested on mips64-linux with no regressions (and more than 100 improvements).
OK to commit?
How about on the 7.1 branch?
2010-02-22 David Daney <ddaney@caviumnetworks.com>
* mips-linux-tdep.c: Update struct sigframe comments.
(mips_linux_o32_sigframe_init): Set sigcontext_base using
this_frame's sp.
(mips_linux_n32n64_sigframe_init): Same.
[-- Attachment #2: gdb.patch --]
[-- Type: text/plain, Size: 1691 bytes --]
Index: gdb/mips-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-linux-tdep.c,v
retrieving revision 1.81
diff -u -p -r1.81 mips-linux-tdep.c
--- gdb/mips-linux-tdep.c 1 Jan 2010 07:31:37 -0000 1.81
+++ gdb/mips-linux-tdep.c 19 Feb 2010 21:58:32 -0000
@@ -797,7 +797,7 @@ static const struct tramp_frame mips_lin
struct sigframe {
u32 sf_ass[4]; [argument save space for o32]
- u32 sf_code[2]; [signal trampoline]
+ u32 sf_code[2]; [signal trampoline or fill]
struct sigcontext sf_sc;
sigset_t sf_mask;
};
@@ -827,7 +827,7 @@ static const struct tramp_frame mips_lin
struct rt_sigframe {
u32 rs_ass[4]; [argument save space for o32]
- u32 rs_code[2] [signal trampoline]
+ u32 rs_code[2] [signal trampoline or fill]
struct siginfo rs_info;
struct ucontext rs_uc;
};
@@ -871,7 +871,7 @@ mips_linux_o32_sigframe_init (const stru
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
int ireg, reg_position;
- CORE_ADDR sigcontext_base = func - SIGFRAME_CODE_OFFSET;
+ CORE_ADDR sigcontext_base = get_frame_sp (this_frame);
const struct mips_regnum *regs = mips_regnum (gdbarch);
CORE_ADDR regs_base;
@@ -1038,7 +1038,7 @@ mips_linux_n32n64_sigframe_init (const s
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
int ireg, reg_position;
- CORE_ADDR sigcontext_base = func - SIGFRAME_CODE_OFFSET;
+ CORE_ADDR sigcontext_base = get_frame_sp (this_frame);
const struct mips_regnum *regs = mips_regnum (gdbarch);
if (self == &mips_linux_n32_rt_sigframe)
next reply other threads:[~2010-02-22 18:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-22 18:36 David Daney [this message]
2010-02-25 17:47 ` Joel Brobecker
2010-02-25 18:49 ` David Daney
2010-02-26 18:23 ` David Daney
2010-02-26 20:50 ` Daniel Jacobowitz
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=4B82CEC4.2010607@caviumnetworks.com \
--to=ddaney@caviumnetworks.com \
--cc=Andrew.Pinski@caviumnetworks.com \
--cc=gdb-patches@sourceware.org \
/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