This is the mail archive of the
mailing list for the GDB project.
Re: thread local storage (__thread) variables aren't working in gdb 6.5/6.6?
It would be helpful to update the GDB man/info/docs to state that
thread local storage is not supported. It would also help to print an
error when attempting to access TLS __thread variable that says
"thread local storage is not supported." Currently, GDB implies that
__thread variables are bad addresses--for example, "Cannot access
memory at address 0x0". I have verified the same result in GDB 6.4,
6.5 and 6.6, with and without libpthread linked with the ELF. A simple
test case is in the email below if anyone is interested in checking
On 6/19/07, John Bates <email@example.com> wrote:
I can't find any confirmation of support or non-support of thread
local storage on the web or in the gdb documentation. I already tried
6.6 and it was the same problem. The test below seems to confirm
non-support on my fedora core 6 (kernel 2.6.18) x86 distribution with
gdb 6.5. Please let me know if I am doing something wrong for
debugging __thread global variables.
--- begin main.cpp ---
__thread int tlstest = 5;
tlstest = 4; // line 5
--- begin Makefile ---
CXXFLAGS += -g
main : main.o
g++ -g -c -o main.o main.cpp
cc main.o -o main
jbates@localhost:~/samples/tls_test$ gdb main
GNU gdb Red Hat Linux (6.5-15.fc6rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/libthread_db.so.1".
(gdb) b main.cpp:5
Breakpoint 1 at 0x8048352: file main.cpp, line 5.
Starting program: /home/jbates/samples/tls_test/main
Breakpoint 1, main () at main.cpp:5
5 tlstest = 4;
(gdb) p tlstest
Cannot access memory at address 0x0