This is the mail archive of the gdb@sourceware.org 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: (linux/threads) Interesting side-effect of "auto-solib-add 0"


On Tue, Sep 12, 2006 at 05:47:20PM -0700, Joel Brobecker wrote:
> > You've missed the pertinent fact here.  We're not waiting for
> > libpthread.so to be loaded just for kicks!  The only way libthread_db
> > can operate is by querying back through GDB for the locations of
> > symbols in the thread library.  If we don't load that objfile, then
> > it can't initialize.
> 
> It's really strange. I put traces everywhere inside linux-thread-db
> so that if there was any callbacks called during the detection,
> I would see them. As you can see, I'm not very familiar with how
> this library works. Do you know where the callbacks are in the
> debugger code?

Ah, simple: they're not there.  Take a look at the ps_* routines in
proc-service.c.  In particular, ps_pglobal_lookup.  It's not at all
surprising that you couldn't find them; this is a very rare library
interface.  The shared library actually has undefined symbols which
must be satisfied by GDB.

Do you want to stick a comment in linux-thread-db.c somewhere
suggesting a look over there too?

> I've been trying to find a document that explains
> how the pthread_db library works, is there one?

Well, the way we use glibc's isn't documented anywhere, but this
library is historically Sun's - their documentation may be enlightening.

> > > The only difference I can see between the two runs is that symbols
> > > are read in one case, and not read in the other case. Is libthread_db.so
> > > dependent on having the symbol table being loaded or something of that
> > > sort?
> > 
> > Yes.  Don't load libpthread, won't get threads.
> 
> Sounds fair enough to me.

The technical alternative, if you want to implement it, would be to
always load symbols for libpthread.  What do you think?  We don't even
really need debugging symbols - just the minimal (ELF) symbol table.

> Eli, everyone,
> 
> Would it be something worth documenting somewhere in the manual?
> I could probably write a small paragraph somewhere after the description
> of the auto-solib-add setting.

If we leave it the way it is, I think this is a great idea.  Please be
sure to mark it as a GNU/Linux specific issue.

-- 
Daniel Jacobowitz
CodeSourcery


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