This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Solaris 2.8 Symbol Address Problem
- From: andre at florath dot net
- To: gdb at sources dot redhat dot com
- Date: Wed, 29 Jan 2003 10:46:44 +0100
- Subject: Solaris 2.8 Symbol Address Problem
Hello!
Sorry, but this is not a full problem (bug?) report, because
it looks that this is somewhat stange and happens only sometimes; but
I'll do my best.
Environment:
Solaris 2.8 (sparc)
Compiler gcc 3.2.1
binutils-2.13.90.0.10
*Randomly* gdb thinks *some* symbols are placed at wrong
positions.
Example:
> nm AddrFail | fgrep " T " | fgrep main
00051b24 T main
> addr2line -f -e AddrFail 0x51b24
main
main.cc:24
> /opt/gcc321/pkg/insight+dejagnu-20030121/bin/gdb AddrFail
GNU gdb 20030121
Copyright 2003 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-sun-solaris2.8"...
(gdb) print main
$1 = {int (int, char **)} 0x75702c <main>
(gdb) quit
> /opt/gcc321/pkg/insight+dejagnu-20030121/bin/gdb -nw -dbx AddrFail
GNU gdb 20030121
Copyright 2003 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-sun-solaris2.8"...
(gdb) print main
$1 = {int (int, char **)} 0x7577ac <main>
(gdb) quit
> /opt/gcc321/pkg/insight+dejagnu-20030121/bin/gdb -nw -xdb AddrFail
GNU gdb 20030121
Copyright 2003 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-sun-solaris2.8"...
(gdb) print main
$1 = {int (int, char **)} 0x758224 <main>
(gdb) quit
> /opt/gcc321/pkg/insight+dejagnu-20030121/bin/gdb -w AddrFail
(Window opens; Console log:)
(gdb) print main
$1 = {int (int, char **)} 0x92308c <main>
(gdb)
(Exit from window mode)
> /opt/common/pkg/gdb-5.2/bin/gdb AddrFail
GNU gdb 5.2
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 "sparc-sun-solaris2.8"...
(gdb) print main
$1 = {int (int, char **)} 0x5b4974 <main>
(gdb) quit
> /opt/common/pkg/gdb-5.1.1/bin/gdb AddrFail
GNU gdb 5.1.1
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 "sparc-sun-solaris2.8"...
(gdb) print main
$1 = {int (int, char **)} 0x51b24 <main>
This looks to me that this was invented somewhere between
gdb-5.1.1 and gdb-5.2.
Other hints:
* Only a small change in the program 'AddrFail' and the 'main'
symbol is at the right place.
* I was not able to reproduce this error with a small and simple
program. (Current AddrFail is about 16M.)
* Checked the symbol table with: (GNU gdb 20030121)
maintenance print psymbols o.dat
Snipplet from 'o.dat':
------------------------------------------------------------
Partial symtab for source file [path-to]main.cc (object 0x16334b0)
Read from object file [path-to]/AddrFail (0x705508)
Relocate symbols by 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
Symbols cover text addresses 0x756f4c-0x792d0c
Depends on 0 other partial symtabs.
Global partial symbols:
`Callback', function, 0x791174
`Callback', function, 0x791af8
[...]
`main', function, 0x75702c
------------------------------------------------------------
Note: 0x75702c - 0x705508 = 0x51b24
* This is only an example; in mostly all programs I develop at the
moment, at one point during debugging, one or some symbols look to
have the wrong address. (This makes debugging using gdb nearly
impossible.)
* SUNs dbx debugger:
> /opt/SUNWspro/bin/dbx AddrFail
[..]
detected a multithreaded program
(/opt/SUNWspro/bin/../WS6U1/bin/sparcv9/dbx) print main
dbx: warning: unknown language, 'ansic' assumed
main = 0x51b24
I hope these are enough hints to fix this problem - if not,
please feel free to ask for more information.
Best regards
Andreas Florath
andreas@florath.net