Hi,
while DWARF from current HEAD or Fedora GCCs is broken:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39524
fixed GCC IMO provides correct DWARF but GDB from
archer-keiths-expr-cumulative (tested
35ca449e9f1a4cd477df644f717bbe4e3362c486) still does not resolve it correctly
(see below).
Tested GDB with GCC patched by the fix
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39524#c1
scratch-built as:
http://koji.fedoraproject.org/scratch/jkratoch/task_1253951/
Thanks for the fix,
Jan
# gdb -q ./outer
(gdb) l 1
1 #include <stdlib.h>
2
3 namespace A
4 {
5 static int var = 2;
6 }
7
8 int
9 main (void)
10 {
11 int var = 1;
12
13 if (var != 1) /* var-is-1 */
14 abort ();
15
16 {
17 using A::var;
18
19 if (var != 2) /* var-is-2 */
20 abort ();
21 }
22
23 return 0; /* break-here */
24 }
(gdb) b 13
Breakpoint 1 at 0x4005a7: file outer.C, line 13.
(gdb) r
Starting program: /tmp/outer
Breakpoint 1, main () at outer.C:13
13 if (var != 1) /* var-is-1 */
(gdb) p var
$1 = 1
(gdb) adv 19
main () at outer.C:19
19 if (var != 2) /* var-is-2 */
(gdb) p var
$2 = 1
^^^^^^ Wrong GDB evaluation.
(gdb) adv 23
main () at outer.C:23
23 return 0; /* break-here */
(gdb) q