https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43989
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |msebor at gcc dot gnu.org Known to work| |5.3.0, 6.3.0, 7.0 Resolution|--- |WORKSFORME --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- I cannot reproduce the GDB problem with supported versions of GCC. Resolving as WorksForSome. (Please report bugs in Red Hat GCC to Red Hat at https://bugzilla.redhat.com. $ (cat t.C && cc='/build/gcc-git/gcc/xg++ -B /build/gcc-git/gcc -L /build/gcc-git/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs'; $cc -g t.C && objdump -W a.out | grep ": varIn" && gdb -batch -ex 'b main' -ex 'b Function' -ex r -ex c -ex 'p varInFunc' -ex fin -ex 'p varInMain' a.out) void Function() { static int varInFunction = 2; } int main() { static int varInMain = 1; Function(); } <4f> DW_AT_name : (indirect string, offset: 0x19): varInMain <89> DW_AT_name : (indirect string, offset: 0x0): varInFunction Breakpoint 1 at 0x40053d: file t.C, line 9. Breakpoint 2 at 0x400536: file t.C, line 4. Breakpoint 1, main () at t.C:9 9 Function(); Breakpoint 2, Function () at t.C:4 4 } No symbol "varInFunc" in current context. main () at t.C:10 10 } $1 = 1