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
Evaluating an expression in the Evaluation window
Similarly to evaluating and expression in-line, you can copy an expression into
the debugger's Evaluation window and evaluate it there. This way, messages (such as
an expression's value) are inserted in the Evaluation window instead of the source code
pane.
To open the Evaluation window, click the Evaluation Area toolbar button .
Copy in the expression from the debugger source pane to the Evaluation window. Select it and right-click. From the pop-up menu, select one of the following options:
Debugging during the development cycle
Inspecting and modifying variable values
Suspending, resuming, and terminating threads
Modifying code while debugging