[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gdb
Subject:    Thread Local Variable - Assertion 'frame' failed
From:       Gunther Piez <gpiez () web ! de>
Date:       2010-08-21 12:23:39
Message-ID: 4C6FC54B.4000109 () web ! de
[Download RAW message or body]

 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic