RFA: Recognize bottom of stack on Linux
Jim Blandy
jimb@zenia.red-bean.com
Sun Feb 3 18:21:00 GMT 2002
Now, some folks feel that GDB should show the whole stack, including
_start, __libc_start_main, and anything else that's there. However,
this isn't the way GDB has ever traditionally behaved on native
targets. So this patch makes GDB's backtraces end after main.
2002-02-03 Jim Blandy <jimb@redhat.com>
* i386-linux-tdep.c (i386_linux_frame_chain): Stop the frame chain
after `main', not just after the compilation unit containing the
entry point.
Index: gdb/i386-linux-tdep.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/i386-linux-tdep.c,v
retrieving revision 2.7.10.1
diff -c -r2.7.10.1 i386-linux-tdep.c
*** gdb/i386-linux-tdep.c 2002/01/11 22:08:41 2.7.10.1
--- gdb/i386-linux-tdep.c 2002/02/04 02:19:28
***************
*** 352,358 ****
if (frame->signal_handler_caller || FRAMELESS_SIGNAL (frame))
return frame->frame;
! if (! inside_entry_file (frame->pc))
return read_memory_unsigned_integer (frame->frame, 4);
return 0;
--- 352,364 ----
if (frame->signal_handler_caller || FRAMELESS_SIGNAL (frame))
return frame->frame;
! /* On Linux, the entry point is called _start, but that invokes
! something called __libc_start_main, which calls main. So if we
! want the stack to end at main (as it does for GDB's other
! targets), the `PC in compilation unit containing entry point'
! rule triggers too late to get us the right result. */
! if (! inside_entry_file (frame->pc)
! && ! inside_main_func (frame->pc))
return read_memory_unsigned_integer (frame->frame, 4);
return 0;
More information about the Gdb-patches
mailing list