Is it possible to keep the hardware temporary point on restart in the same gdb session?

Suppose I start a gdb session and create a breakpoint and start.

After I break, I create a watchpoint based on the memory address of the character in the current execution and delete the original breakpoint.

After some time, I interrupt the program using Control-C, still inside gdb, I run the command runto restart the program from the very beginning.

However, I would like to keep the hardware monitoring point for restarting the debugged process.

Is there a gdb option that allows me to save hardware watchpoints during re-launches?


Update: here is an example to reproduce the problem.

int main(){
    int NeverGoOutOfScope = 0;
    NeverGoOutOfScope = 7;
    while (1);
}

Here is the sequence of commands gdb.

break 3
run
watch NeverGoOutOfScope
info watch 
run 
# After this point, the breakpoint remains but the watchpoint is gone.
info watch

?

+4
1

: -, ; -, watch -location.

, :

(gdb) set disable-randomization on

, , .

:

(gdb) watch -location NeverGoOutOfScope

. , - gdb , , , , .

, .

+2

All Articles