From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29456 invoked by alias); 13 Sep 2006 02:21:21 -0000 Received: (qmail 29443 invoked by uid 22791); 13 Sep 2006 02:21:20 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 13 Sep 2006 02:21:16 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GNKNF-00071g-GL; Tue, 12 Sep 2006 22:21:13 -0400 Date: Wed, 13 Sep 2006 02:21:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: gdb@sources.redhat.com Subject: Re: (linux/threads) Interesting side-effect of "auto-solib-add 0" Message-ID: <20060913022113.GA26971@nevyn.them.org> Mail-Followup-To: Joel Brobecker , gdb@sources.redhat.com References: <20060913002712.GF24293@adacore.com> <20060913003347.GA24280@nevyn.them.org> <20060913004720.GG24293@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060913004720.GG24293@adacore.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00068.txt.bz2 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