Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Jul 1996 13:22:32 -0400 (EDT)
From:      Bill Paul <wpaul@skynet.ctr.columbia.edu>
To:        hackers@freebsd.org
Subject:   gdb and dynamic symbol information
Message-ID:  <199607061722.NAA10798@skynet.ctr.columbia.edu>

next in thread | raw e-mail | index | archive | help

A while ago I discovered that gdb for the SunOS 4.1.x, Solaris 2.x
(SPARC and x86, probably PPC too), IRIX 5.x targets can read dynamic 
symbol information from stripped binaries. (There may be other targets
where this is possible; these are just the ones I know off the top of my 
head.)  This is to say that if you have a dynamically linked binary that 
has been stripped, you can still run gdb on it and accomplish a fair 
amount of useful things. This is true even if the executable has _not_ 
been compiled with -g. This is especially useful when trying to track 
down problems with vendor software for which source is not available. 
(Ever binary-edit an executable to toggle on a hidden debug flag? :)

My understanding is that gdb manages this little trick with Solaris
and IRIX because both systems use the ELF executable format, which
has a special section (.dynsym, I think) that is used for storing
symbol information used by the runtime linker. (I don't know if gdb
for Linux/ELF has the same capabilities since I don't have a system
to test with. If someone knows one way or the other, I'd be interested
to hear.) For SunOS 4.x, gdb has been taught to understand Sun's shared 
library hackery for a.out binaries.

What I would like to know is what sort of work would be required to
make our gdb do this for dynamically linked FreeBSD a.out executables.
I tried looking through the gdb sources but I couldn't actually find
the part that reads the SunOS dynamic symbol info. (While I dearly
love gdb, I must confess that its sources make my brain itch.) Is
our shared library implementation similar enough to SunOS's that we
could reuse some of the same code? If so, does anyone know how to
turn the feature on when building for an i386-freebsd target? Am
I dreaming?

-Bill

PS: I don't suppose anyone out there has tried to make dbx from the
    4.4BSD-Lite/Lite2 distribution work with FreeBSD, have they?
    (Gdb far outstripps dbx (pardon the pun) but it would still be
    fun to have it.)

-- 
=============================================================================
-Bill Paul            (212) 854-6020 | System Manager, Master of Unix-Fu
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
=============================================================================
 "If you're ever in trouble, go to the CTR. Ask for Bill. He will help you."
=============================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607061722.NAA10798>