Contents
Keyword
Index
Using the WDB
GUI
Reference
Information
Troubleshooting
Using
Help |
|
|
The Watch view displays the names and values of variables or
expressions. It is similar to the Local Variables view, but
the Watch view allows you to specify the variables that are
displayed. You can watch global variables, local variables, or
variables not in the current stack.
You can display specified global or local variables in the Watch
view when your program is paused. It is useful to watch specific
variable values to verify that your program is behaving as expected.
To view variables
- In the main window, click the Watch tab. The view
displays the names and values of global and local variables you
specified.
- To expand an expression, click the plus sign (+) to the left of
its name or double-click the line. To collapse an expression, click
the minus sign (-) or double-click the line.
To see the Watch view in a separate window
- Click the right mouse button, then click Open Separate View.
The separate window behaves the same as the tabbed Watch
view.
- To close the separate window, click the right mouse button, then
click Close.
See Tips for a shortcut to opening a separate
window.
To add a variable to the Watch view
- In the Watch view, click in the Add text box.
Type the name of a variable or expression.
- Press Enter. The Watch view evaluates the
variable or expression immediately and displays its value.
To delete a variable from the Watch view
- In the Watch view, select a variable. You can only delete
the highest level of a variable or expression; you cannot delete
subvalues of an expanded expression.
- Press the Delete key, or right-click and select Delete
Selected Line from the pop-up menu.
When the program is paused at a breakpoint or between steps, you can
change the value of any numeric or pointer variable. The modified
value replaces the current value in the program. This lets you try
changes and see their results in real time or recover from certain
logic errors.
To change a variable value
- In the Watch view, double-click the value you want to
edit. A cursor appears in the Value field.
- Edit the variable's value.
- Press Enter to update the program with the modified
variable value.
See Tips in the Watch View
reference topic for keyboard shortcuts.
NOTES:
- Press the Esc key to cancel the edit.
- Character string pointers--You cannot change the
content of the string, but you can change the address value to
point to a string at a different memory address.
- Character arrays -- You can edit the content of a
character array, but there is no safeguard to prevent you from
writing past the allocated array size. Also, the value must be
entered inside double quotes.
|
- The value of a variable is highlighted in red if it has changed
in the current context since the last break in program execution.
- Click the
toolbar button to open and close the Watch view in a
separate window.
- Click the right mouse button to display a pop-up menu that
contains commands to delete a line and open or close a separate
window.
- On the View menu, click Watch to quickly bring
the Watch view to the top.
- Keyboard shortcuts are available for moving in the Watch
view and editing a value. See Tips
in the Watch View reference topic.

Return
to Top |