1.7.5. Variable references

In C, using a variable in an expression can result in a value or an address:

Some legal assembly language variables can conflict with C operators, such as dot (.) and question mark (?). These characters are replaced with an underscore (_).

Table 1.12 shows examples of variable references that are supported, including an indication of what type of reference is being made.

Table 1.12. Examples of references to variables

Variable referenceReference type
int A;
A = 5;
A is fully referenced.
long temp;
temp = 9;
temp is fully referenced.
int arr[10], *LABEL;
arr is not fully referenced so its address is used.
LABEL = arr;
arr[3] = 8;
arr[3] is fully referenced.
int AB[10][10], *LABX;
AB is not fully referenced so its address is used.
LABX = AB[5];
LABX = LABEL;
LABEL is fully referenced so its value is used (the address it points to).
char *p,c;
p = &c;
p is fully referenced. c is not fully referenced.
c = *LABEL;
LABEL is dereferenced so the value of its address is used.

When you refer to a variable in a C/C++ expression that is not fully referenced, you are referring to the address of that variable, not the value. For this reason, the variable is considered unreferenced. The normal C operators are implemented to modify references. Table 1.13 shows the C operators.

Table 1.13. C operators for referencing and dereferencing variables

OperatorScalarPointerArrayStructureUnion
*-RefRef--
&DerefDeref-DerefDeref
->-Ref[a]---
.---RefRef
[ ]-RefRef--

[a] Must be a pointer to a structure or union. The right side must be a member of that structure or union. Otherwise, it is illegal.


These operators let you reference, or get the value of, and dereference, or get the address of, variables. The concept of referenced and dereferenced variables also applies to breakpoints. For example:

BREAKACCESS arrayname

This command sets an access breakpoint at the start address of the array arrayname because arrayname is not fully referenced.

The following form of the command sets a breakpoint at the value stored in arrayname[3] and not the address of arrayname[3], because it is fully referenced:

BREAKACCESS arrayname[3]

By including the special operator &, the following command enables you to set a breakpoint at the address of the array element arrayname[3]:

BREAKACCESS &arrayname[3]
Copyright © 2002-2010 ARM Limited. All rights reserved.ARM DUI 0175M
Non-ConfidentialID102410