I debug a process with GDB and set watch
to break when value in address changed, but it doesn't work!
Here is the initial value:
(gdb) x/s 0x60c010
0x60c010: "aaaaa"
Set a watch break point
(gdb) watch *0x60c010
Hardware watchpoint 2: *0x60c010
(gdb) commands
Type commands for breakpoint(s) 2, one per line.
End with a line saying just "end".
>echo "changed!!!!"
>end
Check the watch:
(gdb) info breakpoints
Num Type Disp Enb Address What
2 hw watchpoint keep y *0x60c010
echo "changed!!!!"
Change the value
(gdb) p (void*)memset(0x60c010,'c',5)
$2 = (void *) 0x60c010
Check if value changed
(gdb) x/s 0x60c010
0x60c010: "ccccc"
The problem that the breakpoint didn't stop the process even I change the value into that address