|
NAMEacid, acidtypes - debuggerSYNOPSISacid [ -l library ] [ -wq ] [ -m machine ] [ pid | core ] [ textfile ]acidtypes [ -p prefix ] file ... DESCRIPTIONAcid is 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 of a running or defunct process, or by the name of the program's text file (a.out by default). At the prompt, acid will store function definitions or print the value of expressions. Options are
At startup, acid obtains standard function definitions from the library file /acid/port, architecture-dependent functions from /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. Then the function acidmap() will be invoked if defined. /acid/port provides a definition of acidmap that attaches all the shared libraries being used by the target process and then runs acidtypes (q.v.) to create acid functions for examining data structures. LanguageSymbols 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 main:argv. When program symbols conflict with acid words, distinguishing $ signs are prefixed. Such renamings are reported at startup; option -q suppresses them.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 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
The statement defn name clears the definition for name. A defn may override a built-in function; prefixing a function call with builtin ignores any overriding defn, forcing the use of the built-in function. Here is a partial list of functions; see the manual for a complete list.
Shared library segmentsWhen a pid or core file is specified on the command line, acid will, as part of its startup, determine the set of shared libraries in use by the process image and map those at appropriate locations. If acid is started without a pid or core file and is subsequently attached to a process via setproc, the shared library maps can be initialized by calling dynamicmap().Type informationUnix compilers conventionally include detailed type information in the debugging symbol section of binaries. The external program acidtypes extracts this information and formats it as acid program text. Once the shared libraries have been mapped, the default acid startup invokes acidtypes (via includepipe) on the set of currently mapped text files. The function acidtypes() can be called to rerun the command after changing the set of mapped text files.Acid LibrariesThere are a number of acid `libraries' that provide higher-level debugging facilities. One notable example is trump, which uses acid to trace memory allocation. Trump requires starting acid on the program, either by attaching to a running process or by executing new() on a binary (perhaps after setting progargs), stopping the process, and then running trump() to execute the program under the scaffolding. The output will be a trace of the memory allocation and free calls executed by the program. When finished tracing, stop the process and execute untrump() followed by cont() to resume execution.EXAMPLESStart to debug /bin/ls; set some breakpoints; run up to the first one (this example doesn't work on Unix yet):
Display elements of a linked list of structures:
Note the use of the . operator instead of ->. Display an array of bytes declared in C as char array[].
This example gives array string format, then prints the string beginning at the address (in acid notation) *array. Trace the system calls executed by (neither does this one):
FILES/acid/$objtype/acid/port /acid/kernel /acid/trump /acid/truss $HOME/lib/acid SOURCE/src/cmd/acidSEE ALSOPhil Winterbottom, ``Acid Manual''.DIAGNOSTICSAt termination, kill commands are proposed for processes that are still active.BUGSThere 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. Breakpoints do not work yet. Therefore, commands such as step, new, and truss do not work either. New in particular will need some help to cope with dynamic libraries. Visit the GSP FreeBSD Man Page Interface. |