Due to debugger limitations, watchpoints cannot be used on
localvariables as they exist only within a particular function. When the function returns, a non-static local variable is de-allocated from the stack and thus a watchpoint on it starts watching a bogus memory (stack) address. In the case of a static local variable, consider setting a watchpoint on its memory address.
- Halt the target by pressing the
- In the opened dialog box, specify the expression to watch: a register name, a memory address, or a global variable name.
- Set the condition:
- To suspend program execution when the expression is read, check the Read box.
- To suspend program execution when the expression is written to, check the Write box.
- If you need to keep the watchpoint disabled now, uncheck theEnabledbox (checked by default).