This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GDB and GCC and dynamic linking



alan@packetengines.com (Alan Mimms) writes:

> PerHAPs this is not the right list to mail this to - if so, please
> assist me in knowing which is the RIGHT list.

There's always bug-gdb... 1/2 :-)

> I am building what boils down to libdl (dynamic loading of separately
> linked libraries) for our PowerPC EABI based target.  The easy part is
> getting the DLL stuff to work.  The HARD part is determining what is
> going on in GDB's mind when I try to debug them!
> 
> The problem I am presently wrestling with is probably related by runtime
> fixups.  GDB thinks the &f for any function "f" is the same for all
> functions in a given compilation unit (i.e., *.c file).  So if a file
> contains definitions for functions x(), y() and z(), I can do (in GDB)
> "print &x" or "print &y" or "print &z" and get the SAME number.  The
> value displayed happens to be the address of the first ".text" in the
> image from that particular source file.  If I disassemble the code for
> each of the functions (by poking around to find their true address), the
> disassembler knows the right symbol names for the right addresses.
> 
> I am willing to debug this myself, but I would prefer to skip this if
> someone has a quick answer for me.

This kind of problem depends heavily on the form of the dynamically
linked library.  For instance, if you've tricked the linker in the
process of setting up to do runtime fixups, you'll have to educate GDB
on how to relocate all the symbols itself.  Another thing to be aware
of is the distinction between object file symbols and debug info
symbols.  Not knowing your runtime arch, I can't identify the specific
problem, but when studying this kind of thing, I use nm and objdump
and maint print symbols a lot...

							Stan Shebs
							Cygnus Solutions
							shebs@cygnus.com
________________________________________________
To get help for the crossgcc list, send mail to
crossgcc-request@cygnus.com with the text 'help'
(without the quotes) in the body of the message.