Expressions
The KDB kernel debugger and kdb command can parse a limited set of expressions. Expressions can only contain symbols, hexadecimal constants, references to register or memory locations, and operators.
Supported operators include the following:
Operator | Definition |
---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulo |
^ | Exponentiation |
( ) | Parenthesis (order of operations) |
@ | Dereferencing |
The dereference operator does the following:
- Indicates that the value at the location indicated by the next
operand is to be used in the calculation of the expression.
For example, @f000 indicates that the value at address 0x0000f000 should be used in evaluation of the expression.
- Allows access to the contents of a register.
For example, @r1 references the contents of general purpose register 1. Recursive dereferencing is allowed. As an example, @@r1 references the value at the address pointed to by the value at the address contained in general purpose register 1.
The + and - operators have equal precedence. Likewise, the * / % and ^ operators have equal precedence with each other. Multiple operators with the same precedence are always evaluated from left to right in an expression. The following are examples:
Valid Expressions | Results |
---|---|
dw @r1 | Displays data at the location pointed to by r1. |
dw @@r1 | Displays data at the location pointed to by value at location pointed to by r1. |
dw open | Displays data at the address beginning of the open routine. |
dw open+12 | Displays data twelve bytes past the beginning of the open routine. |
Invalid Expressions | Problem |
dw r1 | Must include the at sign (@) to reference the contents of r1, If a symbol r1 existed, this would be valid. |