Charles.Forsyth20060303-partialeea662d19 years agoHistory
373 lines · 7.4 KB · Text
RawDownload
.TH ACID 10.1.SH NAMEacid \- debugger.SH SYNOPSIS.B acid[.BI -l " libfile][.B -wq] [.B -m.I machine] [.I pid][.I textfile].SH DESCRIPTION.I Acidis a programmable symbolic debugger.It can inspect one or more processes that share an address space.A program to be debugged may be specified by the process id ofa running or defunct process,or by the name of the program's text file .RB ( v.outby default).At the prompt,.I acidwill store function definitions or print the value of expressions.Options are.TP .9i.B -wAllow the textfile to be modified..TP.B -qDon't print variable renamings at startup..TP.BI -l " libraryLoad from .I libraryat startup; see below..TP.BI -m " machineAssume instructions are for the given CPU type(one of.BR 386 ,.BR 86 ,.BR 68020 ,.BR 960 ,.BR power ,.BR arm ,.BR mips ,.BR mipsco ,.BR sparc ,or.BR sunsparc )instead of using the magic number to selectthe CPU type..PPAt startup,.I acidobtains standard function definitions from the library file.BR /lib/acid/port ,architecture-dependent functions from.BR /lib/acid/$objtype ,user-specified functions from.BR $home/lib/acid ,and further functions from .B -lfiles.Definitions in any file may override previously defined functions.If the function.IR acidinit ()is defined, it will be invoked after all modules have been loaded.See.IR 2c (10.1)for information about creating.I acidfunctions for examining data structures..SS LanguageSymbols of the program being debugged become integer variables whose values are addresses.Contents of addresses are obtained by indirection.Local variables are qualified byfunction name, for example.BR main:argv .When program symbols conflict with.I acidwords, distinguishing .B $signs are prefixed.Such renamings are reported at startup; option.B -qsuppresses them..PPVariable types.RI ( "integer, float, list, string" )and formats are inferred from assignments.Truth values false/true are attributed to zero/nonzerointegers or floats and to empty/nonempty lists or strings.Lists are sequences of expressions surrounded by.BR {\^} and separated by commas..PPExpressions are much as in C or Alef,but yield both a value and a format.Alef-style casts to complex types are allowed.Lists admit the following operators, withsubscripts counted from 0..IP.BI head " list.br.BI tail " list.br.BI append " list", " element.br.BI delete " list", " subscript.PPFormat codes are the same as in.IR db (10.1).Formats may be attached to (unary) expressions with.BR \e ,e.g..BR (32*7)\eD .There are two indirection operators,.B *to address a core image,.B @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..PPStatements are.IP.BI if " expr " then " statement " "\fR[ \fPelse\fI statement \fR].br.BI while " expr " do " statement.br.BI loop " expr" , " expr " do " statement.br.BI defn " name" ( args ") {" " statement \fP}.br.BI local " name.br.BI return " expr.br.BR whatis " [ \fI name \fP].PPHere is a partial list of functions; see the manual for a complete list..TF asm(address).TP.B stk()Print a stack trace for current process..TP.B lstk()Print a stack trace with values of local variables..TP.B gpr()Print general registers.Registers can also be accessed by name, for example.BR *R0 ..TP.B spr()Print special registers such as program counter and stack pointer..TP.B fpr()Print floating-point registers..TP.B regs()Same as.BR spr();gpr() ..TP.BI fmt( expr , format )Expression .I exprwith format given by the character value of expression.IR format ..TP.BI src( address )Print 10 lines of source around the program address..TP.BI Bsrc( address )Get the source line for the program addressinto a window of a running.IR sam (10.1)and select it..TP.BI line( address )Print source line nearest to the program address..TP.B source()List current source directories..TP.BI addsrcdir( string )Add a source directory to the list..TP.BI filepc( where )Convert a string of the form .IB sourcefile : linenumberto a machine address..TP.BI pcfile( address )Convert a machine address to a source file name..TP.BI pcline( address )Convert a machine address to a source line number..TP.BI bptab()List breakpoints set in the current process..TP.BI bpset( address )Set a breakpoint in the current process at the given address..TP.BI bpdel( address )Delete a breakpoint from the current process..TP.B cont()Continue execution of current process and wait for it to stop..TP.B step()Execute a single machine instruction in the current process..TP.B func()Step repeatedly until after a function return..TP.BI stopped( pid )This replaceable function is called automatically when the given processstops.It normally prints the program counter and returns to the prompt..TP.BI asm( address )Disassemble 30 machine instructions beginning at the given address..TP.BI mem( address , string )Print a block of memoryinterpreted according to a string of format codes..TP.BI dump( address , n , string\fP)Like.BR mem (),repeated for .I nconsecutive blocks..TP.BI print( expr , ... )Print the values of the expressions..TP.BI newproc( arguments )Start a new process with arguments given as a stringand halt at the first instruction..TP.B new()Like .IR newproc (),but take arguments (except.BR argv[0] )from string variable.BR progargs ..TP.B win()Like .IR new (),but run the process in a separate window..TP.BI start( pid )Start a stopped process..TP.BI kill( pid )Kill the given process..TP.BI setproc( pid )Make the given process current..TP.BI rc( string )Escape to the shell,.IR rc (10.1),to execute the command string..SH EXAMPLESStart to debug.BR /bin/ls ;set some breakpoints; run up to the first one:.IP.EX% acid /bin/ls/bin/ls: mips plan 9 executable/lib/acid/port/lib/acid/mipsacid: new()70094: system call  _main       ADD     $-0x14,R2970094: breakpoint   main+0x4    MOVW    R31,0x0(R29)acid: pid70094acid: argv0 = **main:argv\esacid: whatis argv0integer variable format sacid: *argv0/bin/lsacid: bpset(ls)acid: cont()70094: breakpoint  ls   ADD $-0x16c8,R29acid: .EE.PPDisplay elements of a linked list of structures:.IP.EXcomplex Str { 'D' 0 val; 'X' 4 next; };complex Str s;s = *headstr;while s != 0 do{	print(s.val, "\en");	s = s.next;}.EE.PPNote the use of the.B .operator instead of.BR -> ..PPDisplay an array of bytes declared in C as.BR "char array[]" ..IP.EX*(array\es).EE.PPThis example gives.B arraystring format, then prints the string beginning at the address (in.I acidnotation).BR *array ..SH FILES.B /proc/*/text.br.B /proc/*/mem.br.B /proc/*/ctl.br.B /proc/*/note.br.B /lib/acid/$objtype.br.B /lib/acid/port.br.B $home/lib/acid.SH SOURCE.B /utils/acid.SH "SEE ALSO".IR 2a (10.1),.IR 2c (10.1),.IR 2l (10.1),.IR alef (10.1),.IR mk (10.1),.IR db (10.1).brPhil Winterbottom,``Acid Manual''..SH DIAGNOSTICSAt termination, kill commands are proposedfor processes that are still active..SH BUGSThere is no way to redirect the standard input and standard outputof a new process..brSource line selection near the beginning of a file may pickan adjacent file..brWith the extant stepping commands, one cannot step through instructionsoutside the text segment and it is hard to debug across process forks.