Suppose I start a gdb session, and create a breakpoint and run.
After I break, I create a watchpoint based on the memory address of a symbol in the current execution, and delete the original breakpoint.
Some time later, I interrupt the program with Control-C
, still inside gdb, I issue the run
command to restart the program from the beginning.
However, I would like to preserve the hardware watchpoint across the restart of the debugged process.
Is there a gdb setting that allows me to preserve hardware watchpoints across reruns?
Update: Here is an example to reproduce the problem.
int main(){
int NeverGoOutOfScope = 0;
NeverGoOutOfScope = 7;
while (1);
}
Here are the sequence of gdb
commands.
break 3
run
watch NeverGoOutOfScope
info watch
run
# After this point, the breakpoint remains but the watchpoint is gone.
info watch
Is it possible to preserve the watchpoint without having to recreate it?
Error in re-setting breakpoint NUMBER: No symbol "variable_name" in current context
, but it leaves the watchpoint in the breakpoints list:NUMBER hw watchpoint keep y variable_name
and its value is getting printed in the next run... – W.F.