User and Reference Guide

  • 2021.1
  • 12/04/2020
  • Public Content
Contents

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.
NOTE
: Due to debugger limitations, watchpoints cannot be used on
local
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
    suspend
    Suspend
    button.
  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
      Read
      box.
    • To suspend program execution when the expression is written to, check the
      Write
      box.
  5. If you need to keep the watchpoint disabled now, uncheck the
    Enabled
    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

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.