public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Thread Local Variable - Assertion 'frame' failed
@ 2010-08-21 12:23 Gunther Piez
  0 siblings, 0 replies; only message in thread
From: Gunther Piez @ 2010-08-21 12:23 UTC (permalink / raw)
  To: gdb

 Hello,

I am not sure if I hit a bug or am misusing gdb.

I am using static thread local class field, like this:

---
struct A {
  static __thread int x;
};

__thread int A::x = 0;

int main(int argc, char** argv) {
  return A::x;
}
---

When I try to see the value of A::x, I get an error:

GNU gdb (Gentoo 7.1 p1) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from gdbtest...done.
(gdb) b main
Breakpoint 1 at 0x40058f: file gdbtest.cpp, line 8.
(gdb) run
Starting program: gdbtest

Breakpoint 1, main (argc=1, argv=0x7fffffffd848) at gdbtest.cpp:8
8         return A::x;
(gdb) print A::x
warning: static field's value depends on the current frame - bad debug info?
findvar.c:423: internal-error: read_var_value: Assertion `frame' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

I think the value of the field actually depends on the current frame, at
least indirectly. Each thread has a different stack and a different A::x
too.

- Gunther

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-21 12:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-21 12:23 Thread Local Variable - Assertion 'frame' failed Gunther Piez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).