From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: ajit nayak <nayakajit@gmail.com>
Cc: gdb@sourceware.org, John Bates <johnnybates@gmail.com>
Subject: Re: thread local storage (__thread) variables aren't working in gdb 6.5/6.6?
Date: Mon, 13 Apr 2009 19:00:00 -0000 [thread overview]
Message-ID: <20090413160853.GA11305@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <b1bfafd50904130735x32d369a0ub4005758d7d9e2c8@mail.gmail.com>
Hi Ajit,
[ http://sourceware.org/bugzilla/show_bug.cgi?id=9384 ]
On Mon, 13 Apr 2009 16:35:30 +0200, ajit nayak wrote:
[snip]
> Below are the details. I did try with gdb-6.8 (after compining both with
> g++), but no luck..ran into the same problem.
if you try CVS HEAD it should work:
cvs -d :pserver:anoncvs@sourceware.org:/cvs/src co gdb
> However if I compile with gcc with a ".c" file (NOT .cpp) extension (gcc -g
> tls.cpp -o tls -lpthread), everyting works fine, i can access teh thread
> local variable from gdb. But my requirement is to compile .cpp files with
> g++ .
Checked the difference, both g++-4.3 and gcc-4.1 use more simple format as
read by `readelf -wi':
<1><88>: Abbrev Number: 7 (DW_TAG_variable)
<89> DW_AT_name : i
[snip]
<91> DW_AT_external : 1
<92> DW_AT_location : 10 byte block: 3 0 0 0 0 0 0 0 0 e0 (DW_OP_addr: 0; DW_OP_GNU_push_tls_address or DW_OP_HP_unknown)
while g++-4.1 uses:
<2><d2>: Abbrev Number: 7 (DW_TAG_variable)
DW_AT_name : i
[snip]
DW_AT_external : 1
DW_AT_declaration : 1
<1><de>: Abbrev Number: 8 (DW_TAG_variable)
DW_AT_specification: <d2>
DW_AT_location : 10 byte block: 3 0 0 0 0 0 0 0 0 e0 (DW_OP_addr: 0; DW_OP_GNU_push_tls_address)
Which is perfectly valid DWARF but current GDB cannot cope with it.
It starts working in post-6.8 FSF GDB because it gets resolved as an external
TLS reference. External TLS references did not work before. It is not
completely correct but in practice it works. Fixed by this patch:
http://sourceware.org/ml/gdb/2008-07/threads.html#00341
http://sourceware.org/ml/gdb-patches/2008-08/threads.html#00026
http://sourceware.org/ml/gdb-patches/2008-09/threads.html#00204
http://sourceware.org/ml/gdb-patches/2008-11/threads.html#00706
http://sourceware.org/ml/gdb-patches/2008-12/threads.html#00003
http://sourceware.org/ml/gdb-cvs/2008-12/msg00009.html
> [nz@TT4-A022 thread]$ cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 5.2 (Tikanga)
> *[nz@TT4-A022 thread]$ g++ -g tls.cpp -o tls -lpthread*
=> Also using g++43 (bare g++ is 4.1 on RHEL-5.2) would workaround GDB.
HTH,
Jan
prev parent reply other threads:[~2009-04-13 16:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-19 20:22 John Bates
2007-06-19 20:28 ` Daniel Jacobowitz
2007-06-19 20:56 ` John Bates
2007-06-19 21:04 ` Daniel Jacobowitz
2007-06-25 23:20 ` John Bates
2007-06-26 17:06 ` Jim Blandy
2007-06-26 18:48 ` John Bates
2007-06-26 23:52 ` Jim Blandy
2009-04-09 18:48 ` ajitnayak
[not found] ` <20090409200657.GA22217@host0.dyn.jankratochvil.net>
[not found] ` <b1bfafd50904130735x32d369a0ub4005758d7d9e2c8@mail.gmail.com>
2009-04-13 19:00 ` Jan Kratochvil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090413160853.GA11305@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb@sourceware.org \
--cc=johnnybates@gmail.com \
--cc=nayakajit@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox