Subject: toolchain/32683: gdb can't step over strdup and co.
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <dillo@danbala.tuwien.ac.at>
List: netbsd-bugs
Date: 01/31/2006 19:10:01
>Number:         32683
>Category:       toolchain
>Synopsis:       gdb can't step over strdup and co.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 31 19:10:00 +0000 2006
>Originator:     Dieter Baron
>Release:        NetBSD 3.0
>Organization:
NetBSD
>Environment:
	
	
NetBSD legba 3.0 NetBSD 3.0 (LEGBA) #0: Sun Dec 25 23:59:10 MET 2005  root@wintermute:/usr/src/sys/arch/i386/compile/LEGBA i386
Architecture: i386
Machine: i386
>Description:
	In gdb, when stepping over a line containing a call to
	strdup or strlen (and possibly others) with `n', gdb breaks
	in _init_fallthru:

$ cat a.c             
#include <string.h>

int main(int argc, char *argv[])
{
char *a;

a = strdup("a");
strlen(a);
return 0;
}
$ gcc -g a.c
$ gdb a.out
GNU gdb 5.3nb1
Copyright 2002 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 "i386--netbsdelf"...
(gdb) br main
Breakpoint 1 at 0x8048758: file a.c, line 7.
(gdb) r
Starting program: /tmp/a.out 

Breakpoint 1, main (argc=1, argv=0xbfbfe914) at a.c:7
7       a = strdup("a");
(gdb) n
0x0804849c in init_fallthru ()
(gdb) n
Single stepping until exit from function init_fallthru, 
which has no line number information.

Program exited normally.
(gdb)

	Stepping into the functions with ``s'' will run and stop
	at the next line.
>How-To-Repeat:
	See above.
>Fix:
	None known.

>Unformatted: