This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
backtrace/1667: [regression] backtraces include many invalid frames when debugging stripped executables
- From: ejalbert at cs dot stanford dot edu
- To: gdb-gnats at sources dot redhat dot com
- Cc: ejalbert at cs dot stanford dot edu
- Date: 9 Jun 2004 21:58:33 -0000
- Subject: backtrace/1667: [regression] backtraces include many invalid frames when debugging stripped executables
- Reply-to: ejalbert at cs dot stanford dot edu
>Number: 1667
>Category: backtrace
>Synopsis: [regression] backtraces include many invalid frames when debugging stripped executables
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jun 09 22:08:02 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Eric Albert
>Release: GNU gdb 2004-06-07-cvs
>Organization:
>Environment:
Fedora Core 2 (i686-pc-linux-gnu, kernel version 2.6.5-1.358)
>Description:
If I try to debug a stripped executable and do a backtrace, gdb no longer stops at the first frame. This worked correctly in gdb 6.0, but it broke in 6.1 and remains broken in the 6/8 weekly tarball.
Specifically, when following the directions in the "How-To-Repeat" section below, I get this backtrace with gdb 2004-06-07 and gdb 6.1:
(gdb) bt
#0 0x08048353 in ?? ()
#1 0x00000000 in ?? ()
#2 0x00376d00 in _dl_argv_internal () from /lib/ld-linux.so.2
#3 0xfeeabcc8 in ?? ()
#4 0x00392ad4 in __libc_start_main () from /lib/tls/libc.so.6
Previous frame identical to this frame (corrupt stack?)
And I get this backtrace with gdb 6.0:
(gdb) bt
#0 0x08048353 in ?? ()
The 6.0 backtrace is correct. The 6.1/current backtrace will continue on for an indeterminate number of frames, sometimes hundreds. It effectively makes 'bt' useless for stripped executables.
>How-To-Repeat:
Create test.c with this content:
-----
int main(void) {
static int foo = 0;
while (foo == 0) { }
return 0;
}
-----
Compile it with this line:
gcc -Wall -o test test.c
(the version of GCC is irrelevant; I'm using GCC 3.3.3)
Now debug it:
gdb ./test
(in gdb now)
r
(wait a second or two)
control-C
bt
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: