Evaluate
Contents
The following content has been imported from Legacy Help systems and is in the process of being checked for accuracy.
Function
The Evaluate panel is used to quickly determine the current value of a variable or expression in the active high-level source code document (*.C) currently being debugged.
Content and Use
Use the field at the top-left of the panel to enter the variable or expression you wish to evaluate and either click the Evaluate button or press ENTER. The variable/expression string will appear in the main region of the panel, with the result of the evaluation appearing next to it, under the Value column.
The variable/expression is not updated with respect to its value as you step-debug the code. You can, however, repeatedly use the Evaluate button to update the value for the entry manually.
If you wish to keep a constant watch on the variable/expression, where the value is updated as the code executes, use the Add Watch button to add the variable/expression as a new watch entry to the Watches panel.
Notes
- The variable(s) used in an expression must fall under the scope of the currently executing function or procedure in order to be valid (i.e. the variable(s) must be declared and used within the function or procedure whose code statements are currently being executed).
- You can change the values stored within variables during execution by writing an expression that, when evaluated, assigns its value to a valid variable. For example, entering the expression key = key*5 would set the variable key to five times its current value. This value would be subsequently used in the executing code.
Locals Panel
Function
The Locals panel allows you to interrogate the values of variables local to the function that the debugger has currently entered. You can also change the values of variables on-the-fly as you debug.
Content and Use
As you step-debug your source code, the panel will display all local variables and passed parameters as they are encountered for the current function. When entering a parametric function, the entries will appear in the panel after execution of the calling statement.
Variables that are part of a While loop are considered local to that loop. For example, consider the scenario illustrated by the following image:
In the outer While loop, the local variable on is encountered - this would appear in the Locals panel. When the inner While loop is entered, the on variable is no longer considered to be a local variable for this new loop and so is removed from the panel. The keydown variable is, however, local to this inner loop and so appears in the panel.
Changing Variable Values
Variable values will update automatically in accordance with code execution. You can, however, manually change variable values on-the-fly.
To change the value of a local variable or passed parameter as you debug, click on the value field for the variable you wish to change and type the new value directly. When finished, either click away from the field or press ENTER for the change to take effect.
Notes
- Use the arrow keys on the keyboard to quickly move through the list of variables and between the Name and Value fields.
- Data may be sorted by either column in the panel by clicking on the header for that column. Clicking once will sort in ascending order. Click again to sort by descending order.
- You can change the order in which the two columns are displayed. To move a column, click on its header and drag it horizontally to the required position. A valid position is indicated by the appearance of two green positional arrows.