From: Daniel Jacobowitz <drow@false.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: sjackman@gmail.com, gdb-patches@sourceware.org
Subject: Re: Fix a crash when stepping and unwinding fails
Date: Tue, 21 Feb 2006 22:59:00 -0000 [thread overview]
Message-ID: <20060221215216.GA440@nevyn.them.org> (raw)
In-Reply-To: <200602212134.k1LLY3Sq028067@elgar.sibelius.xs4all.nl>
On Tue, Feb 21, 2006 at 10:34:03PM +0100, Mark Kettenis wrote:
> > It's this assumption I don't think is right. I have plenty of
> > anecdotal evidence from yesterday that it's not right, in fact.
> > If the prologue analyzer can't handle the code at $pc, then
> > what do you expect it to put into the frame ID? Or if it thinks we
> > are in the outermost frame?
>
> But get_current_frame() should be the innermost frame when we execute
> this code. So the prologue analyzer can't be involved here. However,
Remember the off-by-one distinction between prev_register and this_id?
The sentinel frame and its unwinder provide the current frame's
registers via their prev_register method. But the current frame's
unwinder is needed to compute the current frame's ID, and that's the
prologue analyzer in this case...
> yes, it seems that step_frame_idd can end up as null_frame_id, if
> get_current_frame() is also the outermost frame at the same time.
... so the outermost frame will generally have null_frame_id. Not sure
if that's true when we stop because we encounter main, but it's
definitely true when we run out of unwindable frames.
> > > How can we hit the last frame? If we're hitting the last frame, where
> > > did we come from?
> > >
> > > It may very well be that there are GDB bugs that make step_frame_id
> > > equal to null_frame_id. If we can't trace those bugs right now, we
> > > should probably sprinkle a few gdb_assert()'s around and try to solve
> > > the issues when we hit those.
> >
> > We use the null frame ID to represent the outermost frame. If we can't
> > find another frame outer to this one, then we assume this one is the
> > outermost.
>
> Yes, it seems there are issues here. The frame ID is supposed to be
> unique for a particular frame, yet there's a possibility that two
> distinct frames both end up with the null frame ID.
Are there? I think there's only one - the outermost. We've only got
that and the sentinel frame, and the sentinel frame I think doesn't
have an ID.
Perhaps part of the problem here is that step_frame_id is set to
null_frame_id when it is invalid; maybe we should keep that separate.
I don't think it would help me though. Perhaps the real problem is the
use of null_frame_id for both the outermost frame and completely
unknown frames. It would be nice if we could tell here:
if (frame_id_eq (frame_unwind_id (get_current_frame ()), step_frame_id))
that frame_unwind_id has returned something completely invalid instead
of the outermost frame.
One way to do that in our current representation would be to check that
the frame ID for the current frame is not null_ptid.
> > Just to sketch out my example a bit more: the embedded OS I'm debugging
> > lives in ROM. The application I've supplied to GDB lives in RAM. In
> > some later stage of the project, hopefully, I will have GDB magically
> > load some other ELF files (that I don't have yet) to cover the ROM
> > code; but right now I can't do that and there's no guarantee I'll have
> > debug info covering all of it anyway. So we're executing code way
> > out in the boondocks. GDB doesn't have any way on this platform
> > (ARM Thumb) to guess where the start of a function is if it doesn't
> > have a symbol table; so it can't be sure that we've really reached the
> > first instruction of a function, so it has no idea whether $lr is valid
> > or not.
>
> But that really means that we shouldn't be messing with step-resume
> breakpoints here. The whole notion of functions that can be stepped
> into isn't there.
Yes, it is. I've executed "step" in a place where I do have symbol
information (and working unwinders). It's taken me into a place where
I don't (a DLL in ROM). Since I don't have debug information any more
GDB would like to step back out to the call site, except it fails
because we've moved out of its known area.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2006-02-21 21:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-21 4:33 Daniel Jacobowitz
2006-02-21 10:01 ` Eli Zaretskii
2006-02-21 20:28 ` Mark Kettenis
2006-02-21 20:43 ` Daniel Jacobowitz
2006-02-21 20:54 ` Mark Kettenis
2006-02-21 21:03 ` Daniel Jacobowitz
2006-02-21 21:53 ` Mark Kettenis
2006-02-21 22:59 ` Daniel Jacobowitz [this message]
2006-02-22 22:00 ` Mark Kettenis
2006-02-23 2:04 ` Daniel Jacobowitz
2006-02-23 17:04 ` NZG
2006-05-17 17:59 ` Daniel Jacobowitz
2006-06-13 18:42 ` Daniel Jacobowitz
2006-06-14 12:33 ` Joel Brobecker
2006-06-16 1:16 ` Daniel Jacobowitz
2006-02-22 4:28 ` Jim Blandy
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=20060221215216.GA440@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
--cc=sjackman@gmail.com \
/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