gdb/1971: doing a 'next' from start of __libc_main causes segfault
Sat Jul 16 12:18:00 GMT 2005

>Number:         1971
>Category:       gdb
>Synopsis:       doing a 'next' from start of __libc_main causes segfault
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 16 12:18:00 UTC 2005
>Release:        6.3
Seen on Debian (Woody) and gentoo Linux
Load any C program into the debugger.  Set a breakpoint at __libc_start_main.  Start the pogram.  When the breakpoint is hit, type 'next'.  This results in a segfault.

I've attached a complete copy/paste of a shell session that shows in entirity how to reproduce this (on my system, at least!)

Content-Type: text/plain; name="gdb_bug.txt"
Content-Disposition: inline; filename="gdb_bug.txt"

bash-2.05b$ echo -e "#include <stdio.h>\nint main (void) {printf (\"Hello
world\"); return 0;}" > test.c
bash-2.05b$ gcc -g test.c
bash-2.05b$ gdb a.out
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library

(gdb) break __libc_start_main
Function "__libc_start_main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (__libc_start_main) pending.
(gdb) start
Breakpoint 2 at 0x8048394: file test.c, line 2.
Starting program: /home/gel/tests/a.out
Breakpoint 3 at 0xb7ed90c6
Pending breakpoint "__libc_start_main" resolved

Breakpoint 3, 0xb7ed90c6 in __libc_start_main () from /lib/tls/
(gdb) next
Single stepping until exit from function __libc_start_main,
which has no line number information.
Segmentation fault (core dumped)

More information about the Gdb-prs mailing list