3.5.2. Working with variables

To display a list of local or global variables, select the appropriate item from the View menu. A Locals/Globals window is displayed. You can also display the value of a single variable, or you can display additional variable information from the Locals/Globals window.

Follow these steps to display the value of a single variable:

  1. Select View  ? Variables  ? Expression.

  2. Enter the name of the variable in the View Expression dialog.

  3. Click OK. The variable and its value are displayed in the Expression window.

Alternatively:

  1. Highlight the name of the variable.

  2. Select View  ? Variables  ? Immediate Evaluation, or click

    the Evaluate Expression button. The value of the variable is displayed in a message box and in the Command window.

Note

If you select a local variable that is not in the current context, an error message is displayed.

Changing display formats

If the currently active window is the Locals, Globals, Expressions, or Debugger Internals window, you can change the format of a variable.

Follow these steps to change the format of a variable:

  1. Right click on the variable and select the Change line format from the Locals or Globals window menu. The Display Format dialog is displayed.

  2. Enter the display format. Use the same syntax as a printf() format string in C. Table 3.2 lists the valid format descriptors.

  3. Click OK.

Table 3.2. Display formats

Type

Format

Description

int

Only use this if the expression being printed yields an integer:

%d

Signed decimal integer (default for integers)

%u

Unsigned integer

%x

Hexadecimal (lowercase letters)

char

Only use this if the expression being printed yields a char:

%c

Character

char*

%s

Pointer to character. Only use this for expressions that yield a pointer to a null terminated string.

void*

%p

Pointer (same as %.8x), for example, 00018abc. This is safe with any kind of pointer.

float

Only use this for floating-point results:

%e

Exponent notation, for example, 9.999999e+00

%f

Fixed-point notation, for example, 9.999999

%g

General floating-point notation, for example, 1.1, 1.2e+06

Note

If you change a single line, that line is not affected by global changes.

Leave the Display Format dialog empty and click OK to restore the default display format. Use this method to revert a line format change to the global format.

The initial display format of a variable declared as char[]= is special. The whole string is displayed, whereas normally arrays are displayed as ellipses (…). If the format is changed it reverts to the standard array representation.

Variable properties

If you have a list of variables displayed in a Locals/Globals window, you can display additional information on a variable by selecting Properties from the window-specific menu (see Figure 3.9). To display the window-specific menu, right click on an item. The information is displayed in a dialog.

Figure 3.9. Variable Properties dialog

Variable Properties dialog

Indirection

Select Indirect through item from the Variables menu to display other areas of memory.

If you select a variable of integer type, the value is converted to a pointer. Sign extension is used if applicable, and the memory at that location is displayed. If you select a pointer variable, the memory at the location pointed to is displayed. You cannot select a void pointer for indirection.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D
Non-Confidential