This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: gdb and shared libraries
- From: Jim Blandy <jimb at red-bean dot com>
- To: Patrick Alken <patrick dot alken at colorado dot edu>
- Cc: gdb at sourceware dot org
- Date: Wed, 8 Feb 2006 21:54:35 -0800
- Subject: Re: gdb and shared libraries
- References: <20060208211332.GA8676@hippogriff.physics.drexel.edu>
On 2/8/06, Patrick Alken <patrick.alken@colorado.edu> wrote:
> So it is step #4 that I am hoping someone on the list can give me
> details for. How do you know when all the libraries have been loaded
> so that you can stop execution of the program while you load
> the libs symbol tables? How do you get the pathnames of the libraries
> after they have been loaded so you can mmap them?
Well, each time it loads a shared library, the dynamic linker calls a
specific function (I think it's _dl_debug_state on Linux), and there
is a designated data structure for you to walk to find the current
list of shlibs. See solib.c and solib-svr4.c.
But I can't remember, nor can I Google, where this stuff is
documented. I guess we're just depending on undocumented behavior (on
Linux, at least). But the whole reason it's there is to help out the
debugger, so I don't know why it'd be undocumented.