From: Daniel Jacobowitz <drow@false.org>
To: gdb@sourceware.org
Subject: Re: [RFC] Using values to handle unwinding
Date: Fri, 19 Oct 2007 11:49:00 -0000 [thread overview]
Message-ID: <20071019114902.GB27622@caradoc.them.org> (raw)
In-Reply-To: <200710191141.l9JBfok4014965@d12av02.megacenter.de.ibm.com>
On Fri, Oct 19, 2007 at 01:41:50PM +0200, Ulrich Weigand wrote:
> > if (get_frame_type (next_frame) == NORMAL_FRAME)
> > return 0;
> Well, we can always just use "get_next_frame (this_frame)" instead
> of next_frame. Getting the next frame is always well-defined.
Right. get_next_frame fails when the next frame is the sentinel
frame, so it is not always useful if you need a frame that you can
pass to a frame_unwind_* routine. But it never fails if
frame->next->type would be NORMAL_FRAME.
> > I noticed this while looking at m68k-elf backtraces. It would be nice
> > to add a check like the above, either there or somewhere more generic,
> > because otherwise a garbage stack pointer leads to a near-infinite
> > backtrace. Any time that the current frame's PC points to somewhere
> > GDB has no symbol info, GDB will conclude that there is a frameless
> > function which only stored its return address on the stack at the
> > call. So each word of the stack is popped in turn and becomes a new
> > PC. Not very useful!
>
> Yes, situations similar to that were what prompted my addition of the
> above sanity check (Andrew's comment nonwithstanding :-/).
The m68k check turns out to be particularly thorny; this is a problem
with architectures where call pushes onto the stack. You can't
distinguish that from any other stack push, so all frames are assumed
to have a valid return address as long as the stack is readable.
I'm speculating about a "set backtrace max-uncertainty" and
frame_is_uncertain ()... or "set backtrace aggressive off"...
We shouldn't give up when we have no symbol information if the
architecture claims to know how to handle that case. This happens
when crashing in a stripped shared library, for instance, and on
i386 GNU/Linux GDB generally manages a useful backtrace anyway.
Anyway, that's unrelated to this patch. I'll save it for another
day :-)
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2007-10-19 11:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-17 16:04 Daniel Jacobowitz
2007-10-17 22:09 ` Daniel Jacobowitz
2007-10-19 11:42 ` Ulrich Weigand
2007-10-19 11:49 ` Daniel Jacobowitz [this message]
2007-10-19 4:30 ` Joel Brobecker
2007-10-19 11:43 ` Daniel Jacobowitz
2007-10-19 12:10 ` Ulrich Weigand
2007-10-19 12:40 ` Daniel Jacobowitz
2008-03-31 23:41 ` Daniel Jacobowitz
2008-04-04 17:53 ` Joel Brobecker
2008-04-05 15:56 ` 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=20071019114902.GB27622@caradoc.them.org \
--to=drow@false.org \
--cc=gdb@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