This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
libthread_db.so
- From: Peter D HUERTER <pete dot huerter at st dot com>
- To: libc-alpha at sources dot redhat dot com
- Cc: Peter D HUERTER <pete dot huerter at st dot com>
- Date: Tue, 25 Jan 2005 17:16:54 +0100
- Subject: libthread_db.so
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.
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/libpthread_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?
Q: Is there a way to force a static link to use the NPTL thread library
instead?
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.
Thanks for your help,
Pete Huerter.
--
Peter Huerter - Software Engineer (pete.huerter@st.com)
AST Manno Lab, STMicroelectronics (ph:+41 91-612'86'41)