This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: breakpoints in shared libraries


Tom Tromey wrote:

>Suppose I set a breakpoint in a shared library.  I find on my Linux
>box I can only do this after the inferior has been started.  So I use
>`b main', then `run', then set the breakpoints I really care about.
>(This gets old fast, btw.)
>
Yes. It should be fixed.  I seem to remember that at one point Gilmore
wrote code so that gdb could set a break point on a shared Solaris library
that had not been loaded.  There really is no excuse for gdb not being able
to set a breakpoint on a shared library specified on the linker command
line.  (Shared libraries loaded with an explicit call to dlopen are of
course a different matter.)

It should not be very difficult, but it requires knowing how the linker
does things.  Somewhere in the executable there has to be a data structure
that lists the libraries that will be loaded.  I seem to remember there 
actually
is some Linux program that will list the shared libraries requried by an
excutable, which should make it easy..  Gdb just has to be able to read
that data structure, and pre-load the symbol tables for the shared 
libraries.
You can then set breakpoints in those shared libraries.  When the library
actually gets loaded, we don't need to read the symbol tables, but we
need to relocate them.

Let's fix the real bug instead of kludge to make the bug slightly less
obnoxious.

    --Per




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