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. 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 and breakpoints ...