Programming Guide : 16. Debugging Your Application : How Debugging an Application Works : How You Can Examine Values of Expressions
 
Share this page                  
How You Can Examine Values of Expressions
As you debug an application, you can examine the value of expressions using the Debugger window.
To examine an expression
1. In the Debugger window, drag the cursor over the expression in the script to select it.
2. Do one of the following:
Click the Examine toolbar button.
Click Tools, Values, Examine.
Right-click the selected expression and select Examine from the pop-up menu.
If you have not selected an expression when you click Examine, or if the selected expression is invalid, the Selection Popup dialog appears, letting you correct or enter the expression that you want to examine.
When you examine an expression, the Debugger displays the value of the expression in the data display area of the Debugging window:
If the value of the expression is a simple data type, the display has the form:
expression = type, value n
expression
Specifies the expression
type
Specifies its data type
n
Specifies its value
If the value of the expression is an object other than an array, the display has the form:
expression = classname 'objectname'
or
expression = Unnamed classname
expression
Specifies the expression
classname
Specifies the class of the object
objectname
Specifies the name of the object
If the value of the expression is an ArrayObject, the display has the form:
expression = Array of classname
expression
Specifies the expression
classname
Specifies the class of the objects in the array
Because two local procedures in the same main script can define identically named local variables, the Debugger tracks the scope for all expressions.
The scope of the currently executing line is used when the expression's value is displayed. This value is tracked in future displays. If you leave the script for which the scope of the variable is valid, the data display indicates that there is no valid value in the current scope.
If you do not want the Debugger to display these invalid variables, select the Hide Variables Not Valid in Current Scope option from the Examine Values pop-up menu. A checkmark appears to the left of the option.
When the value of an expression is an object, a plus sign (+) precedes the line where its value is displayed. Click the plus sign to expand the display and view the object's attributes. If any of its attributes are objects, they are likewise preceded by a plus sign and can be expanded in turn.
To close an expanded object, click the minus sign (-) that precedes the object.
When an ArrayObject has been expanded, an array type node follows the arrayobject class and its attributes. This node displays the class name of the row objects and the number of rows in the array. For an array of stringobject with 16 rows, the array type node is displayed as follows:
from stringobject[], 16 rows
When the array type node is expanded, the array row objects are displayed for the array.
For large arrays, the array row objects are displayed in groups of rows under group headings. Each heading displays the range of rows in its group. A group heading for rows 1 through 20 of an array has the following format:
arrayname[1] to arrayname[20]
arrayname
Represents the name of the array
For the settings that define a large array and the size of the groups for the array, see ..
Write Expanded Values to the Trace Window
Rather than expanding an object in the Debugger window, you can write the expanded values to the Trace window.
To write expanded values to the Trace window
1. Select an object in the script display area or the data display area.
2. Click Tools, Values, Expand in Trace Window, or right-click the highlighted object and click Expand in Trace Window from the pop-up menu.
The Number of Levels dialog appears, which lets you select how many indent levels to display. If you select the Prompt to Continue Output option, a slider field appears, letting you select the number of rows to be examined before you are prompted to continue or cancel.
3. Click OK.
The Debugger updates the values of the examined expressions in the data display area when the executing application updates them or when you assign new values in the Debugger window.
If the execution of a statement makes an expression invalid, the display indicates that this is the case. For example, suppose you have examined the expression "arrayname[7].num." If a statement that clears the array is executed, the expression is no longer valid, as indicated by the display.
After you examine an expression, the resulting value remains in the data display (and is updated as necessary) until you explicitly delete it. To delete lines in the data display, click Edit, Delete or Edit, Delete All.