Subject: bin/6323: GDB is broken wrt shared libs
To: None <gnats-bugs@gnats.netbsd.org>
From: Krister Walfridsson <cato@ulysses.df.lth.se>
List: netbsd-bugs
Date: 10/18/1998 01:34:13
>Number:         6323
>Category:       bin
>Synopsis:       GDB is broken wrt shared libs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 17 16:35:01 1998
>Last-Modified:
>Originator:     Krister Walfridsson
>Organization:
	
>Release:        NetBSD-current Oct 17 1998
>Environment:
	
System: NetBSD ulysses 1.3H NetBSD 1.3H (GENERIC) #0: Sat Oct 17 20:54:20 CEST 1998 cato@ulysses:/dsk2/tmp/nbsd981017.i386/src/sys/arch/i386/compile/GENERIC i386


>Description:
GDB cannot step over calls to functions in shared libraries (at least not
for sparc and i386.)

>How-To-Repeat:
Try to debug the following program

int
main(void)
{
  printf("fnord\n");
  
  return 0;
}

ulysses> gcc -g bug.c 
ulysses> gdb a.out 
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) break main
Breakpoint 1 at 0x1830: file bug.c, line 6.
(gdb) run
Starting program: /usr/local/home/cato/test/a.out 

Breakpoint 1, main () at bug.c:6
6         printf("fnord\n");
(gdb) n
0x2084 in _PROCEDURE_LINKAGE_TABLE_ ()
(gdb)

>Fix:
The following patch to /src/gnu/dist/gdb/config/tm-nbsd.h solves the
problem, but is it the right thing to do? GDB has not been changed for
some time, so it must be something other that breaks it. It might
be a good idea to find what it is, and maybe fix that instead...

--- tm-nbsd.h.bak       Tue Jan 13 13:26:13 1998
+++ tm-nbsd.h   Sun Oct 18 01:18:07 1998
@@ -23,6 +23,7 @@
 /* Return non-zero if we are in a shared library trampoline code stub. */
 
 #define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \
-  (name && !strcmp(name, "_DYNAMIC"))
+  (name && \
+   (!strcmp(name, "_DYNAMIC") || !strcmp(name, "_PROCEDURE_LINKAGE_TABLE_")))
 
 #endif /* !SVR4_SHARED_LIBS */

>Audit-Trail:
>Unformatted: