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:
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:
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
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
Debugging During the Development Cycle
Inspecting and Modifying Variable Values
Suspending, Resuming, and Terminating Threads
Modifying Code while Debugging