At startup, acid obtains standard function definitions from the library file /lib/acid/port, architecture-dependent functions from /lib/acid/$objtype, user-specified functions from $home/lib/acid, and further functions from -l files. Definitions in any file may override previously defined functions. If the function acidinit() is defined, it will be invoked after all modules have been loaded. See 2c(10.1) for information about creating acid functions for examining data structures.
Variable types (integer, float, list, string) and formats are inferred from assignments. Truth values false/true are attributed to zero/nonzero integers or floats and to empty/nonempty lists or strings. Lists are sequences of expressions surrounded by {} and separated by commas.
Expressions are much as in C, but yield both a value and a format. Casts to complex types are allowed. Lists admit the following operators, with subscripts counted from 0.
Format codes are the same as in db(10.1). Formats may be attached to (unary) expressions with \, e.g. (32*7)\D. There are two indirection operators, * to address a core image, @ to address a text file. The type and format of the result are determined by the format of the operand, whose type must be integer.
Statements are
Here is a partial list of functions; see the manual for a complete list.
% acid /bin/ls /bin/ls: mips plan 9 executable /lib/acid/port /lib/acid/mips acid: new() 70094: system call _main ADD $-0x14,R29 70094: breakpoint main+0x4 MOVW R31,0x0(R29) acid: pid 70094 acid: argv0 = **main:argv\s acid: whatis argv0 integer variable format s acid: *argv0 /bin/ls acid: bpset(ls) acid: cont() 70094: breakpoint ls ADD $-0x16c8,R29 acid:
Display elements of a linked list of structures:
complex Str { 'D' 0 val; 'X' 4 next; }; complex Str s; s = *headstr; while s != 0 do{ print(s.val, "\n"); s = s.next; }
Note the use of the . operator instead of ->.
Display an array of bytes declared in C as char array[].
*(array\s)
This example gives array string format, then prints the string beginning at the address (in acid notation) *array.
ACID(10.1 ) | Rev: Sun Feb 22 17:41:21 GMT 2009 |