xref: /freebsd/sbin/ddb/ddb.8 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1a1f25b0dSRobert Watson.\"-
206934245SRobert Watson.\" Copyright (c) 2007-2008 Robert N. M. Watson
3a1f25b0dSRobert Watson.\" All rights reserved.
4a1f25b0dSRobert Watson.\"
5a1f25b0dSRobert Watson.\" Redistribution and use in source and binary forms, with or without
6a1f25b0dSRobert Watson.\" modification, are permitted provided that the following conditions
7a1f25b0dSRobert Watson.\" are met:
8a1f25b0dSRobert Watson.\" 1. Redistributions of source code must retain the above copyright
9a1f25b0dSRobert Watson.\"    notice, this list of conditions and the following disclaimer.
10a1f25b0dSRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright
11a1f25b0dSRobert Watson.\"    notice, this list of conditions and the following disclaimer in the
12a1f25b0dSRobert Watson.\"    documentation and/or other materials provided with the distribution.
13a1f25b0dSRobert Watson.\"
14a1f25b0dSRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15a1f25b0dSRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16a1f25b0dSRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17a1f25b0dSRobert Watson.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18a1f25b0dSRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19a1f25b0dSRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20a1f25b0dSRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21a1f25b0dSRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22a1f25b0dSRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23a1f25b0dSRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24a1f25b0dSRobert Watson.\" SUCH DAMAGE.
25a1f25b0dSRobert Watson.\"
26138f7e4bSTom Rhodes.Dd December 24, 2008
27a1f25b0dSRobert Watson.Dt DDB 8
28a1f25b0dSRobert Watson.Os
29a1f25b0dSRobert Watson.Sh NAME
30a1f25b0dSRobert Watson.Nm ddb
3185018ba5SRuslan Ermilov.Nd "configure DDB kernel debugger properties"
32a1f25b0dSRobert Watson.Sh SYNOPSIS
33a1f25b0dSRobert Watson.Nm
3406934245SRobert Watson.Cm capture
3506934245SRobert Watson.Op Fl M core
3606934245SRobert Watson.Op Fl N system
3706934245SRobert Watson.Cm print
3806934245SRobert Watson.Nm
3906934245SRobert Watson.Cm capture
4006934245SRobert Watson.Op Fl M core
4106934245SRobert Watson.Op Fl N system
4206934245SRobert Watson.Cm status
4306934245SRobert Watson.Nm
44a1f25b0dSRobert Watson.Cm script
45a1f25b0dSRobert Watson.Ar scriptname
46a1f25b0dSRobert Watson.Nm
47a1f25b0dSRobert Watson.Cm script
4885018ba5SRuslan Ermilov.Ar scriptname Ns = Ns Ar script
49a1f25b0dSRobert Watson.Nm
50a1f25b0dSRobert Watson.Cm scripts
51a1f25b0dSRobert Watson.Nm
52a1f25b0dSRobert Watson.Cm unscript
53a1f25b0dSRobert Watson.Ar scriptname
5414084ab9SBrooks Davis.Nm
5514084ab9SBrooks Davis.Ar pathname
56a1f25b0dSRobert Watson.Sh DESCRIPTION
5785018ba5SRuslan ErmilovThe
58a1f25b0dSRobert Watson.Nm
5985018ba5SRuslan Ermilovutility configures certain aspects of the
6085018ba5SRuslan Ermilov.Xr ddb 4
61a1f25b0dSRobert Watsonkernel debugger from user space that are not configured at compile-time or
62a1f25b0dSRobert Watsoneasily via
63a1f25b0dSRobert Watson.Xr sysctl 8
64a1f25b0dSRobert WatsonMIB entries.
6514084ab9SBrooks Davis.Pp
6614084ab9SBrooks DavisTo ease configuration, commands can be put in a file which is processed using
6714084ab9SBrooks Davis.Nm
6814084ab9SBrooks Davisas shown in the last synopsis line.
6914084ab9SBrooks DavisAn absolute
7014084ab9SBrooks Davis.Ar pathname
7114084ab9SBrooks Davismust be used.
7214084ab9SBrooks DavisThe file will be read line by line and applied as arguments to the
7314084ab9SBrooks Davis.Nm
7414084ab9SBrooks Davisutility.
7514084ab9SBrooks DavisWhitespace at the beginning of lines will be ignored as will lines where the
7685018ba5SRuslan Ermilovfirst non-whitespace character is
7785018ba5SRuslan Ermilov.Ql # .
7806934245SRobert Watson.Sh OUTPUT CAPTURE
7906934245SRobert WatsonThe
8006934245SRobert Watson.Nm
8106934245SRobert Watsonutility can be used to extract the contents of the
8206934245SRobert Watson.Xr ddb 4
8306934245SRobert Watsonoutput capture buffer of the current live kernel, or from the crash dump of a
8406934245SRobert Watsonkernel on disk.
8506934245SRobert WatsonThe following debugger commands are available from the command line:
8606934245SRobert Watson.Bl -tag -width indent
8706934245SRobert Watson.It Xo
88138f7e4bSTom Rhodes.Cm capture
8906934245SRobert Watson.Op Fl M Ar core
9006934245SRobert Watson.Op Fl N Ar system
9106934245SRobert Watson.Cm print
9206934245SRobert Watson.Xc
9306934245SRobert WatsonPrint the current contents of the
9406934245SRobert Watson.Xr ddb 4
9506934245SRobert Watsonoutput capture buffer.
9606934245SRobert Watson.It Xo
97138f7e4bSTom Rhodes.Cm capture
9806934245SRobert Watson.Op Fl M Ar core
9906934245SRobert Watson.Op Fl N Ar system
10006934245SRobert Watson.Cm status
10106934245SRobert Watson.Xc
10206934245SRobert WatsonPrint the current status of the
10306934245SRobert Watson.Xr ddb 4
10406934245SRobert Watsonoutput capture buffer.
105138f7e4bSTom Rhodes.El
106a1f25b0dSRobert Watson.Sh SCRIPTING
10785018ba5SRuslan ErmilovThe
108a1f25b0dSRobert Watson.Nm
10985018ba5SRuslan Ermilovutility can be used to configure aspects of
11085018ba5SRuslan Ermilov.Xr ddb 4
111a1f25b0dSRobert Watsonscripting from user space; scripting support is described in more detail in
11285018ba5SRuslan Ermilov.Xr ddb 4 .
113a1f25b0dSRobert WatsonEach of the debugger commands is available from the command line:
114a1f25b0dSRobert Watson.Bl -tag -width indent
115a1f25b0dSRobert Watson.It Cm script Ar scriptname
116a1f25b0dSRobert WatsonPrint the script named
117a1f25b0dSRobert Watson.Ar scriptname .
11885018ba5SRuslan Ermilov.It Cm script Ar scriptname Ns = Ns Ar script
119a1f25b0dSRobert WatsonDefine a script named
12085018ba5SRuslan Ermilov.Ar scriptname .
12185018ba5SRuslan ErmilovAs many scripts contain characters interpreted in special ways by the shell,
122a1f25b0dSRobert Watsonit is advisable to enclose
12385018ba5SRuslan Ermilov.Ar script
124a1f25b0dSRobert Watsonin quotes.
125a1f25b0dSRobert Watson.It Cm scripts
126a1f25b0dSRobert WatsonList currently defined scripts.
1277fc6a8aeSPawel Jakub Dawidek.It Cm unscript Ar scriptname
128a1f25b0dSRobert WatsonDelete the script named
129a1f25b0dSRobert Watson.Ar scriptname .
130a1f25b0dSRobert Watson.El
13185018ba5SRuslan Ermilov.Sh EXIT STATUS
13285018ba5SRuslan Ermilov.Ex -std
133a1f25b0dSRobert Watson.Sh EXAMPLES
134a1f25b0dSRobert WatsonThe following example defines a script that will execute when the kernel
135a1f25b0dSRobert Watsondebugger is entered as a result of a break signal:
136a1f25b0dSRobert Watson.Bd -literal -offset indent
137a1f25b0dSRobert Watsonddb script kdb.enter.break="show pcpu; bt"
138a1f25b0dSRobert Watson.Ed
139a1f25b0dSRobert Watson.Pp
140a1f25b0dSRobert WatsonThe following example will delete the script:
14185018ba5SRuslan Ermilov.Pp
14285018ba5SRuslan Ermilov.Dl "ddb unscript kdb.enter.break"
1439f583488SRobert Watson.Pp
1449f583488SRobert WatsonFor further examples, see the
1459f583488SRobert Watson.Xr ddb 4
1469f583488SRobert Watsonand
1479f583488SRobert Watson.Xr textdump 4
14885018ba5SRuslan Ermilovmanual pages.
149a1f25b0dSRobert Watson.Sh SEE ALSO
1509f583488SRobert Watson.Xr ddb 4 ,
151*287d467cSMitchell Horne.Xr mac_ddb 4 ,
1529f583488SRobert Watson.Xr textdump 4 ,
153a1f25b0dSRobert Watson.Xr sysctl 8
154a1f25b0dSRobert Watson.Sh HISTORY
15585018ba5SRuslan ErmilovThe
156a1f25b0dSRobert Watson.Nm
15785018ba5SRuslan Ermilovutility first appeared in
1581492a260SRobert Watson.Fx 7.1 .
159a1f25b0dSRobert Watson.Sh AUTHORS
160a1f25b0dSRobert Watson.An Robert N M Watson
161a1f25b0dSRobert Watson.Sh BUGS
162a1f25b0dSRobert WatsonIdeally,
163a1f25b0dSRobert Watson.Nm
164a1f25b0dSRobert Watsonwould not exist, as all pertinent aspects of
1659f583488SRobert Watson.Xr ddb 4
166a1f25b0dSRobert Watsoncould be configured directly via
167a1f25b0dSRobert Watson.Xr sysctl 8 .
168