Subject: Problems with "gdb 4.17"
To: None <>
From: Sean McKnight <>
List: tech-userlevel
Date: 04/09/2001 19:27:54

I am having some trouble with "gdb" and I am wondering if 
anyone can offer some advice.

Here is the "uname -a" output for the machine that I am using (a 
SPARCstation 10):

NetBSD uhura 1.5 NetBSD 1.5 (GENERIC) 
#1: Wed Nov 29 00:29:52 MET 2000     
root@flambard:/usr/src/sys/arch/sparc/compile/GENERIC sparc

First I compile a shared libarary using "gcc":

uhura%  gcc -g -fPIC -shared -o car.c

Then I compile some new code that uses the library:

uhura%  gcc -g -fPIC -o driver -R. -L. -lcar driver

When I run the driver program, everthing works fine.  But when 
I start up "gdb" and attempt to set break points I get the following 
in my "gdb" session:

uhura% gdb driver
GNU gdb 4.17
Copyright 1998 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 "sparc--netbsd"...
(gdb) break toyota
Breakpoint 1 at 0x20b04
(gdb) break nissan
Breakpoint 2 at 0x20af8
(gdb) run
Starting program: /home/mcknight/bug/driver 
Breakpoint 1 at 0x100804e8: file car.c, line 9.
Breakpoint 2 at 0x100804e8: file car.c, line 9.

Breakpoint 1, 0x100804e8 in __ctors () at car.c:9
9       }
(gdb) quit

From the output above you can see that the initial breakpoints seemed to be 
set correctly, but when the program is actually run in "gdb" is confused.

I have also tried to compile a newer version of "gdb" (version 4.18) and I 
get a large set of errors during the compilation of "solib.c":

gcc -c -g -O2     -I. -I. -I./config -DHAVE_CONFIG_H -I./../include/opcode -I./../readline/..  -I../bfd -I./../bfd  -I./../include  -I../intl -I./../intl -I./tui   solib.c
solib.c:204: warning: `struct rt_symbol' declared inside parameter list
solib.c:204: warning: its scope is only this definition or declaration,
solib.c:204: warning: which is probably not what you want.
solib.c: In function `solib_map_sections':
solib.c:336: structure has no member named `som_addr'
solib.c:337: structure has no member named `som_addr'
solib.c: In function `solib_add_common_symbols':
solib.c:397: argument `rtc_symp' doesn't match prototype
solib.c:204: prototype declaration
solib.c:398: storage size of `inferior_rtc_symb' isn't known
solib.c: In function `first_link_map_member':
solib.c:861: sizeof applied to an incomplete type
solib.c:862: invalid use of undefined type `struct _dynamic'
solib.c:866: invalid use of undefined type `struct _dynamic'
solib.c:867: sizeof applied to an incomplete type
solib.c:868: invalid use of undefined type `struct section_dispatch_table'
solib.c: In function `find_solib':

..and so forth.

Any ideas?


Sean McKnight
University of North Carolina at Chapel Hill


Here are the C source files for my simple example above:

--cut here--

#include <stdio.h>

void toyota()

void nissan()

--cut here--

--cut here--



--cut here--