This is the mail archive of the libc-alpha@sourceware.org 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]

[PATCH] TLS fix for debugging thread-local variables


When debugging a program on PowerPC with thread-local storage declared using "__thread", attempting to print a thread-local variable results in the the message "Cannot find thread-local storage for Thread <snip>: capability not available". This can be traced back to libc nptl_db/td_thr_tls_get_addr.c which gdb uses to look up the address of the TLS. The function returns TD_NOCAPAB due to a mismatch in size between the DTV pointer and the size recorded in the db description. The problem lies in nptl_db/db_info.c which initializes the db with the sizeof the union dtv. Instead it should be the sizeof a pointer to union dtv.

--
Pete Eberlein
IBM Linux Technology Center
Linux on Power Toolchain

2006-10-26  Pete Eberlein  <eberlein@us.ibm.com>

	* nptl_db/db_info.c [TLS_DTV_AT_TP]: Fixed size init for dtvp
	to sizeof a pointer, instead of sizeof the union.


--- glibc/nptl_db/db_info.c        2004-03-13 22:39:57.000000000 -0500
+++ glibc-new/nptl_db/db_info.c    2006-10-20 19:29:34.000000000 -0400
@@ -59,7 +59,7 @@
    i.e. at the very end of the area covered by TLS_PRE_TCB_SIZE.  */
 DESC (_thread_db_pthread_dtvp,
       TLS_PRE_TCB_SIZE + offsetof (tcbhead_t, dtv)
-      - (TLS_TCB_SIZE == 0 ? sizeof (tcbhead_t) : 0), union dtv)
+      - (TLS_TCB_SIZE == 0 ? sizeof (tcbhead_t) : 0), union dtv*)
 #endif

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