Table of Contents
Previous topic Next topic
Watching C Variables->Watch Windows
A Watch window can be opened manually by selecting Watch from the Windows menu. A watch window will also open automatically if there is not an open watch window when you use the Add to Watch Window command.
You can add C variables to a Watch window in a number of ways:
- Place the text cursor on the variable that you want to watch, click the right mouse button and select Add to Watch Window. The variable will be added to the most recently active Watch Window.
- Place the text cursor on the variable that you want to watch and press Shift+F9. The variable will be added to the most recently active Watch Window.
To remove a variable from a Watch window, click the left mouse button on the row that contains the variable. Then press the Delete key.
- In the Name column of the Watch window, click the left mouse button on the cell that contains a feint dotted line. A small rectangle will be highlighted. Type the name of the variable you wish to watch and press <Enter>.
If the variable is a pointer, array, structure or union, a button appears next to the variable name. You can click on the button to expand and contract your view of the variable. The button displays a plus sign when the variable is being displayed in contracted form and a minus sign when it is displayed in expanded form.
The variable name and type, its value, its address and memory space are displayed in columns. The column widths can be manually adjusted by dragging the divider to the left or right.
To change the variable that is being displayed, click the left mouse button on the row that contains the variable. Then click again on the variable name itself. The name will be selected and the name field will become editable. Edit the value using normal editing procedures. Do not enter any type information. In fact any type information be removed when field becomes editable.
To cancel the editing process, press Escape.
To complete the editing process, press enter or click the mouse on another part of the display.
You can edit the values of variables. See Editing C Variable Values.
If you close the simulator with the Watch Window open, it will automatically re-open again when you next load in the same program.
You can freeze a watch window. Click the right mouse button on the window and select Freeze. The contents of the window will then not change until you unfreeze it.
Unless a Watch window is frozen, the contents of the window will be automatically updated as you program executes. If you step, the contents are updated after each step. If you trace, the contents are updated after each source line is executed. If you go, the contents are updated when execution halts. However, you can force an update to occur by setting a disabled breakpoint. When the program reaches the disabled breakpoint, the Watch window (and all other windows too) will be updated.