## Watchpoint Status Indicators

Use watchpoints (sometimes referred to as access breakpoints) to halt program execution when a specific global location is accessed. After you set a watchpoint at a key point in memory, you can halt program execution whenever that point in memory is written to or read from. You can then examine the call chain, check register and variable values, and step through your code. You can also change values and alter the flow of normal program execution.

A watchpoint must be both enabled and resolved during a debug session in order to halt program execution. The Breakpoints view indicates the status of any watchpoint using a set of common icons and checkmark status badge. These include:

- An enabled watchpoint has a non-gray icon () indicating that program execution halts when encountered.
- A disabled watchpoint displays a gray icon () indicating that program execution will not stop when encountered.
- A resolved watchpoint has a small checkmark badge ( ) indicating that the debugger has located it in memory during program launch. When resolved, the debugger can halt program execution if the watchpoint is encountered.

In effect, a watchpoint that is enabled by the user and resolved by the debugger during program launch can halt program execution. The table below shows the various states that cause the debugger to halt program execution:

##### Table 1 Watchpoint—stop execution chart

Watchpoint | Resolved | Unresolved
--- | --- | ---
Enabled | Stops execution | No
Disabled | No | No

In addition, you can use these types of watchpoints:

- regular watchpoints—halt program execution
- conditional watchpoints—halt program execution after meeting a condition that you specify (same as for breakpoints)

A watchpoint is equivalent to a memory breakpoint.

Unlike a breakpoint, a watchpoint can detect when any part of your program affects memory. For example, if a write or write/read watchpoint is set, when the program writes a new value to the address or area of memory that has the watchpoint, the debugger suspends program execution.

NOTE You cannot set a watchpoint on a local variable, because the debugger cannot detect watchpoints for variables stored on the stack or in registers.

##### Table 2 Watchpoint—types and states

Type | State | Icon | Explanation
--- | --- | --- | ---
Write | enabled |  | The watchpoint is activated for write access operations on the specific memory location and if resolved, will halt program execution on a write operation at the watchpoint.
disabled |  | Watchpoint is disabled for the source line, debugger does not halt program execution on a write operation.
Read | enabled |  | The watchpoint is activated for read access operations on the specific memory location and if resolved, will halt program execution on a read operation at the watchpoint.
disabled |  | Watchpoint is disabled for the source line, debugger does not halt program execution on a read operation.
Write/Read | enabled |  | The watchpoint is activated for both read and write access operations on the specific memory location and if resolved, will halt program execution on any read or write operation at the watchpoint.
disabled |  | Watchpoint is disabled for the source line, debugger does not halt program execution on a read or write operation.

A project can have a different maximum number of watchpoints, depending on the build target. The IDE generally limits the acceptable range for watchpoints to memory that it can write-protect. This range also depends on the host and on the application.

All set watchpoints appear in the Breakpoints view list.

#### Other references

- Watchpoints overview