September 2008
Intermediate to advanced
280 pages
6h 31m
English
A watchpoint is a special kind of breakpoint which, like a normal breakpoint, is an instruction that tells GDB to pause execution of your program. The difference is that watchpoints don't "live" at a line of source code. Instead, a watchpoint is an instruction that tells GDB to pause execution whenever an expression changes value.[11] That expression can be quite simple, like the name of a variable:
(gdb) watch i
which will make GDB pause whenever i changes value. The expression can also be quite complex:
(gdb) watch (i | j > 12) && i > 24 && strlen(name) > 6
You can think of a watchpoint as being "attached" to an expression; when the value of that expression changes, GDB will pause the program's execution.
Although watchpoints ...
Read now
Unlock full access