The watch window provides a means to evaluate expressions and display the values of those expressions. Typically expressions are just the name of the variable to be displayed, but can be considerably more complex see debugger expressions. Note that the expressions are always evaluated when your program stops so the expression you are watching is the one that is in scope of the stopped program position.
The Watch window is divided into a tool bar and the main data display.
Button | Description |
![]() |
Displays the selected item in binary. |
![]() |
Displays the selected item in octal. |
![]() |
Displays the selected item in decimal. |
![]() |
Displays the selected item in hexadecimal. |
![]() |
Displays the selected item as a signed decimal. |
![]() |
Displays the selected item as a character or Unicode character. |
![]() |
Sets the displayed range in the active memory window to the where the selected item is stored. |
![]() |
Sorts the global variables alphabetically by name. |
![]() |
Sorts the global variables numerically by address or register number (default). |
Each expression appears as a row in the display. Each row contains the expression and its value. If the value of an expression is structured (for example an array) then you can open the structure see its contents.
The display is updated each time the debugger locates to source code. So it will update each time your program stops on a breakpoint or single step and whenever you traverse the call stack. Items that have changed since they that were previously displayed are highlighted in red.
To display watch window n if it is hidden, do one of the following:
—or—
—or—
—or—
When you select a variable in the main part of the display, the display format button highlighted on the Watch window tool bar changes to show the item’s display format.
To change the display format of a local variable, do one of the following:
—or—
The selected display format will then be used for all subsequent displays and will be recorded when the debug session stops.
For C programs the interpretation of pointer types can be changed by right clicking and selecting from the popup menu. A pointer can be interpreted as:
To modify the value of a local variable, do one of the following:
—or—