This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: libthread_db.so


On Tue, Jan 25, 2005 at 05:17:22PM +0100, Peter D HUERTER wrote:
> Hi Everyone,
> 
> I am trying to program a debugger to figure out which version of 
> libthread_db.so to use (to debug an SMP program linked -lpthread) in all 
> situations.  The debugger currently checks for 
> /lib/tls/libthread_db.so.1 first, and then for /lib/libthread_db.so.1 if 
> the /lib/tls version does not exist.  I understand that the thread_db 
> interface off /lib is to debug programs linked with the old linuxthread 
> debug library, and the thread_db interface off /lib/tls is used to debug 
> programs linked with the newer NPTL thread library.

Anything relating to the /lib/tls directory is really a question for
your distributor, not for the generic glibc list.  That's a distributor
hack (but most distributors use it nowadays).

> My problem is when I link -static (gcc -lpthread -static...).  When the 
> debugger attempts to debug a statically linked SMP program it is not 
> able to use /lib/tls/libthread_db.so.  When I force the debugger to use 
> /lib/libthread_db.so.1 everything works.
> 
> I am assuming that /lib/libthread_db.so goes with /lib/libpthread.so, 
> and /lib/tls/libthread_db.so goes with /lib/tls/libpthread.so.
> 
> Q: When I build my program -Bstatic does this automatically tell the 
> linker to link in the old linuxthread library?

Whichever was in /usr/lib.

> Q: Is there a way to force a static link to use the NPTL thread library 
> instead?

Your distributor probably provides appropriate libraries in some other
package.

> Q: I would like for the debugger not to break if  /lib/tls disappears.  
> How can I select which version of libthread_db.so.1 to use when my 
> program is statically linked?
> 
> Q: Will this work?:
>    if  symbol "__linuxthreads_version" is found in the symbol tables of 
> exe/solibs then use /lib/libthread_db.so
>    else if /lib/tls/libthread_db.so exists use it
>    otherwise use /lib/libthread_db.so
> 
> This debugger works on both x86, and x86-64.  Any info would be much 
> appreciated.

For GDB, I just try initializing both of them.  Only one will succeed.

-- 
Daniel Jacobowitz


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