2.2.20. CEXPRESSION

The CEXPRESSION command calculates and displays the value of an expression. You can also modify variables using the assignment operator.

Syntax

CEXPRESSION expression

where:

expression

Is a valid debugger expression.

Description

The CEXPRESSION command calculates the value of an expression or assigns a value to a variable. Debugger expressions are described in more detail in About 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.

Rules

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.

Examples

The following examples show how to use CEXPRESSION:

CEXPRESSION Run_Index

Displays the current value of the variable named Run_Index.

CE Run_Index=50

Assigns a value of 50 to the variable named Run_Index.

CE sin(0.2)

Displays the value of the application function sin(), passing in the value (double)0.2.

CE @R0 =20h

Writes 0x20 to target register R0.

See also

The following commands provide similar or related functionality:

Copyright © 2003, 2004 ARM Limited. All rights reserved.ARM DUI 0235B
Non-Confidential