Expressions Window. freescale IDE 5.7
Advertisement
Advertisement
Working with Variables
Expressions Window
" B: " + ^var.bottom +
" R: " + ^var.right +
"}{H: " + (^var.bottom - ^var.top) +
" W: " + (^var.right - ^var.left) + "}"
</expression>
</variableformat>
</variableformats>
Given this new variable format definition, the Variables window now shows the same myRect
instance like this: myRect {T: 30 L: 30 B: 120 R: 120}{H: 90 W: 90}
To manipulate variable formats, you place an XML file that defines the new format inside the VariableFormats directory at
CodeWarrior/Bin/Plugins/Support/VariableFormats/ where CodeWarrior is the path to your CodeWarrior installation.
The IDE reads the XML files in this directory to determine how to display variable data.
explains the main XML tags that the IDE recognizes.
Table 19.3 Variable Format XML Tags
Tag
variableformats variableformat osname runtimename typename expression
Explanation
A group of variable format records.
An individual variable format record.
The operating system that defines the scope of this record.
The runtime that defines the scope of this record.
The name of the Type that this record will format.
The expression that reformats the variable display. The IDE evaluates this expression to determine the format that it applies to the variable. The IDE replaces all occurrences of the ^var placeholder with the name of the variable.
Expressions Window
The Expressions window ( Figure 19.3
) helps you monitor and manipulate these kinds of
items:
• global and local variables
• structure members
IDE 5.7 User’s Guide 233
Working with Variables
Expressions Window
• array elements
explains items of this window.
Figure 19.3 Expressions Window
Table 19.4 Expressions Window Items
Item
Expression column
Value column
Explanation
Lists expressions and expression hierarchies. Click the hierarchical controls to expand or collapse the expression view.
Shows the current value of each corresponding expression. Double-click a value to change it.
234
Opening the Expressions Window
Use the Expressions window to inspect frequently used variables as their values change during a debugging session.
To open the Expressions window, select View > Expressions or Window > Expressions
Window.
Alternatively, click the Expressions button in the Thread window toolbar to open the Expressions window.
Adding Expressions
The Expressions window handles various ways of adding expressions for inspection.
To add an expression to the Expressions window, do this:
• Select the desired expression and choose Data > Copy to Expression, or
IDE 5.7 User’s Guide
Working with Variables
Expressions Window
• Use the contextual menu with a selected expression, or
• Drag and drop an expression from another window into the Expressions window.
The Expressions window reflects the added expression. Drag expressions within the window to reorder them.
Adding a Constant Value to a Variable
You can enter an expression in the Expressions window that adds a constant value to a variable. Suppose x is a short integer type in the variable context of some function scope in C++ code. You can enter the expression x+1 and the IDE computes the resulting value just as you would compute it on a calculator.
1. Select the variable to which you want to add a constant value.
For example, select x.
2. Enter an expression that adds a constant value to the variable.
For example, append +1 to x so that the resulting expression is x+1.
The IDE adds the constant value to the variable and displays the result in the Expressions window.
Making a Summation of Two Variables
You can enter an expression in the Expressions window that computes the sum of two variables. Suppose x is a short integer type in the variable context of some function scope in C++ code. You can enter the expression x+y and the IDE computes the resulting value just as you would compute it on a calculator.
1. Select the variable to which you want to add another variable.
For example, select x.
2. Enter an expression that adds a second variable to the first variable.
For example, append +y to x so that the resulting expression is x+y.
The IDE computes the sum of the two variables and displays the result in the Expressions window.
Removing Expressions
The Expressions window handles various ways of removing expressions that no longer require inspection.
To remove an expression from the Expressions window:
IDE 5.7 User’s Guide 235
Working with Variables
Expressions Window
• Select the expression and choose Edit > Delete or Edit > Clear, or
• Select the expression and press the Backspace or Delete key.
The Expressions window updates to reflect the removed expression.
NOTE
Unlike the Variable window, the Expressions window does not remove a local variable after program execution exits the routine that defines the variable.
236 IDE 5.7 User’s Guide
Download
Advertisement