This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Move the frame zero PC check earlier


Eli Zaretskii <eliz@gnu.org> writes:
>> Cc: Mark Kettenis <mark.kettenis@xs4all.nl>,  gdb-patches@sourceware.org
>> From: Jim Blandy <jimb@codesourcery.com>
>> Date: Fri, 19 May 2006 10:38:36 -0700
>> 
>> > I think it was already suggested in this lengthy thread to display
>> > some kind of message to alert the user.  For example:
>> >
>> >   (Backtrace terminated due to zero return address.)
>> >
>> > Would this make everybody fairly happy to zero in on a solution?
>> 
>> (UNFAIR UNHAPPINESS ABOUT NON-ZERO SOLUTIONS FOR EVERYBODY!!!)
>> 
>> Well, no: the stacks we'd like to display are healthy and well-formed,
>> according to the conventions of the system; there's nothing
>> non-standard about them at all.  So they ought to display as normal
>> stacks --- on those systems.
>
> Sorry, I'm too dumb today to see what's humor here and what's for
> real.  It sounds like you want to see no message at all, and OTOH, you
> also objected to having a user option for turning the message on and
> off.  That leaves us at an impasse.

The first sentence was meant to be funny.  The following paragraph was
completely serious.  I don't think we're at an impasse.

Right now, on systems that terminate their stacks with zero return
addresses, GDB displays well-formed stacks incorrectly, showing an
extra frame after the oldest real frame.  Everyone agrees, including
Mark, that this behavior is wrong, and should be fixed.

Daniel's original proposal, which Joel and I think is fine, was to
make GDB treat a null return address as a proper end-of-stack on all
systems.  This would be a simple, localized change.  It would fix the
bug observed on zero-return-addr-stack-end systems.

The drawback Mark pointed out is that, on a system that does not use a
zero return address to indicate the end of the stack, if a stack has
been corrupted by having some return address overwritten with a zero,
GDB will display that stack as ending normally.  That is, because
Daniel's proposed change would affect all systems, not just systems
which intentionally use zero return addresses, it could make certain
kinds of corruption somewhat less apparent: instead of ending with a
weird frame with a 0x00000000 PC, the backtrace will simply end at the
prior frame.  You'll still have a stack that ends before you'd expect,
but it won't end in a mess.

The compromise is to do something which makes the interpretation of
zero return addresses specific to those ABI's that use it.  Daniel
suggested a gdbarch flag, but Mark wants to pursue having the
unwinders on such ABI's make the decision.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]