This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Do not unwind frames past NULL PC
- From: Daniel Jacobowitz <drow at false dot org>
- To: "Maciej W. Rozycki" <macro at mips dot com>
- Cc: gdb-patches at sourceware dot org, Nigel Stephens <nigel at mips dot com>, "Maciej W. Rozycki" <macro at linux-mips dot org>
- Date: Fri, 22 Feb 2008 12:20:56 -0500
- Subject: Re: Do not unwind frames past NULL PC
- References: <Pine.LNX.4.61.0802221457040.21569@perivale.mips.com>
On Fri, Feb 22, 2008 at 05:12:18PM +0000, Maciej W. Rozycki wrote:
> Hello,
>
> Some architectures, like MIPS, specify in the ABI that the value of the
> return address in a frame (or in other words the value of the PC the frame
> would have been called from) being zero denotes the outermost frame. At
> the moment GDB does not seem to have a way to terminate frame unwinding in
> an architecture-specific way (or to that matter any that would not imply
> an error condition) in get_prev_frame_1(), which is where such a check
> would be needed.
>
> However even for these architectures which may not necessarily specify in
> the relevant ABI that a NULL PC is the terminating value it seems rather
> unlikely for a function to have been called in a way which would make its
> return address to be zero and yet it having a genuine caller with an
> associated frame. Therefore I propose the following check to be
> introduced to get_prev_frame_1(). It removes the confusing bogus frame at
> the bottom of a backtrace like below:
Similar changes have been proposed several times, but were controversial.
http://sourceware.org/ml/gdb-patches/2006-05/msg00196.html
http://sourceware.org/ml/gdb-patches/2006-07/msg00296.html
and more recently:
http://sourceware.org/ml/gdb-patches/2007-12/msg00004.html
--
Daniel Jacobowitz
CodeSourcery