Reputation: 31
I am trying to set up a watchpoint to monitor a variable in a package consisting of many C++ files.
There are many files
abc.cpp qwe.cpp .. xyz.cpp and so on
I want to monitor a variable 'temp' in some function qwerty() in the file abc.cpp How do I set the watchpoint ?
I tried
watch abc.cpp::temp watch abc.cpp:temp watch temp
but I see the errors No symbols 'abc.cpp::temp','abc.cpp:temp','temp' not in current context Also a info watchpoints tells me that no watchpoints are set. Note that I can set the breakpoints successfully for the same variable
Upvotes: 3
Views: 2480
Reputation: 4025
Do you want to make conditional breakpoints? If then you can use the commands below.
(gdb) break abc::qwerty()
(gdb) condition 1 temp=1 // If you want to break when the value of temp = 1.
Upvotes: 0
Reputation: 100186
I always set a breakpoint in the function, then set the watchpoint when I hit it, so that I'm in the context, then delete the breakpoint as appropriate.
Upvotes: 3