Bug 11795 - Support __thread variables without libpthread
Summary: Support __thread variables without libpthread
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: threads (show other bugs)
Version: unknown
: P2 enhancement
Target Milestone: 7.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 13582 14345 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-07 17:36 UTC by Jan Kratochvil
Modified: 2016-09-01 16:29 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2012-07-15 00:00:00


Attachments
glibc draft patch by Roland McGrath. (6.85 KB, patch)
2010-07-07 17:37 UTC, Jan Kratochvil
Details | Diff
GDB draft patch. (3.21 KB, patch)
2010-07-07 17:38 UTC, Jan Kratochvil
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2010-07-07 17:36:34 UTC
echo 'main(){}'|gcc -g -x c -;./gdb -nx -ex start -ex 'p errno' ./a.out 
Cannot find thread-local variables on this target

It happens for any variable marked by __thread when -lpthread is not used.
Fedora GDB has some hacks such as using `*__errno_location()' instead of `errno'.

The proper way would be glibc extension to support __thread variables even
without -lpthread mode as they are used not just for `errno'.
Draft patches included.
Comment 1 Jan Kratochvil 2010-07-07 17:37:37 UTC
Created attachment 4873 [details]
glibc draft patch by Roland McGrath.
Comment 2 Jan Kratochvil 2010-07-07 17:38:41 UTC
Created attachment 4874 [details]
GDB draft patch.
Comment 3 Jan Kratochvil 2012-07-14 20:58:21 UTC
*** Bug 13582 has been marked as a duplicate of this bug. ***
Comment 4 Jan Kratochvil 2012-07-14 20:58:29 UTC
*** Bug 14345 has been marked as a duplicate of this bug. ***
Comment 5 Jan Kratochvil 2012-07-15 18:30:11 UTC
By Roland McGrath f2f, IIUC:
GDB can already iterate TIDs based on readdir(/proc/PID/task/).
Just TID->pthread_t translation and TLS variables access has currently no equaivalent without libthread_db.
Therefore drop libthread_db, Roland proposes / will accept Python based equivalent.  Even drop libthread_db from gdbserver, Python can run at GDB (not at gdbserver) as libthread_db-like-Python-implementation has no arch dependency like libthread_db.so has, it can run from client GDB with small gdbserver protocol extension packet for PTRACE_GET_THREAD_AREA and maybe some others.
Comment 6 Jackie Rosen 2014-02-16 16:59:43 UTC Comment hidden (spam)