linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollisb@us.ibm.com>
To: PPC64-dev List <linuxppc64-dev@ozlabs.org>,
	Linux PPC Dev <linuxppc-dev@ozlabs.org>
Subject: GDB backtrace and signal trampolines
Date: Thu, 11 Aug 2005 10:54:37 -0500	[thread overview]
Message-ID: <a22149f6d9cc6f65ae2f8f339d982dd2@us.ibm.com> (raw)

GDB 6.3 contains this code in ppc-linux-tdep.c:

static const struct frame_unwind *
ppc_linux_sigtramp_sniffer (struct frame_info *next_frame)
{
   struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch 
(next_frame));

   if (frame_pc_unwind (next_frame)
       > frame_unwind_register_unsigned (next_frame, SP_REGNUM))
     /* Assume anything that is vaguely on the stack is a signal
        trampoline.  */
     return &ppc_linux_sigtramp_unwind;
   else
     return NULL;
}

Essentially it says that any time the program counter is above the 
stack pointer, we must be in a signal trampoline, and so GDB proceeds 
to grope about for a struct rt_sigframe on the stack.

This is not a good assumption. I'm using a GDB stub to debug Xen, and 
as it so happens, the Xen stack is below the Xen text. That means that 
the above test always triggers, but of course there is no rt_sigframe 
on the stack, and my backtrace runs away.

Would it make sense to limit the test to within a few hundred bytes of 
the stack pointer? Or some better way to detect that the PC is in a 
signal trampoline?

(Also, how can I test backtraces within a signal trampoline? I've 
single-stepped my way into and out of a signal hander, and never saw 
the PC inside the stack.)

-- 
Hollis Blanchard
IBM Linux Technology Center

             reply	other threads:[~2005-08-11 15:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-11 15:54 Hollis Blanchard [this message]
2005-08-12  5:06 ` GDB backtrace and signal trampolines Anton Blanchard
2005-08-12 13:58   ` Hollis Blanchard
2005-08-24 13:52 ` Hollis Blanchard

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=a22149f6d9cc6f65ae2f8f339d982dd2@us.ibm.com \
    --to=hollisb@us.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=linuxppc64-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).