xref: /freebsd/share/man/man4/textdump.4 (revision 4543ef516683042d46f3bd3bb8a4f3f746e00499)
1.\"
2.\" Copyright (c) 2007 Robert N. M. Watson
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice(s), this list of conditions and the following disclaimer as
10.\"    the first lines of this file unmodified other than the possible
11.\"    addition of one or more copyright notices.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice(s), this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
17.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26.\" DAMAGE.
27.\"
28.Dd October 18, 2019
29.Dt TEXTDUMP 4
30.Os
31.Sh NAME
32.Nm textdump
33.Nd textdump kernel dumping facility
34.Sh SYNOPSIS
35.Cd options DDB
36.Cd options KDB
37.Pp
38.Cd options TEXTDUMP_PREFERRED
39.Cd options TEXTDUMP_VERBOSE
40.Sh DESCRIPTION
41The
42.Nm
43facility allows the capture of kernel debugging information to disk in a
44human-readable rather than the machine-readable form normally used with
45kernel memory dumps and minidumps.
46This representation, while less complete in that it does not capture full
47kernel state, can provide debugging information in a more compact, portable,
48and persistent form than a traditional dump.
49By combining
50.Nm
51with other
52.Xr ddb 4
53facilities, such as scripting and output capture, detailed bug information
54can be captured in a fully automated manner.
55.Sh FORMAT
56.Nm
57data is stored in a dump partition in the same style as a regular memory
58dump, and will be automatically extracted by
59.Xr savecore 8
60if present on boot.
61.Pp
62.Nm
63files are stored in the
64.Xr tar 5
65format, and consist of one or more text files, each storing a particular type
66of debugging output.
67The following parts may be present:
68.Bl -tag -width version.txt
69.It Pa ddb.txt
70Captured
71.Xr ddb 4
72output, if the capture facility has been used.
73May be disabled by clearing the
74.Va debug.ddb.textdump.do_ddb
75sysctl.
76.It Pa config.txt
77Kernel configuration, if
78.Cd options INCLUDE_CONFIG_FILE
79has been compiled into the kernel.
80May be disabled by clearing the
81.Va debug.ddb.textdump.do_config
82sysctl.
83.It Pa msgbuf.txt
84Kernel message buffer, including recent console output if the capture
85facility has been used.
86May be disabled by clearing the
87.Va debug.ddb.textdump.do_msgbuf
88sysctl.
89.It Pa panic.txt
90Kernel panic string, if the kernel panicked before the dump was generated.
91May be disabled by clearing the
92.Va debug.ddb.textdump.do_panic
93sysctl.
94.It Pa version.txt
95Kernel version string.
96My be disabled by clearing the
97.Va debug.ddb.textdump.do_version
98sysctl.
99.El
100.Pp
101Kernel textdumps may be extracted using
102.Xr tar 1 .
103.Sh CONFIGURATION
104The
105.Nm
106facility is enabled as part of the kernel debugger using
107.Cd options KDB
108and
109.Cd options DDB .
110By default, kernel dumps generated on panic or via explicit requests for a
111dump will be regular memory dumps; however, by using the
112.Ic textdump set
113command in
114.Xr ddb 4 ,
115or by setting the
116.Va debug.ddb.textdump.pending
117sysctl to 1 using
118.Xr sysctl 8 ,
119it is possible to request that the next dump be a textdump.
120One may also directly trigger a textdump in
121.Xr ddb 4
122by running the command
123.Ic textdump dump .
124.Pp
125If at the
126.Xr ddb 4
127command line, the commands
128.Ic textdump set ,
129.Ic textdump status ,
130and
131.Ic textdump unset
132may be used to set, query, and clear the textdump pending flag.
133.Pp
134As with regular kernel dumps, a dump partition must be automatically or
135manually configured using
136.Xr dumpon 8 .
137.Pp
138Additional kernel
139.Xr config 8
140options:
141.Bl -tag -width TEXTDUMP_PREFERRED
142.It Cd TEXTDUMP_PREFERRED
143sets textdumps to be the default manner of doing dumps.
144This means there will be no need to
145.Xr sysctl 8
146or use the
147.Ic textdump set
148.Xr ddb 8
149commands.
150.It Cd TEXTDUMP_VERBOSE
151will have the textdump facility be more verbose about each file it is emitting
152as well as other diagnostics useful to debug the textdump facility itself.
153.El
154.Sh EXAMPLES
155In the following example, the script
156.Va kdb.enter.panic
157will run when the kernel debugger is entered as a result of a panic, enable
158output capture, dump several useful pieces of debugging information, and then
159invoke panic in order to force a kernel dump to be written out followed by a
160reboot:
161.Bd -literal -offset indent
162script kdb.enter.panic=textdump set; capture on; show allpcpu; bt;
163  ps; alltrace; show alllocks; textdump dump; reset
164.Ed
165.Pp
166In the following example, the script
167.Va kdb.enter.witness
168will run when the kernel debugger is entered as a result of a witness
169violation, printing lock-related information for the user:
170.Bd -literal -offset indent
171script kdb.enter.witness=show locks
172.Ed
173.Pp
174These scripts may also be configured using the
175.Xr ddb 8
176utility.
177.Sh SEE ALSO
178.Xr tar 1 ,
179.Xr ddb 4 ,
180.Xr tar 5 ,
181.Xr ddb 8 ,
182.Xr dumpon 8 ,
183.Xr savecore 8 ,
184.Xr sysctl 8
185.Sh HISTORY
186The
187.Nm
188facility first appeared in
189.Fx 7.1 .
190.Sh AUTHORS
191The
192.Nm
193facility was created by
194.An Robert N. M. Watson .
195