[PATCH] Fix debugging interface for nptl

Randolph Chung <[email protected]> Fri, 13 Jul 2007 01:33:56 +0000
Newsgroups gmane.linux.ports.hppa
Message-ID <[email protected]>
Jeff mentioned recently that with a NPTL-enabled glibc, gdb debugging of
any threaded app fails. For example:

(gdb) run
Starting program: /home/tausq/userspace/thread_test2
[Thread debugging using libthread_db enabled]
Error while reading shared library symbols:
find_new_threads_callback: cannot get thread info: generic error

Two fixes, one in glibc and one in gdb, are required to fix this. The
attached patch is the glibc portion.

2007-07-12  Randolph Chung  <[email protected]>

	* sysdeps/hppa/nptl/tls.h (DB_THREAD_SELF): Fix definition.

Please apply if ok.

randolph

_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
local-threaddb.diff (text/plain, 794 B)
Fix the register offset for libthread_db to do THREAD_SELF properly.

--- ports/sysdeps/hppa/nptl/tls.h.orig	2007-07-11 22:57:36.000000000 +0000
+++ ports/sysdeps/hppa/nptl/tls.h	2007-07-11 22:57:50.000000000 +0000
@@ -117,10 +117,11 @@
    	__self - 1;				\
    })
 
-/* FIXME */
-/* Magic for libthread_db to know how to do THREAD_SELF.  */
+/* Magic for libthread_db to know how to do THREAD_SELF.
+   Our thread pointer is stored in cr27.  See asm/elf.h for the offset into
+   elf_gregset_t.  The thread descriptor is sizeof (struct pthread) away.  */
 # define DB_THREAD_SELF \
-  REGISTER (32, 32, 32 * 4, -sizeof (struct pthread))
+  REGISTER (32, 32, 53 * 4, -sizeof (struct pthread))
 
 /* Access to data in the thread descriptor is easy.  */
 # define THREAD_GETMEM(descr, member) \