7.5.3. Expressions

Some debugger commands require expressions as arguments. Their syntax is based on C. A full set of operators is available. The lower the number, the higher the precedence of the operator. These are shown in the following table, in descending order of precedence.

Table 7.3. Precedence of operators

PrecedenceOperatorPurposeSyntax

1

()

Grouping

a * (b + c)

[]

Subscript

isprime[n]

.

Record selection

rec.field,a.b.c

rec->next

->

Indirect selection

rec->next is identical to

(*rec).next

2

!

Logical NOT

!finished

~

Bitwise NOT

~mask

-

Unary minus

-a

*

Indirection

*ptr

&

Address

&var

3

*

Multiplication

a * b

/

Division

a / b

%

Integer remainder

a % b

4

+

Addition

a + b

-

Subtraction

a - b

5

>>

Right shift

a >> 2

<<

Left shift

a >> 2

6

<

Less than

a < b

>

Greater than

a > b

<=

Less than or equal

a <= b

>=

Greater than or equal

a >= b

7

==

Equal

a == 0

!=

Not equal

a != 0

8

&

Bitwise AND

a & b

9

^

Bitwise EOR

a ^ b

10

|

Bitwise OR

a | b

11

&&

Logical AND

a && b

12

||

Logical OR

a || b

Subscripting can only be applied to pointers and array names. The symbolic debugger checks both the number of subscripts and their bounds, in languages which support such checking. It is inadvisable to use out-of-bound array accesses. As in C, the name of an array may be used without subscripting to yield the address of the first element.

The prefix indirection operator * is used to de-reference pointer values. If ptr is a pointer, *ptr yields the object to which it points.

If the left-hand operand of a right shift is a signed variable, the shift is an arithmetic one and the sign bit is preserved. If the operand is unsigned, the shift is a logical one and zero is shifted into the most significant bit.

Note

Expressions must not contain function calls that return non-primitive values.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0041C
Non-Confidential