Unary Operators in MDB

Unary operators are right associative and have higher precedence than binary operators. The unary operators are:

#expression

Logical negation

~expression

Bitwise complement

-expression

Integer negation

%expression

Value of a pointer-sized quantity at the object file location corresponding to virtual address expression in the target's virtual address space

%/[csil]/expression

Value of a char-sized, short-sized, int-sized, or long-sized quantity at the object file location corresponding to virtual address expression in the target's virtual address space

%/[1248]/expression

Value of a one-byte, two-byte, four-byte, or eight-byte quantity at the object file location corresponding to virtual address expression in the target's virtual address space

<%/var/expression

Value from the object file location corresponding to virtual address expression. The size of the value is read from the variable var.

*expression

Value of a pointer-sized quantity at virtual address expression in the target's virtual address space

*/[csil]/expression

Value of a char-sized, short-sized, int-sized, or long-sized quantity at virtual address expression in the target's virtual address space

*/[1248]/expression

Value of a one-byte, two-byte, four-byte, or eight-byte quantity at virtual address expression in the target's virtual address space

*/type member/expression

Value of the data structure member from the target's virtual address space corresponding to virtual address expression. The size and offset that are read are specified by member. For example, to list all processes in a kernel that do not have a UID of zero (0):

> ::walk proc | ::grep '*/proc p_cred->cr_uid/.!=0'
<*/var/expression

Value from the target's virtual address space corresponding to virtual address expression. The size of the value is read from the variable var.