User and Reference Guide

  • 2021.1
  • 12/04/2020
  • Public Content

Setting Watchpoints

Watchpoint is a special breakpoint type that suspends the program execution whenever the value of a specified expression (variable, register, memory address, and so on) changes.
: Due to debugger limitations, watchpoints cannot be used on
variables 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.
To set a watchpoint on an expression:
  1. Halt the target by pressing the
  2. In the Breakpoints view, click
    view menu
    View Menu
    and select
    watchpoint rw enabled
    Add Watchpoint (C/C++)
  3. In the opened dialog box, specify the expression to watch: a register name, a memory address, or a global variable name.
  4. Set the condition:
    • To suspend program execution when the expression is read, check the
    • To suspend program execution when the expression is written to, check the
  5. If you need to keep the watchpoint disabled now, uncheck the
    box (checked by default).
    watchpoint dialog
  6. Click
    Apply and Close
    . The watchpoint is added to the Breakpoints view.
The basic icon image depends on the specified mode:
  • watchpoint read enabled
    Read-only mode.
  • watchpoint write enabled
    Write-only mode.
  • watchpoint rw enabled
    Read-write mode.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at