Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] Infinite backtraces...
Date: Fri, 03 Dec 2004 21:44:00 -0000	[thread overview]
Message-ID: <41B0DCFE.7010903@gnu.org> (raw)
In-Reply-To: <20041203195741.GJ16491@adacore.com>

Joel Brobecker wrote:
>>Yes, gdb already creates the frame object and then later constructs the 
>>frame ID.  The build has been reduced to:
>>
>>	prev_frame = malloc ();
>>	prev_frame->next = this_frame;
>>	return prev_frame;
>>
>>Also note that, unlike the past, the frame ID is separate to the ``frame 
>>base'' the former can be NULL while the later is still valid.
>>
>>
>>>And then, after building each new frame, we display the information
>>>for that new frame.
>>
>>It is what lets us "up" on to an apparently corrupt frame.
> 
> 
> Reviewing the code that does the backtrace, I don't see how this
> would work. We're at the oldest frame, trying to unwind from it.
> So we compute its ID, and then create the previous frame.

Which ID, this or prev?

GDB computes this-ID does some sanity checks and then, assuming it is 
valid, blindly creates prev frame.

> I didn't find where in our code, in particular in stack.c, we're
> prepared to deal with a frame that we later find is invalid (via a null
> frame ID). Perhaps it is simpler to modify the build sequence above to
> add the computation of the frame ID and use that as a guard before
> creating the new frame?

A null-ID indicates that the frame can't be unwound from, not that it is 
necessarially itself invalid.

I think you're describing the old logic:

    if (prev frame ID valid)
	then return prev frame

it had the problem that it wasn't possible to examine that terminal, 
possibly corrupt, frame.  I deleted the test (and there was much 
celebration :-).

There are two objectives here:

- stop a run-away stack
which means correctly determining it's end

- deciding, for possibly cosmetic reasons, which frames to list
which means stopping the list at main by default

when it comes to the true outer-most frame there's always going to be 
fuz, as long as it terminates I think we're ok.

Andrew


  reply	other threads:[~2004-12-03 21:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-02 22:46 Joel Brobecker
2004-12-02 23:13 ` Joel Brobecker
2004-12-03  2:43   ` Randolph Chung
2004-12-03  2:57     ` Joel Brobecker
2004-12-03  4:53       ` Randolph Chung
2004-12-03 19:36         ` Joel Brobecker
2004-12-03 18:03           ` Randolph Chung
2004-12-03 18:20             ` Joel Brobecker
2004-12-03 18:22               ` Randolph Chung
2004-12-06  7:25               ` Randolph Chung
2004-12-07 10:07                 ` Joel Brobecker
2004-12-07 16:31                   ` Randolph Chung
2004-12-07 16:37                     ` Joel Brobecker
2004-12-07 16:52                       ` Randolph Chung
2004-12-08  1:51                       ` Randolph Chung
2004-12-12 16:36                         ` [commit] Move zero PC check to frame.c; Was: " Andrew Cagney
2004-12-03 18:22           ` Joel Brobecker
2004-12-06  4:15           ` Randolph Chung
2004-12-07  9:40             ` Joel Brobecker
2004-12-03 18:28 ` Andrew Cagney
2004-12-03 18:49   ` Joel Brobecker
2004-12-03 19:26     ` Andrew Cagney
2004-12-03 20:19       ` Joel Brobecker
2004-12-03 21:44         ` Andrew Cagney [this message]
2004-12-03 22:16           ` Joel Brobecker
2004-12-03 22:23             ` Daniel Jacobowitz
2004-12-03 22:25               ` Joel Brobecker

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=41B0DCFE.7010903@gnu.org \
    --to=cagney@gnu.org \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sources.redhat.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