2 .\" Mach Operating System
3 .\" Copyright (c) 1991,1990 Carnegie Mellon University
4 .\" Copyright (c) 2007 Robert N. M. Watson
5 .\" All Rights Reserved.
7 .\" Permission to use, copy, modify and distribute this software and its
8 .\" documentation is hereby granted, provided that both the copyright
9 .\" notice and this permission notice appear in all copies of the
10 .\" software, derivative works or modified versions, and any portions
11 .\" thereof, and that both notices appear in supporting documentation.
13 .\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
14 .\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
15 .\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 .\" Carnegie Mellon requests users of this software to return to
19 .\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
20 .\" School of Computer Science
21 .\" Carnegie Mellon University
22 .\" Pittsburgh PA 15213-3890
24 .\" any improvements or extensions that they make and grant Carnegie Mellon
25 .\" the rights to redistribute these changes.
27 .\" changed a \# to #, since groff choked on it.
31 .\" Revision 1.1 1993/07/15 18:41:02 brezak
34 .\" Revision 2.6 92/04/08 08:52:57 rpd
36 .\" [92/01/17 14:19:22 jsb]
37 .\" Changes for OSF debugger modifications.
40 .\" Revision 2.5 91/06/25 13:50:22 rpd
41 .\" Added some watchpoint explanation.
44 .\" Revision 2.4 91/06/17 15:47:31 jsb
45 .\" Added documentation for continue/c, match, search, and watchpoints.
46 .\" I've not actually explained what a watchpoint is; maybe Rich can
47 .\" do that (hint, hint).
48 .\" [91/06/17 10:58:08 jsb]
50 .\" Revision 2.3 91/05/14 17:04:23 mrt
51 .\" Correcting copyright
53 .\" Revision 2.2 91/02/14 14:10:06 mrt
54 .\" Changed to new Mach copyright
55 .\" [91/02/12 18:10:12 mrt]
57 .\" Revision 2.2 90/08/30 14:23:15 dbg
68 .Nd interactive kernel debugger
70 In order to enable kernel debugging facilities include:
71 .Bd -ragged -offset indent
76 To prevent activation of the debugger on kernel
78 .Bd -ragged -offset indent
79 .Cd options KDB_UNATTENDED
82 In order to print a stack trace of the current thread on the console
84 .Bd -ragged -offset indent
88 To print the numerical value of symbols in addition to the symbolic
89 representation, define:
90 .Bd -ragged -offset indent
91 .Cd options DDB_NUMSYM
96 backend, so that remote debugging with
99 .Bd -ragged -offset indent
105 kernel debugger is an interactive debugger with a syntax inspired by
107 If linked into the running kernel,
108 it can be invoked locally with the
111 action, usually mapped to Ctrl+Alt+Esc, or by setting the
114 The debugger is also invoked on kernel
117 .Va debug.debugger_on_panic
119 MIB variable is set non-zero,
125 The current location is called
130 a hexadecimal format at a prompt.
137 to the address of the last line
138 examined or the last location modified, and set
141 the next location to be examined or changed.
142 Other commands do not change
149 The general command syntax is:
150 .Ar command Ns Op Li / Ns Ar modifier
151 .Oo Ar addr Oc Ns Op , Ns Ar count
153 A blank line repeats the previous command from the address
156 count 1 and no modifiers.
169 to be 1 for printing commands or infinity for stack traces.
172 of -1 is equivalent to a missing
174 Options that are supplied but not supported by the given
180 debugger has a pager feature (like the
184 If an output line exceeds the number set in the
186 variable, it displays
188 and waits for a response.
189 The valid responses for it are:
191 .Bl -tag -compact -width ".Li SPC"
197 abort the current command, and return to the command input mode
202 provides a small (currently 10 items) command history, and offers
205 command line editing capabilities.
209 control keys, the usual
211 arrow keys may be used to
212 browse through the history buffer, and move the cursor within the
215 .Bl -tag -width indent -compact
217 .Ic examine Ns Op Li / Ns Cm AISabcdghilmorsuxz ...
218 .Oo Ar addr Oc Ns Op , Ns Ar count
221 .Ic x Ns Op Li / Ns Cm AISabcdghilmorsuxz ...
222 .Oo Ar addr Oc Ns Op , Ns Ar count
224 Display the addressed locations according to the formats in the modifier.
225 Multiple modifier formats display multiple locations.
226 If no format is specified, the last format specified for this command
229 The format characters are:
230 .Bl -tag -compact -width indent
232 look at by bytes (8 bits)
234 look at by half words (16 bits)
236 look at by long words (32 bits)
238 look at by quad words (64 bits)
240 print the location being displayed
242 print the location with a line number if possible
244 display in unsigned hex
246 display in signed hex
248 display in unsigned octal
250 display in signed decimal
252 display in unsigned decimal
254 display in current radix, signed
256 display low 8 bits as a character.
257 Non-printing characters are displayed as an octal escape code (e.g.,
260 display the null-terminated string at the location.
261 Non-printing characters are displayed as octal escapes.
263 display in unsigned hex with character dump at the end of each line.
264 The location is also displayed in hex at the beginning of each line.
266 display as a disassembled instruction
268 display as an disassembled instruction with possible alternate formats depending on the
270 On i386, this selects the alternate format for the instruction decoding
271 (16 bits in a 32-bit code segment and vice versa).
273 display a symbol name for the pointer stored at the address
280 command with the last specified parameters to it
281 except that the next address displayed by it is used as the start address.
287 command with the last specified parameters to it
288 except that the last start address subtracted by the size displayed by it
289 is used as the start address.
291 .It Ic print Ns Op Li / Ns Cm acdoruxz
292 .It Ic p Ns Op Li / Ns Cm acdoruxz
295 according to the modifier character (as described above for
298 .Cm a , x , z , o , d , u , r ,
301 If no modifier is specified, the last one specified to it is used.
304 can be a string, in which case it is printed as it is.
306 .Bd -literal -offset indent
307 print/x "eax = " $eax "\enecx = " $ecx "\en"
311 .Bd -literal -offset indent
317 .Ic write Ns Op Li / Ns Cm bhl
318 .Ar addr expr1 Op Ar expr2 ...
321 .Ic w Ns Op Li / Ns Cm bhl
322 .Ar addr expr1 Op Ar expr2 ...
324 Write the expressions specified after
326 on the command line at succeeding locations starting with
328 The write unit size can be specified in the modifier with a letter
334 (long word) respectively.
336 long word is assumed.
339 since there is no delimiter between expressions, strange
341 It is best to enclose each expression in parentheses.
343 .It Ic set Li $ Ns Ar variable Oo Li = Oc Ar expr
344 Set the named variable or register with the value of
346 Valid variable names are described below.
348 .It Ic break Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op , Ns Ar count
349 .It Ic b Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op , Ns Ar count
356 command will not stop at this break point on the first
358 \- 1 times that it is hit.
359 If the break point is set, a break point number is
362 This number can be used in deleting the break point
363 or adding conditions to it.
367 modifier is specified, this command sets a break point in user
371 option, the address is considered to be in the kernel
372 space, and a wrong space address is rejected with an error message.
373 This modifier can be used only if it is supported by machine dependent
377 If a user text is shadowed by a normal user space debugger,
378 user space break points may not work correctly.
380 point at the low-level code paths may also cause strange behavior.
382 .It Ic delete Op Ar addr
384 .It Ic delete Li # Ns Ar number
385 .It Ic d Li # Ns Ar number
386 Delete the specified break point.
387 The break point can be specified by a
388 break point number with
392 specified in the original
394 command, or by omitting
396 to get the default address of
399 .It Ic watch Oo Ar addr Oc Ns Op , Ns Ar size
400 Set a watchpoint for a region.
401 Execution stops when an attempt to modify the region occurs.
404 argument defaults to 4.
405 If you specify a wrong space address, the request is rejected
406 with an error message.
409 Attempts to watch wired kernel memory
410 may cause unrecoverable error in some systems such as i386.
411 Watchpoints on user addresses work best.
413 .It Ic hwatch Oo Ar addr Oc Ns Op , Ns Ar size
414 Set a hardware watchpoint for a region if supported by the
416 Execution stops when an attempt to modify the region occurs.
419 argument defaults to 4.
422 The hardware debug facilities do not have a concept of separate
423 address spaces like the watch command does.
426 for setting watchpoints on kernel address locations only, and avoid
427 its use on user mode address spaces.
429 .It Ic dhwatch Oo Ar addr Oc Ns Op , Ns Ar size
430 Delete specified hardware watchpoint.
432 .It Ic step Ns Oo Li / Ns Cm p Oc Ns Op , Ns Ar count
433 .It Ic s Ns Oo Li / Ns Cm p Oc Ns Op , Ns Ar count
439 modifier is specified, print each instruction at each step.
440 Otherwise, only print the last instruction.
443 depending on machine type, it may not be possible to
444 single-step through some low-level code paths or user space code.
445 On machines with software-emulated single-stepping (e.g., pmax),
446 stepping through code executed by interrupt handlers will probably
449 .It Ic continue Ns Op Li / Ns Cm c
450 .It Ic c Ns Op Li / Ns Cm c
451 Continue execution until a breakpoint or watchpoint.
454 modifier is specified, count instructions while executing.
455 Some machines (e.g., pmax) also count loads and stores.
458 when counting, the debugger is really silently single-stepping.
459 This means that single-stepping on low-level code may cause strange
462 .It Ic until Ns Op Li / Ns Cm p
463 Stop at the next call or return instruction.
466 modifier is specified, print the call nesting depth and the
467 cumulative instruction count at each call or return.
469 only print when the matching return is hit.
471 .It Ic next Ns Op Li / Ns Cm p
472 .It Ic match Ns Op Li / Ns Cm p
473 Stop at the matching return instruction.
476 modifier is specified, print the call nesting depth and the
477 cumulative instruction count at each call or return.
478 Otherwise, only print when the matching return is hit.
481 .Ic trace Ns Op Li / Ns Cm u
486 .Ic t Ns Op Li / Ns Cm u
491 .Ic where Ns Op Li / Ns Cm u
496 .Ic bt Ns Op Li / Ns Cm u
503 option traces user space; if omitted,
507 The optional argument
509 is the number of frames to be traced.
512 is omitted, all frames are printed.
515 User space stack trace is valid
516 only if the machine dependent code supports it.
519 .Ic search Ns Op Li / Ns Cm bhl
529 argument limits the search.
536 Prints the thread address for a thread kernel-mode stack of which contains the
538 If the thread is not found, search the thread stack cache and prints the
539 cached stack address.
540 Otherwise, prints nothing.
542 .It Ic show Cm all procs Ns Op Li / Ns Cm a
543 .It Ic ps Ns Op Li / Ns Cm a
544 Display all process information.
545 The process information may not be shown if it is not
546 supported in the machine, or the bottom of the stack of the
547 target process is not in the main memory at that time.
550 modifier will print command line arguments for each process.
553 .It Ic show Cm all trace
555 Show a stack trace for every thread in the system.
557 .It Ic show Cm all ttys
558 Show all TTY's within the system.
561 but also includes the address of the TTY structure.
564 .It Ic show Cm all vnets
565 Show the same output as "show vnet" does, but lists all
566 virtualized network stacks within the system.
569 .It Ic show Cm allchains
570 Show the same information like "show lockchain" does, but
571 for every thread in the system.
574 .It Ic show Cm alllocks
575 Show all locks that are currently held.
576 This command is only available if
578 is included in the kernel.
581 .It Ic show Cm allpcpu
582 The same as "show pcpu", but for every CPU present in the system.
585 .It Ic show Cm allrman
586 Show information related with resource management, including
587 interrupt request lines, DMA request lines, I/O ports, I/O memory
588 addresses, and Resource IDs.
592 Dump data about APIC IDT vector mappings.
595 .It Ic show Cm breaks
596 Show breakpoints set with the "break" command.
599 .It Ic show Cm bio Ar addr
600 Show information about the bio structure
608 for more details on the exact meaning of the structure fields.
611 .It Ic show Cm buffer Ar addr
612 Show information about the buf structure
618 header file for more details on the exact meaning of the structure fields.
621 .It Ic show Cm callout Ar addr
622 Show information about the callout structure
628 .It Ic show Cm cbstat
629 Show brief information about the TTY subsystem.
633 Without argument, show the list of all created cdev's, consisting of devfs
634 node name and struct cdev address.
635 When address of cdev is supplied, show some internal devfs state of the cdev.
638 .It Ic show Cm conifhk
639 Lists hooks currently waiting for completion in
640 run_interrupt_driven_config_hooks().
643 .It Ic show Cm cpusets
644 Print numbered root and assigned CPU affinity sets.
650 .It Ic show Cm cyrixreg
651 Show registers specific to the Cyrix processor.
654 .It Ic show Cm devmap
655 Prints the contents of the static device mapping table.
656 Currently only available on the
661 .It Ic show Cm domain Ar addr
662 Print protocol domain structure
668 header file for more details on the exact meaning of the structure fields.
671 .It Ic show Cm ffs Op Ar addr
672 Show brief information about ffs mount at the address
674 if argument is given.
675 Otherwise, provides the summary about each ffs mount.
678 .It Ic show Cm file Ar addr
679 Show information about the file structure
686 Show information about every file structure in the system.
689 .It Ic show Cm freepages
690 Show the number of physical pages in each of the free lists.
693 .It Ic show Cm geom Op Ar addr
696 argument is not given, displays the entire GEOM topology.
699 is given, displays details about the given GEOM object (class, geom,
700 provider or consumer).
705 The first column specifies the IDT vector.
706 The second one is the name of the interrupt/trap handler.
707 Those functions are machine dependent.
710 .It Ic show Cm igi_list Ar addr
711 Show information about the IGMP structure
712 .Vt struct igmp_ifsoftc
717 .It Ic show Cm inodedeps Op Ar addr
718 Show brief information about each inodedep structure.
721 is given, only inodedeps belonging to the fs located at the
722 supplied address are shown.
725 .It Ic show Cm inpcb Ar addr
726 Show information on IP Control Block
733 Dump information about interrupt handlers.
736 .It Ic show Cm intrcnt
737 Dump the interrupt statistics.
741 Show interrupt lines and their respective kernel threads.
750 shows, also list kernel internal details.
754 Show information from the local APIC registers for this CPU.
757 .It Ic show Cm lock Ar addr
759 The output format is as follows:
760 .Bl -tag -width "flags"
763 Possible types include
771 Flags passed to the lock initialization function.
773 values are lock class specific.
775 Current state of a lock.
777 values are lock class specific.
783 .It Ic show Cm lockchain Ar addr
784 Show all threads a particular thread at address
786 is waiting on based on non-spin locks.
789 .It Ic show Cm lockedbufs
790 Show the same information as "show buf", but for every locked
795 .It Ic show Cm lockedvnods
796 List all locked vnodes in the system.
800 Prints all locks that are currently acquired.
801 This command is only available if
803 is included in the kernel.
806 .It Ic show Cm locktree
809 .It Ic show Cm malloc
812 memory allocator statistics.
813 The output format is as follows:
815 .Bl -tag -compact -offset indent -width "Requests"
817 Specifies a type of memory.
818 It is the same as a description string used while defining the
819 given memory type with
820 .Xr MALLOC_DECLARE 9 .
822 Number of memory allocations of the given type, for which
824 has not been called yet.
826 Total memory consumed by the given allocation type.
828 Number of memory allocation requests for the given
832 The same information can be gathered in userspace with
836 .It Ic show Cm map Ns Oo Li / Ns Cm f Oc Ar addr
841 modifier is specified the
842 complete map is printed.
845 .It Ic show Cm msgbuf
846 Print the system's message buffer.
847 It is the same output as in the
850 It is useful if you got a kernel panic, attached a serial cable
851 to the machine and want to get the boot messages from before the
855 Displays short info about all currently mounted file systems.
857 .It Ic show Cm mount Ar addr
858 Displays details about the given mount point.
861 .It Ic show Cm object Ns Oo Li / Ns Cm f Oc Ar addr
862 Prints the VM object at
866 option is specified the
867 complete object is printed.
871 Print the panic message if set.
875 Show statistics on VM pages.
879 Show statistics on VM page queues.
882 .It Ic show Cm pciregs
883 Print PCI bus registers.
884 The same information can be gathered in userspace by running
885 .Dq Nm pciconf Fl lv .
889 Print current processor state.
890 The output format is as follows:
892 .Bl -tag -compact -offset indent -width "spin locks held:"
894 Processor identifier.
896 Thread pointer, process identifier and the name of the process.
898 Control block pointer.
904 CPU identifier coming from APIC.
907 .It Ic spin locks held
908 Names of spin locks held.
912 .It Ic show Cm pgrpdump
913 Dump process groups present within the system.
916 .It Ic show Cm proc Op Ar addr
919 is specified, print information about the current process.
920 Otherwise, show information about the process at address
924 .It Ic show Cm procvm
925 Show process virtual memory layout.
928 .It Ic show Cm protosw Ar addr
929 Print protocol switch structure
935 .It Ic show Cm registers Ns Op Li / Ns Cm u
936 Display the register set.
939 modifier is specified, it displays user registers instead of
940 kernel registers or the currently saved one.
945 modifier depends on the machine.
946 If not supported, incorrect information will be displayed.
949 .It Ic show Cm rman Ar addr
950 Show resource manager object
954 Addresses of particular pointers can be gathered with "show allrman"
959 Show real time clock value.
960 Useful for long debugging sessions.
963 .It Ic show Cm sleepchain
966 .Ic show Cm lockchain .
969 .It Ic show Cm sleepq
970 .It Ic show Cm sleepqueue
971 Both commands provide the same functionality.
973 .Vt struct sleepqueue
975 Sleepqueues are used within the
977 kernel to implement sleepable
978 synchronization primitives (thread holding a lock might sleep or
979 be context switched), which at the time of writing are:
987 .It Ic show Cm sockbuf Ar addr
988 .It Ic show Cm socket Ar addr
995 Output consists of all values present in structures mentioned.
996 For exact interpretation and more details, visit
1001 .It Ic show Cm sysregs
1002 Show system registers (e.g.,
1005 Not present on some platforms.
1008 .It Ic show Cm tcpcb Ar addr
1009 Print TCP control block
1013 For exact interpretation of output, visit
1018 .It Ic show Cm thread Op Ar addr | tid
1023 is specified, show detailed information about current thread.
1024 Otherwise, print information about the thread with ID
1028 (If the argument is a decimal number, it is assumed to be a tid.)
1031 .It Ic show Cm threads
1032 Show all threads within the system.
1033 Output format is as follows:
1035 .Bl -tag -compact -offset indent -width "Second column"
1037 Thread identifier (TID)
1038 .It Ic Second column
1039 Thread structure address
1045 .It Ic show Cm tty Ar addr
1046 Display the contents of a TTY structure in a readable form.
1049 .It Ic show Cm turnstile Ar addr
1051 .Vt struct turnstile
1052 structure at address
1054 Turnstiles are structures used within the
1057 synchronization primitives which, while holding a specific type of lock, cannot
1058 sleep or context switch to another thread.
1059 Currently, those are:
1066 Show UMA allocator statistics.
1067 Output consists five columns:
1069 .Bl -tag -compact -offset indent -width "Requests"
1071 Name of the UMA zone.
1072 The same string that was passed to
1074 as a first argument.
1076 Size of a given memory object (slab).
1078 Number of slabs being currently used.
1080 Number of free slabs within the UMA zone.
1082 Number of allocations requests to the given zone.
1085 The very same information might be gathered in the userspace
1087 .Dq Nm vmstat Fl z .
1090 .It Ic show Cm unpcb Ar addr
1091 Shows UNIX domain socket private control block
1093 present at the address
1097 .It Ic show Cm vmochk
1098 Prints, whether the internal VM objects are in a map somewhere
1099 and none have zero ref counts.
1102 .It Ic show Cm vmopag
1103 This is supposed to show physical addresses consumed by a
1105 Currently, it is not possible to use this command when
1107 is compiled in the kernel.
1110 .It Ic show Cm vnet Ar addr
1111 Prints virtualized network stack
1113 structure present at the address
1117 .It Ic show Cm vnode Op Ar addr
1122 For the exact interpretation of the output, look at the
1127 .It Ic show Cm vnodebufs Ar addr
1128 Shows clean/dirty buffer lists of the vnode located at
1132 .It Ic show Cm vpath Ar addr
1133 Walk the namecache to lookup the pathname of the vnode located at
1137 .It Ic show Cm watches
1138 Displays all watchpoints.
1139 Shows watchpoints set with "watch" command.
1142 .It Ic show Cm witness
1143 Shows information about lock acquisition coming from the
1149 Toggles between remote GDB and DDB mode.
1150 In remote GDB mode, another machine is required that runs
1152 using the remote debug feature, with a connection to the serial
1153 console port on the target machine.
1154 Currently only available on the
1161 .It Ic kill Ar sig pid
1166 The signal is acted on upon returning from the debugger.
1167 This command can be used to kill a process causing resource contention
1168 in the case of a hung system.
1171 for a list of signals.
1172 Note that the arguments are reversed relative to
1175 .It Ic reboot Op Ar seconds
1176 .It Ic reset Op Ar seconds
1177 Hard reset the system.
1178 If the optional argument
1180 is given, the debugger will wait for this long, at most a week,
1184 Print a short summary of the available commands and command
1189 .It Ic capture reset
1190 .It Ic capture status
1192 supports a basic output capture facility, which can be used to retrieve the
1193 results of debugging commands from userspace using
1196 enables output capture;
1200 will clear the capture buffer and disable capture.
1202 will report current buffer use, buffer size, and disposition of output
1205 Userspace processes may inspect and manage
1210 .Va debug.ddb.capture.bufsize
1211 may be used to query or set the current capture buffer size.
1213 .Va debug.ddb.capture.maxbufsize
1214 may be used to query the compile-time limit on the capture buffer size.
1216 .Va debug.ddb.capture.bytes
1217 may be used to query the number of bytes of output currently in the capture
1220 .Va debug.ddb.capture.data
1221 returns the contents of the buffer as a string to an appropriately privileged
1224 This facility is particularly useful in concert with the scripting and
1226 facilities, allowing scripted debugging output to be captured and
1227 committed to disk as part of a textdump for later analysis.
1228 The contents of the capture buffer may also be inspected in a kernel core dump
1236 Run, define, list, and delete scripts.
1239 section for more information on the scripting facility.
1241 .It Ic textdump dump
1243 .It Ic textdump status
1244 .It Ic textdump unset
1247 command to immediately perform a textdump.
1248 More information may be found in
1252 command may be used to force the next kernel core dump to be a textdump
1253 rather than a traditional memory dump or minidump.
1255 reports whether a textdump has been scheduled.
1257 cancels a request to perform a textdump as the next kernel core dump.
1259 .It Ic thread Ar addr | tid
1260 Switch the debugger to the thread with ID
1262 if the argument is a decimal number, or address
1267 The debugger accesses registers and variables as
1269 Register names are as in the
1270 .Dq Ic show Cm registers
1272 Some variables are suffixed with numbers, and may have some modifier
1273 following a colon immediately after the variable name.
1274 For example, register variables can have a
1276 modifier to indicate user register (e.g.,
1279 Built-in variables currently supported are:
1281 .Bl -tag -width ".Va tabstops" -compact
1283 Input and output radix.
1285 Addresses are printed as
1286 .Dq Ar symbol Ns Li + Ns Ar offset
1292 The width of the displayed line.
1294 The number of lines.
1295 It is used by the built-in pager.
1296 Setting it to 0 disables paging.
1299 .It Va work Ns Ar xx
1302 can take values from 0 to 31.
1305 Most expression operators in C are supported except
1313 .Bl -tag -width ".No Identifiers"
1315 The name of a symbol is translated to the value of the symbol, which
1316 is the address of the corresponding object.
1320 can be used in the identifier.
1321 If supported by an object format dependent routine,
1323 .Oo Ar filename : Oc Ar func : lineno ,
1325 .Oo Ar filename : Oc Ns Ar variable ,
1327 .Oo Ar filename : Oc Ns Ar lineno
1328 can be accepted as a symbol.
1330 Radix is determined by the first two letters:
1336 decimal; otherwise, follow current radix.
1342 address of the start of the last line examined.
1347 this is only changed by
1353 last address explicitly specified.
1354 .It Li $ Ns Ar variable
1355 Translated to the value of the specified variable.
1356 It may be followed by a
1358 and modifiers as described above.
1359 .It Ar a Ns Li # Ns Ar b
1360 A binary operator which rounds up the left hand side to the next
1361 multiple of right hand side.
1364 It may be followed by a
1366 and modifiers as described above.
1370 supports a basic scripting facility to allow automating tasks or responses to
1372 Each script consists of a list of DDB commands to be executed sequentially,
1373 and is assigned a unique name.
1374 Certain script names have special meaning, and will be automatically run on
1377 events if scripts by those names have been defined.
1381 command may be used to define a script by name.
1382 Scripts consist of a series of
1384 commands separated with the
1388 .Bd -literal -offset indent
1389 script kdb.enter.panic=bt; show pcpu
1390 script lockinfo=show alllocks; show lockedvnods
1395 command lists currently defined scripts.
1399 command execute a script by name.
1401 .Bd -literal -offset indent
1407 command may be used to delete a script by name.
1409 .Bd -literal -offset indent
1410 unscript kdb.enter.panic
1413 These functions may also be performed from userspace using the
1417 Certain scripts are run automatically, if defined, for specific
1420 The follow scripts are run when various events occur:
1421 .Bl -tag -width kdb.enter.powerfail
1422 .It Va kdb.enter.acpi
1423 The kernel debugger was entered as a result of an
1426 .It Va kdb.enter.bootflags
1427 The kernel debugger was entered at boot as a result of the debugger boot
1429 .It Va kdb.enter.break
1430 The kernel debugger was entered as a result of a serial or console break.
1431 .It Va kdb.enter.cam
1432 The kernel debugger was entered as a result of a
1435 .It Va kdb.enter.mac
1436 The kernel debugger was entered as a result of an assertion failure in the
1439 TrustedBSD MAC Framework.
1440 .It Va kdb.enter.ndis
1441 The kernel debugger was entered as a result of an
1444 .It Va kdb.enter.netgraph
1445 The kernel debugger was entered as a result of a
1448 .It Va kdb.enter.panic
1451 .It Va kdb.enter.powerfail
1452 The kernel debugger was entered as a result of a powerfail NMI on the sparc64
1454 .It Va kdb.enter.powerpc
1455 The kernel debugger was entered as a result of an unimplemented interrupt
1456 type on the powerpc platform.
1457 .It Va kdb.enter.sysctl
1458 The kernel debugger was entered as a result of the
1461 .It Va kdb.enter.trapsig
1462 The kernel debugger was entered as a result of a trapsig event on the sparc64
1464 .It Va kdb.enter.unionfs
1465 The kernel debugger was entered as a result of an assertion failure in the
1467 .It Va kdb.enter.unknown
1468 The kernel debugger was entered, but no reason has been set.
1469 .It Va kdb.enter.vfslock
1470 The kernel debugger was entered as a result of a VFS lock violation.
1471 .It Va kdb.enter.watchdog
1472 The kernel debugger was entered as a result of a watchdog firing.
1473 .It Va kdb.enter.witness
1474 The kernel debugger was entered as a result of a
1479 In the event that none of these scripts is found,
1481 will attempt to execute a default script:
1482 .Bl -tag -width kdb.enter.powerfail
1483 .It Va kdb.enter.default
1484 The kernel debugger was entered, but a script exactly matching the reason for
1485 entering was not defined.
1486 This can be used as a catch-all to handle cases not specifically of interest;
1488 .Va kdb.enter.witness
1489 might be defined to have special handling, and
1490 .Va kdb.enter.default
1491 might be defined to simply panic and reboot.
1494 On machines with an ISA expansion bus, a simple NMI generation card can be
1495 constructed by connecting a push button between the A01 and B01 (CHCHK# and
1497 Momentarily shorting these two fingers together may cause the bridge chipset to
1498 generate an NMI, which causes the kernel to pass control to
1500 Some bridge chipsets do not generate a NMI on CHCHK#, so your mileage may vary.
1501 The NMI allows one to break into the debugger on a wedged machine to
1503 Other bus' bridge chipsets may be able to generate NMI using bus specific
1505 There are many PCI and PCIe add-in cards which can generate NMI for
1507 Modern server systems typically use IPMI to generate signals to enter the
1511 port can be used to send the
1512 .Cd chassis power diag
1513 command which delivers an NMI to the processor.
1514 Embedded systems often use JTAG for debugging, but rarely use it in
1518 For serial consoles, you can enter the debugger by sending a BREAK
1519 condition on the serial line if
1520 .Cd options BREAK_TO_DEBUGGER
1521 is specified in the kernel.
1522 Most terminal emulation programs can send a break sequence with a
1523 special key sequence or via a menu item.
1524 However, in some setups, sending the break can be difficult to arrange
1525 or happens spuriously, so if the kernel contains
1526 .Cd options ALT_BREAK_TO_DEBUGGER
1527 then the sequence of CR TILDE CTRL-B enters the debugger;
1528 CR TILDE CTRL-P causes a panic instead of entering the
1530 CR TILDE CTRL-R causes an immediate reboot.
1531 In all the above sequences, CR is a Carriage Return and is usually
1532 sent by hitting the Enter or Return key.
1533 TILDE is the ASCII tilde character (~).
1534 CTRL-x is Control x created by hitting the control key and then x
1535 and then releasing both.
1537 The break to enter the debugger behavior may be enabled at run-time
1540 .Va debug.kdb.break_to_debugger
1542 The alternate sequence to enter the debugger behavior may be enabled
1543 at run-time by setting the
1545 .Va debug.kdb.alt_break_to_debugger
1547 The debugger may be entered by setting the
1552 Header files mentioned in this manual page can be found below
1562 .Pa netinet/in_pcb.h
1584 debugger was developed for Mach, and ported to
1586 This manual page translated from
1589 .An Garrett Wollman .
1591 .An Robert N. M. Watson