This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa] Partial fix for debugging static threaded apps
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sources dot redhat dot com, Michael Snyder <msnyder at redhat dot com>
- Date: Thu, 17 Mar 2005 17:14:41 -0500
- Subject: Re: [rfa] Partial fix for debugging static threaded apps
- References: <20041208165054.GA5904@nevyn.them.org>
On Wed, Dec 08, 2004 at 11:50:54AM -0500, Daniel Jacobowitz wrote:
> This patch finally connects linux-thread-db.c to the new inferior_created
> observer. The thread_db_new_objfile hook is broken out into a common
> function; it is called when new shared libraries are loaded, and when
> a new inferior is created or attached to. It's fairly straightforward.
>
> What isn't straightforward are the other issues with staticthreads.exp.
> Both of these were observed on my desktop system, a Debian GNU/Linux
> unstable, i686-linux system running NPTL and a 2.6 kernel.
>
> (A) This patch isn't strictly necessary, because there is always a shared
> library - even for static applications. That's because my kernel supports
> the vsyscall DSO, and GDB now handles it. The patch is still necessary for
> non-vsyscall setups.
>
> (B) This patch isn't sufficient, because GDB is dynamically linked to
> libthread_db, and loads it from /lib/tls/i686/cmov/libthread_db.so.1. That's
> NPTL. staticthreads is statically linked and gets LinuxThreads instead
> of NPTL. I have a follow-up patch which allows GDB to load both copies of
> libthread_db and use the right one. That fixes staticthreads.exp for me.
> I'll clean it up for submission after this patch is settled.
>
> Is this patch OK?
Ping. Michael, sorry about this; you asked me months ago if this patch
was still current and I never got back to you. As far as I know, yes,
it's still current.
> 2004-12-08 Daniel Jacobowitz <dan@debian.org>
>
> * Makefile.in (linux-thread-db.o): Add $(observer_h).
> * linux-thread-db.c: Include "observer.h".
> (check_for_thread_db): New function, broken out from
> thread_db_new_objfile. Update comments. Delete redundant
> using_thread_db check.
> (thread_db_new_objfile): Call check_for_thread_db.
> (check_for_thread_db_observer): New function.
> (_initialize_thread_db): Register an inferior_created
> observer.
--
Daniel Jacobowitz
CodeSourcery, LLC