ACID(1)ACID(1)
NAME
acid, truss, trump – debugger
SYNOPSIS
DESCRIPTION
Allow the textfile to be modified.
Print variable renamings at startup.
Load from
Assume instructions are for the given CPU type
(one of
Debug the kernel state for the process, rather than the user state.
At startup,
Language
Symbols of the program being debugged become integer
variables whose values are addresses.
Contents of addresses are obtained by indirection.
Local variables are qualified by
function name, for example
Variable types
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
Statements are
The statement
Here is a partial list of functions; see the manual for a complete list.
Print a stack trace for current process.
Print a stack trace with values of local variables.
Print general registers.
Registers can also be accessed by name, for example
Print special registers such as program counter and stack pointer.
Print floating-point registers.
Same as
Expression
Print 10 lines of source around the program address.
Get the source line for the program address
into a window of a running
Print source line nearest to the program address.
List current source directories.
Add a source directory to the list.
Convert a string of the form
Convert a machine address to a source file name.
Convert a machine address to a source line number.
List breakpoints set in the current process.
Set a breakpoint in the current process at the given address.
Delete a breakpoint from the current process.
List watchpoints set in the current process.
Set a watchpoint for the len bytes at the given address. type is "r", "w" or "rw" to trap read accesses, write accesses or both, respectively.
Delete all watchpoints set for the given address.
Continue execution of current process and wait for it to stop.
Execute a single machine instruction in the current process.
Step repeatedly until after a function return.
This replaceable function is called automatically when the given process stops. It normally prints the program counter and returns to the prompt.
Disassemble 30 machine instructions beginning at the given address.
Print a block of memory interpreted according to a string of format codes.
Like
Print the values of the expressions.
Start a new process with arguments given as a string and halt at the first instruction.
Like
Like
Start a stopped process.
Kill the given process.
Make the given process current.
Escape to the shell,
Libraries
There are a number of
EXAMPLES
Start to debug
% acid /bin/ls /bin/ls: mips plan 9 executable /sys/lib/acid/port /sys/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
Display an array of bytes declared in C as
*(array\s)
This example gives
Trace the system calls executed by
% acid -l truss /bin/ls /bin/ls:386 plan 9 executable /sys/lib/acid/port /sys/lib/acid/kernel /sys/lib/acid/truss /sys/lib/acid/386 acid: progargs = "-l lib/profile" acid: new() acid: truss() open("#c/pid", 0) return value: 3 pread(3, 0x7fffeeac, 20, -1) return value: 12 data: " 166 " ... stat("lib/profile", 0x0000f8cc, 113) return value: 65 open("/env/timezone", 0) return value: 3 pread(3, 0x7fffd7c4, 1680, -1) return value: 1518 data: "EST -18000 EDT -14400 9943200 25664400 41392800 57718800 73447200 89168400 104896800 ..." close(3) return value: 0 pwrite(1, "--rw-rw-r-- M 9 rob rob 2519 Mar 22 10:29 lib/profile ", 54, -1) --rw-rw-r-- M 9 rob rob 2519 Mar 22 10:29 lib/profile return value: 54 ... 166: breakpoint _exits+0x5 INTB $0x40 acid: cont()
FILES
SOURCE
SEE ALSO
Phil Winterbottom,
“Acid Manual”.
DIAGNOSTICS
At termination, kill commands are proposed for processes that are still active.
BUGS
There is no way to redirect the standard input and standard output
of a new process.
Source line selection near the beginning of a file may pick
an adjacent file.
With the extant stepping commands, one cannot step through instructions
outside the text segment and it is hard to debug across process forks.