How to Set a Watch Point for an Instance Variable?
My Class Is Defined in a Header File, and I Need to Watch for Its Private Non-Static Member in Gdb, Like This: Class Foo { Int Bar; }; 0 1 Answer You Can Set...
My class is defined in a header file, and I need to watch for its private non-static member in GDB, like this:
class foo {
int bar;
};
1 Answer
You can set watchpoint on memory address.
You should stop in your code somewhere after foo constructor execution and print bar variable address.
Then you can set watchpoint on address like this:
(gdb) p &bar
$1 = (int *) 0x10793ad0
(gdb) watch *0x10793ad0