So I was wondering how to stop gdb every time my variable (test_v) changes
Do I do
watch test_v stop
To stop the program every time the variable test_v changes?
You don't need to use
stop to make the program stop when the variable changes. Just
watch test_v is enough.
stop command is not for stopping the program, but only meant to be hooked so you can execute some commands automatically when the program stops. Example usage from the gdb manual:
define hook-stop handle SIGALRM nopass end define hook-run handle SIGALRM pass end define hook-continue handle SIGALRM pass end