Evaluating Expressions in the Integrated Debugger

When a thread is suspended in the debugger, you can view the source code for all methods in the thread, and you can evaluate any expression in the source code to see what its value is, given the current values of visible variables in the program.

Using an Inspector Window
To evaluate an expression in the debugger and display the results in an Inspector window:

  1. In the Debug page of the Debugger browser, suspend a thread in a running program.
  2. In the All Programs/Threads pane, select a method in the suspended thread. Its source code will be shown in the Source pane of the browser.
  3. Select an expression that will evaluate to some value.
  4. Click the Inspect button inspect.gif (1041 bytes), or select Inspect from the selected code's pop-up menu.

An Inspector window will open to show the value of the expression, given the current values of the program's variables.

Displaying the Value In-Line
To evaluate an expression and display the result in the text of the Source pane:

  1. In the Debug page of the Debugger browser, suspend a thread in a running program.
  2. In the All Programs/Threads pane, select a method in the suspended thread. Its source code will be shown in the Source pane of the browser.
  3. Select an expression that will evaluate to some value.
  4. Select Display from the selected text's pop-up menu.

The value of the expression, along with the value's type, will be output as selected text in the Source pane.  Press the Delete key to remove the highlighted text.

Note:  This technique can be used to evaluate expressions in the Scrapbook as well.  In the Scrapbook, the toolbar button inspect.gif (1041 bytes) displays the resulting value in-line.

Evaluating expressions is useful, for example, for debugging if-statement and loop conditions that are producing unexpected results.

Example: Evaluating a Condition in the Debugger

ngrelc.gif (533 bytes)
The Integrated Debugger

ngrelt.gif (466 bytes)
Debugging During the Development Cycle
Inspecting and Modifying Variable Values
Suspending, Resuming, and Terminating Threads
Modifying Code while Debugging