| |||
| Home > RealView Debugger Commands > Alphabetical command reference > CEXPRESSION | |||
The CEXPRESSION command calculates and displays the value of an expression. You can also modify variables using the assignment operator.
CEXPRESSION [/R] expression
where:
/RSuppresses printing of the result, that is the line
beginning with the text Result is:.
expressionA valid debugger expression.
The CEXPRESSION command calculates the value of an expression or assigns a value to a variable. Debugger expressions are described in more detail in Chapter 1 Working with the CLI but include target function and procedure calls, debugger macro invocation, and scalar C languages expressions. You cannot manipulate values larger than 4 bytes, other than double values, in an expression.
If you use CEXPRESSION to run a target function, it is called using the target resources, including stack and heap space. The debugger ensures that the core processor registers are saved before calling the debugger function and restored afterwards. The following issues must be remembered when calling target application functions:
Target function calls must be supported for your processor.
You must ensure that the target has initialized those resources that the called function, and any function it calls, requires.
This normally requires at least that the C runtime code has completed execution so that the stack and heap are set up.
If the target function has side effects, for example changing global variables, the side effects might not be reflected in the original application straight away, because the compiler might have stored elements of that global state in registers, or even indirectly in the PC. It is likely that programs compiled with optimization enabled are more prone to this issue.
The following rules apply to the use of the CEXPRESSION command:
CEXPRESSION runs synchronously if the expression uses target registers, including the stack pointer, or if it uses target memory and background memory access is not available.
Use the WAIT command to force it to run synchronously.
You must have a valid target execution context before you can run target functions correctly.
Macros take higher precedence than target functions. If a target function and a macro have the same name, the macro is the one that is executed unless the target function is qualified.
Results are displayed in either floating-point format, address format, or in decimal, hexadecimal, or ASCII format depending on the type of variables used in the expression.
The ASCII representation is displayed if the expression value is a printable ASCII character.
Floating-point numbers are shown as double by default (14 decimal digits of precision). They can be cast to float to display 6 decimal digits of precision.
The following examples show how to use CEXPRESSION:
CEXPRESSION
Run_IndexDisplays the current value
of the variable named Run_Index.
CE /R Run_Index=50Assigns a value of 50 to the
variable named Run_Index, and suppresses the
printing of the result.
CE sin(0.2)Displays the value of the application function sin(),
passing in the value (double)0.2.
CE @R0 =20hWrites 0x20 to target register R0.
For more details on operations with registers, see Referencing reserved symbols.