From: Daniel Jacobowitz <drow@false.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc, frame] Move the corrupt frame checks earlier
Date: Mon, 21 Aug 2006 11:07:00 -0000 [thread overview]
Message-ID: <20060820164848.GB20987@nevyn.them.org> (raw)
In-Reply-To: <200608201432.k7KEWeKR010677@elgar.sibelius.xs4all.nl>
On Sun, Aug 20, 2006 at 04:32:40PM +0200, Mark Kettenis wrote:
> > Date: Sat, 19 Aug 2006 11:56:54 -0400
> > From: Daniel Jacobowitz <drow@false.org>
> >
> > This patch is a follow-on to the unwind_stop_reason patch, although not
> > actually dependent. It moves the frame-went-inner and frame-same-ID
> > checks earlier in the backtrace process. Although they move down
> > in the function, they also check PREV rather than THIS.
> >
> > The benefit of doing this is that we display the stop reason before,
> > rather than after, the frame we've decided is corrupt. For instance,
> > suppose we have two frames with the same ID. That means they have the
> > same CFA and the same function. In other words, the same stack frame.
> > So the second backtrace entry will be a duplicate of the first. There's
> > no added value in displaying it, and logically it doesn't need to exist
> > on the frame chain.
>
> Sorry it's not clear to me what exactly the effect is. Does it make
> frames disappear that are there now? I wouldn't like that, since it
> the past I clearly remember getting useful information out of the last
> frame printed in a bad backtrace.
>
> Perhaps you can give an example of the old & new behaviour?
It does eliminate the last frame from the backtrace when displaying one
of these errors, yes. There is one bit of potentially useful
information there, but it isn't lost.
Suppose you've got a backtrace that looks like this.
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7ea61cb in poll () from /lib/tls/i686/cmov/libc.so.6
#2 0x0810c713 in gdb_do_one_event ()
#3 0x08109a43 in catch_errors ()
#4 0x080b8c13 in _initialize_tui_hooks ()
#5 0x08109d1d in current_interp_command_loop ()
#6 0x08077a3b in main ()
Then I manually stitch up the stack frame, to get this:
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7ea61cb in poll () from /lib/tls/i686/cmov/libc.so.6
#2 0x0810c713 in gdb_do_one_event ()
#3 0x0810c713 in gdb_do_one_event ()
Previous frame identical to this frame (corrupt stack?)
(By editing the saved %eip and %ebp for frame #2).
The question is, does frame #3 in that second backtrace display any
information other than what the error message does? It's got the same
CFA and PC, so it's literally a duplicate of the previous frame.
The one small difference is that you can go to frame 2 and 3, and type
info reg ebx, and get different results; that's because we have the
prev_register. But you can also go to frame 2 and type info frame, and
that will show you where the saved registers for this frame are; which
I think is just as useful.
For the "frame id inner" check it's more of a tossup. Now there's
extra information in the frame output not in the error message:
we'll print out the unwound value of PC. But both the address of
the saved eip and the value of the saved eip are available in info
frame.
My feeling is that this corrupt frame is not part of the backtrace,
and if you want to know more about it, having to type "info frame NUM"
is just fine.
Maybe I should add a bit to the manual about dealing with failed
backtraces? Whether they're program corruption or GDB failure,
the useful things to do are the same.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2006-08-20 16:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-20 13:10 Daniel Jacobowitz
2006-08-20 16:48 ` Mark Kettenis
2006-08-21 11:07 ` Daniel Jacobowitz [this message]
2006-08-22 20:32 ` Mark Kettenis
2006-08-22 21:04 ` 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=20060820164848.GB20987@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.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