32v 1m sdb
From Computer History Wiki
SDB(1) UNIX Programmer's Manual SDB(1)
NAME
sdb - C symbolic debugger
SYNOPSIS
sdb [ objfil [ corfil [ directory ] ] ]
DESCRIPTION
_S_d_b is a symbolic debugger for C programs. It may be used to examine their files and to provide a controlled environ- ment for their execution.
_O_b_j_f_i_l is an executable C program file which has been com- piled with the -g (debug) option. The default for _o_b_j_f_i_l is a.out. _C_o_r_f_i_l is assumed to be a core image file produced after executing _o_b_j_f_i_l; the default for _c_o_r_f_i_l is core. The core file need not be present.
It is useful to know that at any time there is a _c_u_r_r_e_n_t _l_i_n_e and _c_u_r_r_e_n_t _f_i_l_e. If _c_o_r_f_i_l exists then they are ini- tially set to the line and file containing the source state- ment at which the process terminated or stopped. Otherwise, they are set to the first line in main. The current line and file may be changed with the source file examination commands.
Names of variables are written just as they are in C. Vari- ables local to a procedure may be accessed using the form `procedure:variable'. If no procedure name is given, the procedure containing the current line is used by default. It is also possible to refer to structure members as `variable.member', pointers to structure members as `variable->member' and array elements as `variable[number]'. Combinations of these forms may also be used.
It is also possible to specify a variable by its address. All forms of integer constants which are valid in C may be used, so that addresses may be input in decimal, octal or hexadecimal.
Line numbers in the source program are referred to as `filename:number' or `procedure:number'. In either case the number is relative to the beginning of the file. If no pro- cedure or file name is given, the current file is used by default.
The commands for examining data in the program are:
t Print a stack trace of the terminated or stopped pro- gram.
variable/_m
Print the value of variable according to format _m. If _m is omitted, sdb chooses a format suitable for the variable's type as declared in the C program. Legal values for _m are
c character h 16 bit integer in decimal d int size integer in decimal l 32 bit integer in decimal u int size bit integer in decimal, unsigned o int size bit integer in octal x int size bit integer in hexadecimal f 32 bit single precision floating point g 64 bit double precision floating point s Assume variable is a string pointer and print characters until a null is reached. a Print characters starting at the variable's address until a null is reached.
The last variable may be redisplayed with the command `./'.
variable= Print the address of variable.
variable!value Set the variable to the given value. The value may be a number, character constant or a variable.
The commands for examining source files are
e procedure e filename.c Set the current file to the file containing the named procedure or the named filename. Set the current line to the first line in the named procedure or file. All source files are assumed to be in _d_i_r_e_c_t_o_r_y. The default for _d_i_r_e_c_t_o_r_y is the working directory. If no procedure or file name is given, the current procedure and file names are reported.
/regular expression/ Search forward from the current line for a line con- taining a string matching the regular expression as in ed (1). The trailing `/' may be elided.
?regular expression? Search backward from the current line for a line con- taining a string matching the regular expression as in ed (1). The trailing `?' may be elided.
p Print the current line.
z Print the current line followed by the next 9 lines. Set the current line to the last line printed.
control-D Scroll. Print the next 10 lines. Set the current line to the last line printed.
w Window. Print the 10 lines around the current line.
number Set the current line to the given line number. Print the new current line.
_c_o_u_n_t + Advance the current line by _c_o_u_n_t lines. Print the new current line.
_c_o_u_n_t - Retreat the current line by _c_o_u_n_t lines. Print the new current line.
newline Advance the current line by 1 line. Print the new current line.
The commands for controlling the execution of the source program are
_c_o_u_n_t r _a_r_g_s Run the program with the given arguments. An argument beginning with `<' or `>' causes redirection for the standard input or output respectively. If _c_o_u_n_t is given, it specifies the number of breakpoints to be ignored.
_c_o_u_n_t c Continue after a breakpoint or interrupt. If _c_o_u_n_t is given, it specifies the number of breakpoints to be ignored.
_c_o_u_n_t s Run the program through _c_o_u_n_t lines. _C_o_u_n_t defaults to one if it is omitted.
n Run the program until it reaches the next line.
procedure(arg1,arg2,...) procedure(arg1,arg2,...)/_m Execute the named procedure with the given arguments.
Arguments can be integer, character or string constants or names of variables accessible from the current pro- cedure. The current implementation is limited to 14 arguments and a total length of 448 for string con- stants. The second form causes the value returned by the procedure to be printed according to format _m. If no format is given, it defaults to `d'.
_l_i_n_e_n_u_m_b_e_r b Set a breakpoint at the given line. If a procedure name without a line number is given (e.g. `proc:'), a breakpoint is placed at the first line in the pro- cedure. If no _l_i_n_e_n_u_m_b_e_r is given, a list of the currently active breakpoints is printed.
_l_i_n_e_n_u_m_b_e_r d Delete a breakpoint at the given line. If no _l_i_n_e_n_u_m_b_e_r is given then the breakpoints are deleted interactively: Each breakpoint location is printed and a line is read from the standard input. If the line begins with a `y' or `d' then the breakpoint is deleted.
Miscellaneous commands.
q Exit the debugger.
! _c_o_m_m_a_n_d The command is interpreted by sh (1).
The following commands also exist and are intended only for debugging the debugger.
a Toggle debug output.
x Print a list of procedures and files being debugged.
FILES
a.out core
SEE ALSO
adb(1)
DIAGNOSTICS
Comments about inaccessible files, syntax errors, abnormal termination of commands, etc.
BUGS
Undoubtedly, some features are actually bugs and vice versa.