Subject: bin/4656: Gdb next command doesn't work with dynamic libraries
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kivinen@ssh.fi>
List: netbsd-bugs
Date: 12/09/1997 17:22:35
>Number:         4656
>Category:       bin
>Synopsis:       Gdb next command doesn't work with dynamic libraries
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec  9 07:35:01 1997
>Last-Modified:
>Originator:     Tero Kivinen
>Organization:
Ssh Communications Security Oy
>Release:        1.3_BETA
>Environment:
	
System: NetBSD ietf-kaakeli.ssh.fi 1.3_BETA NetBSD 1.3_BETA (KAAKELI) #4: Fri Dec 5 06:38:03 EET 1997 ztk@kaakeli.ssh.fi:/usr/src/sys/arch/i386/compile/KAAKELI i386

gdb 4.16 (i386-netbsd)

>Description:

	When using next command to debug program and you try to go
	over dynamic library call you will end up inside the dynamic
	library and if you try using next the gdb will continue to run
	the program instead of stepping it line by line. When you go
	inside the dynamic library you can say "fin" and then "next"
	to get to correct place (see the first example). 

>How-To-Repeat:

	Compile this program with gcc -g -o t2 t2.c and try this on
	gdb:
----------------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv)
{
  char *p;

  p = malloc(1024);

  memset(p, 0, 1024);

  printf("I shouldn't be here yet!\n");
  
  exit(0);
}
----------------------------------------------------------------------
GDB is free software and you are welcome to 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.
GDB 4.16 (i386-netbsd), Copyright 1996 Free Software Foundation, Inc...
(gdb) b main
Breakpoint 1 at 0x1813: file t2.c, line 8.
(gdb) r
Starting program: /usr/home/kivinen/t2 

Breakpoint 1, main (argc=1, argv=0xefbfd4ac) at t2.c:8
8         p = malloc(1024);
(gdb) n
ietf-kaakeli (17:16) ~>gdb t2
GDB is free software and you are welcome to 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.
GDB 4.16 (i386-netbsd), Copyright 1996 Free Software Foundation, Inc...
(gdb) b main
Breakpoint 1 at 0x1813: file t2.c, line 8.
(gdb) r 
Starting program: /usr/home/kivinen/t2 

Breakpoint 1, main (argc=1, argv=0xefbfd4ac) at t2.c:8
8         p = malloc(1024);
(gdb) n
0x2094 in _DYNAMIC ()
(gdb) fin
Run till exit from #0  0x2094 in _DYNAMIC ()
0x181d in main (argc=1, argv=0xefbfd4ac) at t2.c:8
8         p = malloc(1024);
(gdb) n
10        memset(p, 0, 1024);
(gdb) n
0x208c in _DYNAMIC ()
(gdb) n
Single stepping until exit from function _DYNAMIC, 
which has no line number information.
0x4000204e in end ()
(gdb) n
Single stepping until exit from function end, 
which has no line number information.
0x4000e0d0 in end ()
(gdb) n
Single stepping until exit from function end, 
which has no line number information.
I shouldn't be here yet!

Program exited normally.
(gdb) 
----------------------------------------------------------------------
>Fix:
>Audit-Trail:
>Unformatted: