10ff94fb6SRobert Watson.\" 20ff94fb6SRobert Watson.\" Copyright (c) 2007 Robert N. M. Watson 30ff94fb6SRobert Watson.\" All rights reserved. 40ff94fb6SRobert Watson.\" 50ff94fb6SRobert Watson.\" Redistribution and use in source and binary forms, with or without 60ff94fb6SRobert Watson.\" modification, are permitted provided that the following conditions 70ff94fb6SRobert Watson.\" are met: 80ff94fb6SRobert Watson.\" 1. Redistributions of source code must retain the above copyright 90ff94fb6SRobert Watson.\" notice(s), this list of conditions and the following disclaimer as 100ff94fb6SRobert Watson.\" the first lines of this file unmodified other than the possible 110ff94fb6SRobert Watson.\" addition of one or more copyright notices. 120ff94fb6SRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright 130ff94fb6SRobert Watson.\" notice(s), this list of conditions and the following disclaimer in the 140ff94fb6SRobert Watson.\" documentation and/or other materials provided with the distribution. 150ff94fb6SRobert Watson.\" 160ff94fb6SRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 170ff94fb6SRobert Watson.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 180ff94fb6SRobert Watson.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 190ff94fb6SRobert Watson.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 200ff94fb6SRobert Watson.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 210ff94fb6SRobert Watson.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 220ff94fb6SRobert Watson.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 230ff94fb6SRobert Watson.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 240ff94fb6SRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 250ff94fb6SRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 260ff94fb6SRobert Watson.\" DAMAGE. 270ff94fb6SRobert Watson.\" 28*47adb0e0SAndriy Gapon.Dd October 18, 2019 29134d45e8SUlrich Spörlein.Dt TEXTDUMP 4 300ff94fb6SRobert Watson.Os 310ff94fb6SRobert Watson.Sh NAME 320ff94fb6SRobert Watson.Nm textdump 330ff94fb6SRobert Watson.Nd textdump kernel dumping facility 340ff94fb6SRobert Watson.Sh SYNOPSIS 350ff94fb6SRobert Watson.Cd options DDB 36e9d6ba92SJoel Dahl.Cd options KDB 37956cbd11SAlfred Perlstein.Pp 3821d748a9SAlfred Perlstein.Cd options TEXTDUMP_PREFERRED 39e9d6ba92SJoel Dahl.Cd options TEXTDUMP_VERBOSE 400ff94fb6SRobert Watson.Sh DESCRIPTION 410ff94fb6SRobert WatsonThe 420ff94fb6SRobert Watson.Nm 430ff94fb6SRobert Watsonfacility allows the capture of kernel debugging information to disk in a 440ff94fb6SRobert Watsonhuman-readable rather than the machine-readable form normally used with 450ff94fb6SRobert Watsonkernel memory dumps and minidumps. 460ff94fb6SRobert WatsonThis representation, while less complete in that it does not capture full 470ff94fb6SRobert Watsonkernel state, can provide debugging information in a more compact, portable, 480ff94fb6SRobert Watsonand persistent form than a traditional dump. 490ff94fb6SRobert WatsonBy combining 500ff94fb6SRobert Watson.Nm 510ff94fb6SRobert Watsonwith other 52070356d1SRobert Watson.Xr ddb 4 530ff94fb6SRobert Watsonfacilities, such as scripting and output capture, detailed bug information 540ff94fb6SRobert Watsoncan be captured in a fully automated manner. 550ff94fb6SRobert Watson.Sh FORMAT 560ff94fb6SRobert Watson.Nm 570ff94fb6SRobert Watsondata is stored in a dump partition in the same style as a regular memory 580ff94fb6SRobert Watsondump, and will be automatically extracted by 590ff94fb6SRobert Watson.Xr savecore 8 600ff94fb6SRobert Watsonif present on boot. 610ff94fb6SRobert Watson.Pp 620ff94fb6SRobert Watson.Nm 630ff94fb6SRobert Watsonfiles are stored in the 640ff94fb6SRobert Watson.Xr tar 5 650ff94fb6SRobert Watsonformat, and consist of one or more text files, each storing a particular type 660ff94fb6SRobert Watsonof debugging output. 670ff94fb6SRobert WatsonThe following parts may be present: 680ff94fb6SRobert Watson.Bl -tag -width version.txt 690ff94fb6SRobert Watson.It Pa ddb.txt 700ff94fb6SRobert WatsonCaptured 71070356d1SRobert Watson.Xr ddb 4 720ff94fb6SRobert Watsonoutput, if the capture facility has been used. 730ff94fb6SRobert WatsonMay be disabled by clearing the 74fd2f7a7fSEdward Tomasz Napierala.Va debug.ddb.textdump.do_ddb 750ff94fb6SRobert Watsonsysctl. 760ff94fb6SRobert Watson.It Pa config.txt 770ff94fb6SRobert WatsonKernel configuration, if 7863d46d1dSUlrich Spörlein.Cd options INCLUDE_CONFIG_FILE 790ff94fb6SRobert Watsonhas been compiled into the kernel. 800ff94fb6SRobert WatsonMay be disabled by clearing the 81fd2f7a7fSEdward Tomasz Napierala.Va debug.ddb.textdump.do_config 820ff94fb6SRobert Watsonsysctl. 830ff94fb6SRobert Watson.It Pa msgbuf.txt 840ff94fb6SRobert WatsonKernel message buffer, including recent console output if the capture 850ff94fb6SRobert Watsonfacility has been used. 860ff94fb6SRobert WatsonMay be disabled by clearing the 87fd2f7a7fSEdward Tomasz Napierala.Va debug.ddb.textdump.do_msgbuf 880ff94fb6SRobert Watsonsysctl. 890ff94fb6SRobert Watson.It Pa panic.txt 900ff94fb6SRobert WatsonKernel panic string, if the kernel panicked before the dump was generated. 910ff94fb6SRobert WatsonMay be disabled by clearing the 92fd2f7a7fSEdward Tomasz Napierala.Va debug.ddb.textdump.do_panic 930ff94fb6SRobert Watsonsysctl. 940ff94fb6SRobert Watson.It Pa version.txt 950ff94fb6SRobert WatsonKernel version string. 960ff94fb6SRobert WatsonMy be disabled by clearing the 97fd2f7a7fSEdward Tomasz Napierala.Va debug.ddb.textdump.do_version 980ff94fb6SRobert Watsonsysctl. 990ff94fb6SRobert Watson.El 1000ff94fb6SRobert Watson.Pp 1010ff94fb6SRobert WatsonKernel textdumps may be extracted using 1027970a637STim Kientzle.Xr tar 1 . 1030ff94fb6SRobert Watson.Sh CONFIGURATION 1040ff94fb6SRobert WatsonThe 1050ff94fb6SRobert Watson.Nm 1060ff94fb6SRobert Watsonfacility is enabled as part of the kernel debugger using 1070ff94fb6SRobert Watson.Cd options KDB 1080ff94fb6SRobert Watsonand 1090ff94fb6SRobert Watson.Cd options DDB . 1100ff94fb6SRobert WatsonBy default, kernel dumps generated on panic or via explicit requests for a 1110ff94fb6SRobert Watsondump will be regular memory dumps; however, by using the 1120ff94fb6SRobert Watson.Ic textdump set 1130ff94fb6SRobert Watsoncommand in 114070356d1SRobert Watson.Xr ddb 4 , 1150ff94fb6SRobert Watsonor by setting the 116fd2f7a7fSEdward Tomasz Napierala.Va debug.ddb.textdump.pending 1170ff94fb6SRobert Watsonsysctl to 1 using 1180ff94fb6SRobert Watson.Xr sysctl 8 , 119e9d6ba92SJoel Dahlit is possible to request that the next dump be a textdump. 120e9d6ba92SJoel DahlOne may also directly trigger a textdump in 12121d748a9SAlfred Perlstein.Xr ddb 4 12221d748a9SAlfred Perlsteinby running the command 12321d748a9SAlfred Perlstein.Ic textdump dump . 1240ff94fb6SRobert Watson.Pp 1250ff94fb6SRobert WatsonIf at the 126070356d1SRobert Watson.Xr ddb 4 1270ff94fb6SRobert Watsoncommand line, the commands 1280ff94fb6SRobert Watson.Ic textdump set , 1290ff94fb6SRobert Watson.Ic textdump status , 1300ff94fb6SRobert Watsonand 1310ff94fb6SRobert Watson.Ic textdump unset 1320ff94fb6SRobert Watsonmay be used to set, query, and clear the textdump pending flag. 1330ff94fb6SRobert Watson.Pp 1340ff94fb6SRobert WatsonAs with regular kernel dumps, a dump partition must be automatically or 1350ff94fb6SRobert Watsonmanually configured using 1360ff94fb6SRobert Watson.Xr dumpon 8 . 13721d748a9SAlfred Perlstein.Pp 13821d748a9SAlfred PerlsteinAdditional kernel 13921d748a9SAlfred Perlstein.Xr config 8 14021d748a9SAlfred Perlsteinoptions: 14121d748a9SAlfred Perlstein.Bl -tag -width TEXTDUMP_PREFERRED 14221d748a9SAlfred Perlstein.It Cd TEXTDUMP_PREFERRED 143e9d6ba92SJoel Dahlsets textdumps to be the default manner of doing dumps. 144e9d6ba92SJoel DahlThis means there will be no need to 14521d748a9SAlfred Perlstein.Xr sysctl 8 14621d748a9SAlfred Perlsteinor use the 14747df4db7SJoel Dahl.Ic textdump set 14821d748a9SAlfred Perlstein.Xr ddb 8 14921d748a9SAlfred Perlsteincommands. 15021d748a9SAlfred Perlstein.It Cd TEXTDUMP_VERBOSE 15121d748a9SAlfred Perlsteinwill have the textdump facility be more verbose about each file it is emitting 15221d748a9SAlfred Perlsteinas well as other diagnostics useful to debug the textdump facility itself. 15321d748a9SAlfred Perlstein.El 1540ff94fb6SRobert Watson.Sh EXAMPLES 1550ff94fb6SRobert WatsonIn the following example, the script 156fd2f7a7fSEdward Tomasz Napierala.Va kdb.enter.panic 1570ff94fb6SRobert Watsonwill run when the kernel debugger is entered as a result of a panic, enable 1580ff94fb6SRobert Watsonoutput capture, dump several useful pieces of debugging information, and then 1590ff94fb6SRobert Watsoninvoke panic in order to force a kernel dump to be written out followed by a 1600ff94fb6SRobert Watsonreboot: 1610ff94fb6SRobert Watson.Bd -literal -offset indent 162f5ccc067SRobert Watsonscript kdb.enter.panic=textdump set; capture on; show allpcpu; bt; 163*47adb0e0SAndriy Gapon ps; alltrace; show alllocks; textdump dump; reset 1640ff94fb6SRobert Watson.Ed 1650ff94fb6SRobert Watson.Pp 1660ff94fb6SRobert WatsonIn the following example, the script 167fd2f7a7fSEdward Tomasz Napierala.Va kdb.enter.witness 1680ff94fb6SRobert Watsonwill run when the kernel debugger is entered as a result of a witness 1690ff94fb6SRobert Watsonviolation, printing lock-related information for the user: 1700ff94fb6SRobert Watson.Bd -literal -offset indent 1710ff94fb6SRobert Watsonscript kdb.enter.witness=show locks 1720ff94fb6SRobert Watson.Ed 173138f7e4bSTom Rhodes.Pp 174138f7e4bSTom RhodesThese scripts may also be configured using the 175138f7e4bSTom Rhodes.Xr ddb 8 176138f7e4bSTom Rhodesutility. 1770ff94fb6SRobert Watson.Sh SEE ALSO 1787970a637STim Kientzle.Xr tar 1 , 1790ff94fb6SRobert Watson.Xr ddb 4 , 1800ff94fb6SRobert Watson.Xr tar 5 , 181138f7e4bSTom Rhodes.Xr ddb 8 , 1820ff94fb6SRobert Watson.Xr dumpon 8 , 1830ff94fb6SRobert Watson.Xr savecore 8 , 1840ff94fb6SRobert Watson.Xr sysctl 8 1850dda506cSRobert Watson.Sh HISTORY 1860dda506cSRobert WatsonThe 1870dda506cSRobert Watson.Nm 1880dda506cSRobert Watsonfacility first appeared in 1890dda506cSRobert Watson.Fx 7.1 . 1900ff94fb6SRobert Watson.Sh AUTHORS 1910ff94fb6SRobert WatsonThe 1920ff94fb6SRobert Watson.Nm 1930ff94fb6SRobert Watsonfacility was created by 1940ff94fb6SRobert Watson.An Robert N. M. Watson . 195