RFA: Fix check for no-saved-pc

Mark Kettenis mark.kettenis@xs4all.nl
Tue Dec 4 18:05:00 GMT 2007


> From: Michael Snyder <msnyder@specifix.com>
> Date: Fri, 30 Nov 2007 17:37:24 -0800
> 
> On Fri, 2007-11-30 at 18:00 -0500, Daniel Jacobowitz wrote:
> > On Fri, Nov 30, 2007 at 02:40:31PM -0800, Michael Snyder wrote:
> > > There's a check in get_prev_frame to see if the next saved pc
> > > is zero.  I think it has an off-by-one error, and is checking 
> > > for the pc of the wrong frame.
> > 
> > Mark K. and I have had roughly a month's worth of discussion on this
> > check over the last two years; it's where it is on purpose.  Here's
> > the last conversation:
> > 
> >   http://sourceware.org/ml/gdb-patches/2006-05/msg00196.html
> >   http://sourceware.org/ml/gdb-patches/2006-07/msg00296.html
> 
> All right.  Then let's leave that test alone, and add another
> test, much later on, to detect and report this situation.
> 
> Here's my revised patch.  Testsuites un-affected.
> 
> As before, the effect of this change is to have gdb print
> a more informative message instead of a meaningless zero-frame.

It's not meaningless; it's a very valuabl hint that the stack has been
corrupted.  You'll get very similar output if youd chosen some random
value instead of zero when you corrupted the stack.  Why is zero special?

If your answer to that question is something like: "because on arm the
outermost frame gets marked by a zero pc", then please implement
proper backtrace termination for that case in the arm unwinder.

Mark



More information about the Gdb-patches mailing list