1.7.2. Data types

All symbols and expressions have an associated data type:

Table 1.10. Equivalent RealView Debugger data types for ARM assembler

ARM assembler data typeEquivalent data type in RealView DebuggerSize (bytes)
byteunsigned char1
wordunsigned short int2
longunsigned long4
8-byte longlong long8
single-precision floating pointfloat4
double-precision floating pointdouble8
labellabel1

You can access a specific number of bytes in memory using the following predefined macros:

Type conversion

The RealView Debugger performs data-type conversions under the following circumstances:

  • when two or more operands of different types appear in an expression, data type conversion is performed according to the rules of C or C++

  • when arguments are passed to a macro, the types of the passed arguments are converted to the types given in the macro function definition

  • when the data type of an operand is forced by user-specified type casting, it is converted

  • when a specific type is required by a command, the value is converted according to the rules of C/C++.

Type casting

Type casting forces the conversion of an expression to the specified data type. The contents of any variables that are referenced are not altered. Debugger expressions can be cast into different types using the following syntax:

(type_name) expression

Example 1.2 shows examples of casting different types.

Example 1.2. Casting symbols and expressions into different types

(char) prime             /* prime is cast to type char */
(float) 12               /* value is 12.0. (integer 12 in floating point) */
(int) sin(0.2)           /* value is 0, sin(0.2) is 0.198, truncates to 0 */
(int) ptr_char           /* the variable expression ptr_char is */
                         /* cast to type int */

The debugger can cast some expression types to an array type. Example 1.3 casts the constant expression 7 to an array of three characters starting at location 0x0007.

Example 1.3. Casting to an array

(char[3]) 7              /* address is 0x0007 */

This type of casting to an array can be used with the PRINTVALUE command. Assembly language structures can be displayed in a more meaningful form by using this technique. Table 1.11 lists additional special casting types. Arrays of hexadecimal types and pointers to hexadecimal types can also be used.

Table 1.11. Special casting types

CastCommandsMeaning

(QUOTED STRING) or (Q S)

PRINTVALUEShow as "string."

(INSTRUCTION ADDRESS) or (I A)

AllConvert into a legal source-level address.

(UNKNOWN TYPE) or (U T)

AllConvert into a single byte.

(HEX BYTE) or (H B)

AllShow in hex bytes.

(HEX WORD) or (H W)

AllShow in 16 bit hex.

(HEX DOUBLE WORD) or (H D)

AllShow in 32 bit hex.

See also

Copyright © 2002-2007 ARM Limited. All rights reserved.ARM DUI 0175I
Non-Confidential