This is the mail archive of the
mailing list for the GDB project.
Re: watchpoint on variable in function scope
Tom's test case works fine for me if I compile it as a C program.
However, it fails if I compile it as a C++ program. (Using gcc 4.4.3.)
Looking at the assembly, the C code names the static "i.1591", but the
C++ code uses "_ZZ3foovE1i".
So this seems to be a C++ name look up failure. Not sure it how should work.
$ gcc ~/bar.c -g
$ ./gdb ./a.out
GNU gdb (GDB) 18.104.22.16810513-cvs
(gdb) watch foo::i
Watchpoint 1: foo::i
Starting program: ./a.out
Hardware watchpoint 1: foo::i
Old value = 0
New value = 1
foo () at /home/saugustine/bar.c:4