Fix markup.

This commit is contained in:
Ruslan Ermilov 2006-10-09 15:21:50 +00:00
parent e3643455a3
commit e230c2c3ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163161

View File

@ -58,6 +58,7 @@
.\" [90/08/30 dbg]
.\"
.\" $FreeBSD$
.\"
.Dd October 9, 2006
.Dt DDB 4
.Os
@ -74,7 +75,8 @@ To prevent activation of the debugger on kernel
.Sh DESCRIPTION
The
.Nm
kernel debugger has most of the features of the old kdb,
kernel debugger has most of the features of the old
.Nm kdb ,
but with a more rational syntax
inspired by
.Xr gdb 1 .
@ -94,27 +96,47 @@ unless the
.Dv KDB_UNATTENDED
option is specified.
.Pp
The current location is called `dot'.
The `dot' is displayed with
The current location is called
.Va dot .
The
.Va dot
is displayed with
a hexadecimal format at a prompt.
Examine and write commands update `dot' to the address of the last line
examined or the last location modified, and set `next' to the address of
The commands
.Ic examine
and
.Ic write
update
.Va dot
to the address of the last line
examined or the last location modified, and set
.Va next
to the address of
the next location to be examined or changed.
Other commands do not change `dot', and set `next' to be the same as `dot'.
Other commands do not change
.Va dot ,
and set
.Va next
to be the same as
.Va dot .
.Pp
The general command syntax is:
.Cm command Ns Op Li \&/ Ns Ar modifier
.Ar command Ns Op Li / Ns Ar modifier
.Ar address Ns Op Li , Ns Ar count
.Pp
A blank line repeats the previous command from the address `next' with
A blank line repeats the previous command from the address
.Va next
with
count 1 and no modifiers.
Specifying
.Ar address
sets `dot' to the
address.
sets
.Va dot
to the address.
Omitting
.Ar address
uses `dot'.
uses
.Va dot .
A missing
.Ar count
is taken
@ -122,14 +144,14 @@ to be 1 for printing commands or infinity for stack traces.
.Pp
The
.Nm
debugger has a feature like the
debugger has a pager feature (like the
.Xr more 1
command
command)
for the output.
If an output line exceeds the number set in the
.Li \&$lines
.Va lines
variable, it displays
.Dq Em --db_more--
.Dq Li --db_more--
and waits for a response.
The valid responses for it are:
.Pp
@ -145,56 +167,63 @@ abort the current command, and return to the command input mode
Finally,
.Nm
provides a small (currently 10 items) command history, and offers
simple emacs-style command line editing capabilities.
simple
.Nm emacs Ns -style
command line editing capabilities.
In addition to
the emacs control keys, the usual ANSI arrow keys might be used to
the
.Nm emacs
control keys, the usual
.Tn ANSI
arrow keys might be used to
browse through the history buffer, and move the cursor within the
current line.
.Sh COMMANDS
.Bl -tag -width indent -compact
.It Cm examine
.It Cm x
.It Ic examine
.It Ic x
Display the addressed locations according to the formats in the modifier.
Multiple modifier formats display multiple locations.
If no format is specified, the last formats specified for this command
If no format is specified, the last format specified for this command
is used.
.Pp
The format characters are:
.Bl -tag -compact -width indent
.It Li b
.It Cm b
look at by bytes (8 bits)
.It Li h
.It Cm h
look at by half words (16 bits)
.It Li l
.It Cm l
look at by long words (32 bits)
.It Li a
.It Cm a
print the location being displayed
.It Li A
.It Cm A
print the location with a line number if possible
.It Li x
.It Cm x
display in unsigned hex
.It Li z
.It Cm z
display in signed hex
.It Li o
.It Cm o
display in unsigned octal
.It Li d
.It Cm d
display in signed decimal
.It Li u
.It Cm u
display in unsigned decimal
.It Li r
.It Cm r
display in current radix, signed
.It Li c
.It Cm c
display low 8 bits as a character.
Non-printing characters are displayed as an octal escape code (e.g., `\e000').
.It Li s
Non-printing characters are displayed as an octal escape code (e.g.,
.Ql \e000 ) .
.It Cm s
display the null-terminated string at the location.
Non-printing characters are displayed as octal escapes.
.It Li m
.It Cm m
display in unsigned hex with character dump at the end of each line.
The location is also displayed in hex at the beginning of each line.
.It Li i
.It Cm i
display as an instruction
.It Li I
.It Cm I
display as an instruction with possible alternate formats depending on the
machine:
.Bl -tag -width ".Tn powerpc" -compact
@ -213,39 +242,38 @@ No alternate format.
.El
.El
.Pp
.It Cm xf
.It Ic xf
Examine forward:
Execute an examine command with the last specified parameters to it
execute an
.Ic examine
command with the last specified parameters to it
except that the next address displayed by it is used as the start address.
.Pp
.It Cm xb
.It Ic xb
Examine backward:
Execute an examine command with the last specified parameters to it
execute an
.Ic examine
command with the last specified parameters to it
except that the last start address subtracted by the size displayed by it
is used as the start address.
.Pp
.It Cm print Ns Op Cm /acdoruxz
.It Cm p Ns Op Cm /acdoruxz
.It Ic print Ns Op Li / Ns Cm acdoruxz
.It Ic p Ns Op Li / Ns Cm acdoruxz
Print
.Ar addr Ns s
according to the modifier character (as described above for
.Li examine ) .
.Cm examine ) .
Valid formats are:
.Li a ,
.Li x ,
.Li z ,
.Li o ,
.Li d ,
.Li u ,
.Li r ,
.Cm a , x , z , o , d , u , r ,
and
.Li c .
.Cm c .
If no modifier is specified, the last one specified to it is used.
The argument
.Ar addr
can be a string, in which case it is printed as it is.
For example:
.Bd -literal -offset indent
print/x \&"eax = \&" $eax \&"\enecx = \&" $ecx \&"\en\&"
print/x "eax = " $eax "\enecx = " $ecx "\en"
.Ed
.Pp
will print like:
@ -255,23 +283,23 @@ ecx = yyyyyy
.Ed
.Pp
.It Xo
.Cm write Ns Op Cm /bhl
.Ar addr Ar expr1 Op Ar "expr2 ..."
.Ic write Ns Op Li / Ns Cm bhl
.Ar addr expr1 Op Ar expr2 ...
.Xc
.It Xo
.Cm w Ns Op Cm /bhl
.Ar addr Ar expr1 Op Ar "expr2 ..."
.Ic w Ns Op Li / Ns Cm bhl
.Ar addr expr1 Op Ar expr2 ...
.Xc
Write the expressions specified after
.Ar addr
on the command line at succeeding locations starting with
.Ar addr
.Ar addr .
The write unit size can be specified in the modifier with a letter
.Li b
.Cm b
(byte),
.Li h
.Cm h
(half word) or
.Li l
.Cm l
(long word) respectively.
If omitted,
long word is assumed.
@ -281,38 +309,33 @@ since there is no delimiter between expressions, strange
things may happen.
It is best to enclose each expression in parentheses.
.Pp
.It Xo
.Cm set
.Li \&$ Ns Ar variable
.Op Li =
.Ar expr
.Xc
.It Ic set Li $ Ns Ar variable Oo Li = Oc Ar expr
Set the named variable or register with the value of
.Ar expr .
Valid variable names are described below.
.Pp
.It Cm break Ns Op Cm /u
.It Cm b Ns Op Cm /u
.It Ic break Ns Op Li / Ns Cm u
.It Ic b Ns Op Li / Ns Cm u
Set a break point at
.Ar addr .
If
.Ar count
is supplied, continues
.Ar count
- 1 times before stopping at the
\- 1 times before stopping at the
break point.
If the break point is set, a break point number is
printed with
.Sq Li \&# .
.Ql # .
This number can be used in deleting the break point
or adding conditions to it.
.Pp
If the
.Li u
.Cm u
modifier is specified, this command sets a break point in user space
address.
Without the
.Li u
.Cm u
option, the address is considered in the kernel
space, and wrong space address is rejected with an error message.
This modifier can be used only if it is supported by machine dependent
@ -324,27 +347,27 @@ user space break points may not work correctly.
Setting a break
point at the low-level code paths may also cause strange behavior.
.Pp
.It Cm delete Ar addr
.It Cm d Ar addr
.It Cm delete Li \&# Ns Ar number
.It Cm d Li \&# Ns Ar number
.It Ic delete Ar addr
.It Ic d Ar addr
.It Ic delete Li # Ns Ar number
.It Ic d Li # Ns Ar number
Delete the break point.
The target break point can be specified by a
break point number with
.Li # ,
.Ql # ,
or by using the same
.Ar addr
specified in the original
.Cm break
.Ic break
command.
.Pp
.It Cm step Ns Op Cm /p
.It Cm s Ns Op Cm /p
.It Ic step Ns Op Li / Ns Cm p
.It Ic s Ns Op Li / Ns Cm p
Single step
.Ar count
times (the comma is a mandatory part of the syntax).
If the
.Li p
.Cm p
modifier is specified, print each instruction at each step.
Otherwise, only print the last instruction.
.Pp
@ -355,11 +378,11 @@ On machines with software-emulated single-stepping (e.g., pmax),
stepping through code executed by interrupt handlers will probably
do the wrong thing.
.Pp
.It Cm continue Ns Op Cm /c
.It Cm c Ns Op Cm /c
.It Ic continue Ns Op Li / Ns Cm c
.It Ic c Ns Op Li / Ns Cm c
Continue execution until a breakpoint or watchpoint.
If the
.Li c
.Cm c
modifier is specified, count instructions while executing.
Some machines (e.g., pmax) also count loads and stores.
.Pp
@ -368,51 +391,52 @@ when counting, the debugger is really silently single-stepping.
This means that single-stepping on low-level code may cause strange
behavior.
.Pp
.It Cm until Ns Op Cm /p
.It Ic until Ns Op Li / Ns Cm p
Stop at the next call or return instruction.
If the
.Li p
.Cm p
modifier is specified, print the call nesting depth and the
cumulative instruction count at each call or return.
Otherwise,
only print when the matching return is hit.
.Pp
.It Cm next Ns Op Cm /p
.It Cm match Ns Op Cm /p
.It Ic next Ns Op Li / Ns Cm p
.It Ic match Ns Op Li / Ns Cm p
Stop at the matching return instruction.
If the
.Li p
.Cm p
modifier is specified, print the call nesting depth and the
cumulative instruction count at each call or return.
Otherwise, only print when the matching return is hit.
.Pp
.It Xo
.Cm trace Ns Op Cm /u
.Ic trace Ns Op Li / Ns Cm u
.Op Ar frame
.Op , Ns Ar count
.Op Li , Ns Ar count
.Xc
.It Xo
.Cm t Ns Op Cm /u
.Ic t Ns Op Li / Ns Cm u
.Op Ar frame
.Op , Ns Ar count
.Op Li , Ns Ar count
.Xc
.It Xo
.Cm where Ns Op Cm /u
.Ic where Ns Op Li / Ns Cm u
.Op Ar frame
.Op , Ns Ar count
.Op Li , Ns Ar count
.Xc
.It Xo
.Cm bt Ns Op Cm /u
.Ic bt Ns Op Li / Ns Cm u
.Op Ar frame
.Op , Ns Ar count
.Op Li , Ns Ar count
.Xc
Stack trace.
The
.Li u
.Cm u
option traces user space; if omitted,
.Cm trace
.Ic trace
only traces
kernel space.
The optional argument
.Ar count
is the number of frames to be traced.
If
@ -424,53 +448,55 @@ User space stack trace is valid
only if the machine dependent code supports it.
.Pp
.It Xo
.Cm search Ns Op Cm /bhl
.Ic search Ns Op Li / Ns Cm bhl
.Ar addr
.Ar value
.Op Ar mask
.Op , Ns Ar count
.Op Li , Ns Ar count
.Xc
Search memory for
.Ar value .
This command might fail in interesting
ways if it does not find the searched-for value.
This is because ddb does not always recover from touching bad memory.
This is because
.Nm
does not always recover from touching bad memory.
The optional
.Ar count
argument limits the search.
.Pp
.It Cm show all procs Ns Op Cm /m
.It Cm ps Ns Op Cm /m
.It Ic show Cm all procs Ns Op Li / Ns Cm m
.It Ic ps Ns Op Li / Ns Cm m
Display all process information.
The process information may not be shown if it is not
supported in the machine, or the bottom of the stack of the
target process is not in the main memory at that time.
The
.Li m
.Cm m
modifier will alter the display to show VM map
addresses for the process and not show other info.
.Pp
.It Cm show registers Ns Op Cm /u
.It Cm registers Ns Op Cm /u
.It Ic show Cm registers Ns Op Li / Ns Cm u
.It Ic registers Ns Op Li / Ns Cm u
Display the register set.
If the
.Li u
option is specified, it displays user registers instead of
.Cm u
modifier is specified, it displays user registers instead of
kernel or currently saved one.
.Pp
.Sy Warning :
The support of the
.Li u
.Cm u
modifier depends on the machine.
If not supported, incorrect information will be displayed.
.Pp
The
.Cm registers
.Ic registers
alias is a hack to prevent mistyping
.Ql r
from resetting the system.
.Pp
.It Cm show geom Op Ar addr
.It Ic show Cm geom Op Ar addr
If the
.Ar addr
argument is not given, displays the entire GEOM topology.
@ -479,41 +505,32 @@ If the
is given, displays details about the given GEOM object (class, geom, provider
or consumer).
.Pp
.It Xo
.Cm show map Ns Op Cm /f
.Ar addr
.Xc
.It Ic show Cm map Ns Oo Li / Ns Cm f Oc Ar addr
Prints the VM map at
.Ar addr .
If the
.Li f
.Cm f
modifier is specified the
complete map is printed.
.Pp
.It Xo
.Cm show object Ns Op Cm /f
.Ar addr
.Xc
.It Ic show Cm object Ns Oo Li / Ns Cm f Oc Ar addr
Prints the VM object at
.Ar addr .
If the
.Li f
.Cm f
option is specified the
complete object is printed.
.Pp
.It Cm show vnode Ar addr
.It Ic show Cm vnode Ar addr
Displays details about the given vnode.
.Pp
.It Cm "show watches"
.It Ic show Cm watches
Displays all watchpoints.
.Pp
.It Cm reset
.It Ic reset
Hard reset the system.
.Pp
.It Xo
.Cm watch
.Ar addr Ns Li \&, Ns Ar size
.Xc
.It Ic watch Ar addr Ns Li , Ns Ar size
Set a watchpoint for a region.
Execution stops when an attempt to modify the region occurs.
The
@ -527,10 +544,7 @@ Attempts to watch wired kernel memory
may cause unrecoverable error in some systems such as i386.
Watchpoints on user addresses work best.
.Pp
.It Xo
.Cm hwatch
.Ar addr Ns Li \&, Ns Ar size
.Xc
.It Ic hwatch Ar addr Ns Li , Ns Ar size
Set a hardware watchpoint for a region if supported by the
architecture.
Execution stops when an attempt to modify the region occurs.
@ -542,121 +556,126 @@ argument defaults to 4.
The hardware debug facilities do not have a concept of separate
address spaces like the watch command does.
Use
.Cm hwatch
.Ic hwatch
for setting watchpoints on kernel address locations only, and avoid
its use on user mode address spaces.
.Pp
.It Xo
.Cm dhwatch
.Ar addr Ns Li \&, Ns Ar size
.Xc
.It Ic dhwatch Ar addr Ns Li , Ns Ar size
Delete specified hardware watchpoint.
.Pp
.It Cm gdb
.It Ic gdb
Toggles between remote GDB and DDB mode.
In remote GDB mode, another machine is required that runs
.Xr gdb 1
using the remote debug feature, with a connection to the serial
console port on the target machine.
Currently only available on the
.Em i386
i386
architecture.
.Pp
.It Cm help
.It Ic help
Print a short summary of the available commands and command
abbreviations.
.El
.Sh VARIABLES
The debugger accesses registers and variables as
.Li \&$ Ns Em name .
.Li $ Ns Ar name .
Register names are as in the
.Dq Cm show registers
.Dq Ic show Cm registers
command.
Some variables are suffixed with numbers, and may have some modifier
following a colon immediately after the variable name.
For example, register variables can have a
.Li u
.Cm u
modifier to indicate user register (e.g.,
.Li $eax:u ) .
.Dq Li $eax:u ) .
.Pp
Built-in variables currently supported are:
.Bl -tag -width ".Li tabstops" -compact
.It Li radix
Input and output radix
.It Li maxoff
Addresses are printed as 'symbol'+offset unless offset is greater than maxoff.
.It Li maxwidth
.Pp
.Bl -tag -width ".Va tabstops" -compact
.It Va radix
Input and output radix.
.It Va maxoff
Addresses are printed as
.Dq Ar symbol Ns Li + Ns Ar offset
unless
.Ar offset
is greater than
.Va maxoff .
.It Va maxwidth
The width of the displayed line.
.It Li lines
.It Va lines
The number of lines.
It is used by
.Dq more
feature.
.It Li tabstops
It is used by the built-in pager.
.It Va tabstops
Tab stop width.
.It Li work Ns Ar xx
Work variable.
.It Va work Ns Ar xx
Work variable;
.Ar xx
can be 0 to 31.
can take values from 0 to 31.
.El
.Sh EXPRESSIONS
Almost all expression operators in C are supported except
.Sq Li \&~ ,
.Sq Li \&^ ,
Most expression operators in C are supported except
.Ql ~ ,
.Ql ^ ,
and unary
.Sq Li \&& .
.Ql & .
Special rules in
.Nm
are:
.Bl -tag -width ".Em Identifiers"
.It Em Identifiers
.Bl -tag -width ".No Identifiers"
.It Identifiers
The name of a symbol is translated to the value of the symbol, which
is the address of the corresponding object.
.Sq Li \&.
.Ql \&.
and
.Sq Li \&:
.Ql \&:
can be used in the identifier.
If supported by an object format dependent routine,
.Sm off
.Oo Em filename : Oc Em func : lineno ,
.Oo Ar filename : Oc Ar func : lineno ,
.Sm on
.Oo Em filename : Oc Ns Em variable ,
.Oo Ar filename : Oc Ns Ar variable ,
and
.Oo Em filename : Oc Ns Em lineno
.Oo Ar filename : Oc Ns Ar lineno
can be accepted as a symbol.
.It Em Numbers
.It Numbers
Radix is determined by the first two letters:
.Li 0x :
.Ql 0x :
hex,
.Li 0o :
.Ql 0o :
octal,
.Li 0t :
.Ql 0t :
decimal; otherwise, follow current radix.
.It Li \&.
`dot'
.It Li \&+
`next'
.It Li \&..
.Va dot
.It Li +
.Va next
.It Li ..
address of the start of the last line examined.
Unlike `dot' or `next', this is only changed by
.Dq Li examine
Unlike
.Va dot
or
.Dq Li write
.Va next ,
this is only changed by
.Ic examine
or
.Ic write
command.
.It Li \&'
.It Li '
last address explicitly specified.
.It Li \&$ Ns Em variable
.It Li $ Ns Ar variable
Translated to the value of the specified variable.
It may be followed by a
.Li :
.Ql \&:
and modifiers as described above.
.It Em a Ns Li \&# Ns Em b
a binary operator which rounds up the left hand side to the next
.It Ar a Ns Li # Ns Ar b
A binary operator which rounds up the left hand side to the next
multiple of right hand side.
.It Li \&* Ns Em expr
indirection.
.It Li * Ns Ar expr
Indirection.
It may be followed by a
.Sq Li :
.Ql \&:
and modifiers as described above.
.El
.Sh HINTS
@ -679,5 +698,6 @@ The
debugger was developed for Mach, and ported to
.Bx 386 0.1 .
This manual page translated from
.Fl man
macros by Garrett Wollman.
.Xr man 7
macros by
.An Garrett Wollman .