Add a watch to track the values of program variables or expressions as you step over or trace into code. Each time program execution pauses, the debugger evaluates all the items listed on the Active tab (or ActiveWatchGroup) in the Watch List window and updates their displayed values.
You can organize watches into groups. When you add a watch group, a new tab is added to the Watch List window and all watches associated with that group are shown on that tab. When a group tab is displayed, only the watches in that group are evaluated during debugging. By grouping watches, you can also prevent out-of-scope expressions from slowing down stepping.
To add a watch
- Choose RunAdd Watch to display the Watch Properties dialog box.
- In the Expression field, enter the expression you want to watch. An expression consists of constants, variables, and values contained in data structures, combined with language operators. Almost anything you can use as the right side of an assignment operator can be used as a debugging expression, except for variables not accessible from the current execution point.
- Optionally, enter a name in the Group Name field to create the watch in a new group, or select a group name from the list of previously defined groups.
- Specify other options as needed (click Help on the Watch Properties dialog for a description of the options). For example, you can request the debugger to evaluate the watch, even if doing so causes function calls, by selecting the Allow Function Calls option.
- Click OK.
The watch is added to the
Watch List window.