32V/usr/man/man1/sdb.1

Compare this file to the similar file:
Show the results in this format:

.TH SDB 1 UNIX/32V
.SH NAME
sdb \- C symbolic debugger
.SH SYNOPSIS
.B sdb
[ objfil [ corfil [ directory ] ] ]
.SH DESCRIPTION
.I Sdb
is a symbolic debugger for C programs.
It may be used to examine their files and to provide
a controlled environment for their execution.
.PP
.I Objfil
is an executable C program file
which has been compiled with the -g (debug) option.
The default for
.I objfil
is
.B  a.out.
.I Corfil
is assumed to be a core image file produced after
executing
.IR objfil ;
the default for
.I corfil
is
.B  core.
The core file need not be present.
.PP
It is useful to know that at any time there is a
.I "current line"
and
.I "current file."
If
.I corfil
exists then they are initially set to the line and file
containing the source statement 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.
.PP
Names of variables are written just as they are in C.
Variables 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\(mi>member' and array elements
as `variable[number]'.
Combinations of these forms may also be used.
.PP
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.
.PP
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 procedure or file name is given,
the current file is used by default.
.sp 1
.PP
The commands for examining data in the program are:
.TP 5
.B t
Print a stack trace of the terminated or stopped program.
.TP 5
variable/\fIm\fP
Print the value of variable according to format 
.I m.
If 
.I m
is omitted,
sdb chooses a format suitable for the variable's type
as declared in the C program.
Legal values for
.I m
are
.RS
.TP
.BI c
character
.br
.ns
.TP
.BI h
16 bit integer in decimal
.br
.ns
.TP
.BI d
int size integer in decimal
.br
.ns
.TP
.BI l
32 bit integer in decimal
.br
.ns
.TP
.BI u
int size bit integer in decimal, unsigned
.br
.ns
.TP
.BI o
int size bit integer in octal
.br
.ns
.TP
.BI x
int size bit integer in hexadecimal
.br
.ns
.TP
.BI f
32 bit single precision floating point
.br
.ns
.TP
.BI g
64 bit double precision floating point
.br
.ns
.TP
.BI s
Assume variable is a string pointer and print characters until a null is 
reached.
.br
.ns
.TP
.BI a
Print characters starting at the variable's address until a null
is reached.
.RE
.sp 1
.ti +5
.br
The last variable may be redisplayed with the command `./'.
.TP 5
variable\fB=\fP
Print the address of variable.
.TP 5
variable\fB!\fPvalue
Set the variable to the given value.
The value may be a number, character constant or a variable.
.sp 1
.PP
The commands for examining source files are
.TP 5
\fBe\fP procedure
.br
.ns
.TP 5
\fBe\fP 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
.I directory.
The default for 
.I directory
is the working directory.
If no procedure or file name is given, the current procedure and file names
are reported.
.TP 5
\fB/\fPregular expression\fB/\fP
Search forward from the current line for a line containing
a string matching the regular expression as in ed (1).
The trailing `/' may be elided.
.TP 5
\fB?\fPregular expression\fB?\fP
Search backward from the current line for a line containing
a string matching the regular expression as in ed (1).
The trailing `?' may be elided.
.TP 5
.B p
Print the current line.
.TP 5
.B z
Print the current line followed by the next 9 lines.
Set the current line to the last line printed.
.TP 5
.B control-D
Scroll.
Print the next 10 lines.
Set the current line to the last line printed.
.TP 5
.B w
Window.
Print the 10 lines around the current line.
.TP 5
number
Set the current line to the given line number.
Print the new current line.
.TP 5
\fIcount\fB +\fR
Advance the current line by \fIcount\fP lines.
Print the new current line.
.TP 5
\fIcount\fB \(mi\fR
Retreat the current line by \fIcount\fP lines.
Print the new current line.
.TP 5
.B newline
Advance the current line by 1 line.
Print the new current line.
.sp 1
.PP
The commands for controlling the execution of the source program are
.TP 5
\fIcount\fB r \fIargs\fR
Run the program with the given arguments.
An argument beginning with `<' or `>' causes redirection for the
standard input or output respectively.
If \fIcount\fP is given,
it specifies the number of breakpoints to be ignored.
.TP 5
\fIcount\fB c\fR
Continue after a breakpoint or interrupt.
If \fIcount\fP is given,
it specifies the number of breakpoints to be ignored.
.TP 5
\fIcount\fB s\fR
Run the program through \fIcount\fP lines.
\fICount\fP defaults to one if it is omitted.
.TP 5
.B n
Run the program until it reaches the next line.
.TP 5
procedure\fB(\fParg1,arg2,...\fB)\fP
.br
.ns
.TP 5
procedure\fB(\fParg1,arg2,...\fB)/\fP\fIm\fP
Execute the named procedure with the given arguments.
Arguments can be integer, character or string constants
or names of variables accessible from the current procedure.
The current implementation is limited to 14 arguments and a total
length of 448 for string constants.
The second form causes the value returned by the procedure to be
printed according to format \fIm\fP.
If no format is given, it defaults to `d'.
.TP 5
\fIlinenumber\fB b\fR
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 procedure.
If no \fIlinenumber\fP is given, a list of the currently active
breakpoints is printed.
.TP 5
\fIlinenumber\fB d\fR
Delete a breakpoint at the given line.
If no \fIlinenumber\fP 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.
.sp 1
.PP
Miscellaneous commands.
.TP 5
.B q
Exit the debugger.
.TP 5
\fB! \fIcommand\fR
The command is interpreted by sh (1).
.sp 1
.PP
The following commands also exist and are intended only for
debugging the debugger.
.TP 5
.B a
Toggle debug output.
.TP 5
.B x
Print a list of procedures and files being debugged.
.SH FILES
a.out
.br
core
.SH SEE\ ALSO
adb(1)
.SH DIAGNOSTICS
Comments about inaccessible files, syntax errors,
abnormal termination of commands, etc.
.SH BUGS
Undoubtedly,
some features are actually bugs and vice versa.