1.\" 2.\" Mach Operating System 3.\" Copyright (c) 1991,1990 Carnegie Mellon University 4.\" Copyright (c) 2007 Robert N. M. Watson 5.\" All Rights Reserved. 6.\" 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. 12.\" 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. 16.\" 17.\" Carnegie Mellon requests users of this software to return to 18.\" 19.\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 20.\" School of Computer Science 21.\" Carnegie Mellon University 22.\" Pittsburgh PA 15213-3890 23.\" 24.\" any improvements or extensions that they make and grant Carnegie Mellon 25.\" the rights to redistribute these changes. 26.\" 27.\" changed a \# to #, since groff choked on it. 28.\" 29.\" HISTORY 30.\" ddb.4,v 31.\" Revision 1.1 1993/07/15 18:41:02 brezak 32.\" Man page for DDB 33.\" 34.\" Revision 2.6 92/04/08 08:52:57 rpd 35.\" Changes from OSF. 36.\" [92/01/17 14:19:22 jsb] 37.\" Changes for OSF debugger modifications. 38.\" [91/12/12 tak] 39.\" 40.\" Revision 2.5 91/06/25 13:50:22 rpd 41.\" Added some watchpoint explanation. 42.\" [91/06/25 rpd] 43.\" 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] 49.\" 50.\" Revision 2.3 91/05/14 17:04:23 mrt 51.\" Correcting copyright 52.\" 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] 56.\" 57.\" Revision 2.2 90/08/30 14:23:15 dbg 58.\" Created. 59.\" [90/08/30 dbg] 60.\" 61.\" $FreeBSD$ 62.\" 63.Dd April 28, 2008 64.Dt DDB 4 65.Os 66.Sh NAME 67.Nm ddb 68.Nd interactive kernel debugger 69.Sh SYNOPSIS 70.Cd options KDB 71.Cd options DDB 72.Pp 73To prevent activation of the debugger on kernel 74.Xr panic 9 : 75.Cd options KDB_UNATTENDED 76.Sh DESCRIPTION 77The 78.Nm 79kernel debugger has most of the features of the old 80.Nm kdb , 81but with a more rational syntax 82inspired by 83.Xr gdb 1 . 84If linked into the running kernel, 85it can be invoked locally with the 86.Ql debug 87.Xr keymap 5 88action. 89The debugger is also invoked on kernel 90.Xr panic 9 91if the 92.Va debug.debugger_on_panic 93.Xr sysctl 8 94MIB variable is set non-zero, 95which is the default 96unless the 97.Dv KDB_UNATTENDED 98option is specified. 99.Pp 100The current location is called 101.Va dot . 102The 103.Va dot 104is displayed with 105a hexadecimal format at a prompt. 106The commands 107.Ic examine 108and 109.Ic write 110update 111.Va dot 112to the address of the last line 113examined or the last location modified, and set 114.Va next 115to the address of 116the next location to be examined or changed. 117Other commands do not change 118.Va dot , 119and set 120.Va next 121to be the same as 122.Va dot . 123.Pp 124The general command syntax is: 125.Ar command Ns Op Li / Ns Ar modifier 126.Ar address Ns Op Li , Ns Ar count 127.Pp 128A blank line repeats the previous command from the address 129.Va next 130with 131count 1 and no modifiers. 132Specifying 133.Ar address 134sets 135.Va dot 136to the address. 137Omitting 138.Ar address 139uses 140.Va dot . 141A missing 142.Ar count 143is taken 144to be 1 for printing commands or infinity for stack traces. 145.Pp 146The 147.Nm 148debugger has a pager feature (like the 149.Xr more 1 150command) 151for the output. 152If an output line exceeds the number set in the 153.Va lines 154variable, it displays 155.Dq Li --More-- 156and waits for a response. 157The valid responses for it are: 158.Pp 159.Bl -tag -compact -width ".Li SPC" 160.It Li SPC 161one more page 162.It Li RET 163one more line 164.It Li q 165abort the current command, and return to the command input mode 166.El 167.Pp 168Finally, 169.Nm 170provides a small (currently 10 items) command history, and offers 171simple 172.Nm emacs Ns -style 173command line editing capabilities. 174In addition to 175the 176.Nm emacs 177control keys, the usual 178.Tn ANSI 179arrow keys might be used to 180browse through the history buffer, and move the cursor within the 181current line. 182.Sh COMMANDS 183.Bl -tag -width indent -compact 184.It Ic examine 185.It Ic x 186Display the addressed locations according to the formats in the modifier. 187Multiple modifier formats display multiple locations. 188If no format is specified, the last format specified for this command 189is used. 190.Pp 191The format characters are: 192.Bl -tag -compact -width indent 193.It Cm b 194look at by bytes (8 bits) 195.It Cm h 196look at by half words (16 bits) 197.It Cm l 198look at by long words (32 bits) 199.It Cm a 200print the location being displayed 201.It Cm A 202print the location with a line number if possible 203.It Cm x 204display in unsigned hex 205.It Cm z 206display in signed hex 207.It Cm o 208display in unsigned octal 209.It Cm d 210display in signed decimal 211.It Cm u 212display in unsigned decimal 213.It Cm r 214display in current radix, signed 215.It Cm c 216display low 8 bits as a character. 217Non-printing characters are displayed as an octal escape code (e.g., 218.Ql \e000 ) . 219.It Cm s 220display the null-terminated string at the location. 221Non-printing characters are displayed as octal escapes. 222.It Cm m 223display in unsigned hex with character dump at the end of each line. 224The location is also displayed in hex at the beginning of each line. 225.It Cm i 226display as an instruction 227.It Cm I 228display as an instruction with possible alternate formats depending on the 229machine: 230.Bl -tag -width ".Tn powerpc" -compact 231.It Tn alpha 232Show the registers of the instruction. 233.It Tn amd64 234No alternate format. 235.It Tn i386 236No alternate format. 237.It Tn ia64 238No alternate format. 239.It Tn powerpc 240No alternate format. 241.It Tn sparc64 242No alternate format. 243.El 244.It Cm S 245display a symbol name for the pointer stored at the address 246.El 247.Pp 248.It Ic xf 249Examine forward: 250execute an 251.Ic examine 252command with the last specified parameters to it 253except that the next address displayed by it is used as the start address. 254.Pp 255.It Ic xb 256Examine backward: 257execute an 258.Ic examine 259command with the last specified parameters to it 260except that the last start address subtracted by the size displayed by it 261is used as the start address. 262.Pp 263.It Ic print Ns Op Li / Ns Cm acdoruxz 264.It Ic p Ns Op Li / Ns Cm acdoruxz 265Print 266.Ar addr Ns s 267according to the modifier character (as described above for 268.Cm examine ) . 269Valid formats are: 270.Cm a , x , z , o , d , u , r , 271and 272.Cm c . 273If no modifier is specified, the last one specified to it is used. 274The argument 275.Ar addr 276can be a string, in which case it is printed as it is. 277For example: 278.Bd -literal -offset indent 279print/x "eax = " $eax "\enecx = " $ecx "\en" 280.Ed 281.Pp 282will print like: 283.Bd -literal -offset indent 284eax = xxxxxx 285ecx = yyyyyy 286.Ed 287.Pp 288.It Xo 289.Ic write Ns Op Li / Ns Cm bhl 290.Ar addr expr1 Op Ar expr2 ... 291.Xc 292.It Xo 293.Ic w Ns Op Li / Ns Cm bhl 294.Ar addr expr1 Op Ar expr2 ... 295.Xc 296Write the expressions specified after 297.Ar addr 298on the command line at succeeding locations starting with 299.Ar addr . 300The write unit size can be specified in the modifier with a letter 301.Cm b 302(byte), 303.Cm h 304(half word) or 305.Cm l 306(long word) respectively. 307If omitted, 308long word is assumed. 309.Pp 310.Sy Warning : 311since there is no delimiter between expressions, strange 312things may happen. 313It is best to enclose each expression in parentheses. 314.Pp 315.It Ic set Li $ Ns Ar variable Oo Li = Oc Ar expr 316Set the named variable or register with the value of 317.Ar expr . 318Valid variable names are described below. 319.Pp 320.It Ic break Ns Op Li / Ns Cm u 321.It Ic b Ns Op Li / Ns Cm u 322Set a break point at 323.Ar addr . 324If 325.Ar count 326is supplied, continues 327.Ar count 328\- 1 times before stopping at the 329break point. 330If the break point is set, a break point number is 331printed with 332.Ql # . 333This number can be used in deleting the break point 334or adding conditions to it. 335.Pp 336If the 337.Cm u 338modifier is specified, this command sets a break point in user space 339address. 340Without the 341.Cm u 342option, the address is considered in the kernel 343space, and wrong space address is rejected with an error message. 344This modifier can be used only if it is supported by machine dependent 345routines. 346.Pp 347.Sy Warning : 348If a user text is shadowed by a normal user space debugger, 349user space break points may not work correctly. 350Setting a break 351point at the low-level code paths may also cause strange behavior. 352.Pp 353.It Ic delete Ar addr 354.It Ic d Ar addr 355.It Ic delete Li # Ns Ar number 356.It Ic d Li # Ns Ar number 357Delete the break point. 358The target break point can be specified by a 359break point number with 360.Ql # , 361or by using the same 362.Ar addr 363specified in the original 364.Ic break 365command. 366.Pp 367.It Ic watch Ar addr Ns Li , Ns Ar size 368Set a watchpoint for a region. 369Execution stops when an attempt to modify the region occurs. 370The 371.Ar size 372argument defaults to 4. 373If you specify a wrong space address, the request is rejected 374with an error message. 375.Pp 376.Sy Warning : 377Attempts to watch wired kernel memory 378may cause unrecoverable error in some systems such as i386. 379Watchpoints on user addresses work best. 380.Pp 381.It Ic hwatch Ar addr Ns Li , Ns Ar size 382Set a hardware watchpoint for a region if supported by the 383architecture. 384Execution stops when an attempt to modify the region occurs. 385The 386.Ar size 387argument defaults to 4. 388.Pp 389.Sy Warning : 390The hardware debug facilities do not have a concept of separate 391address spaces like the watch command does. 392Use 393.Ic hwatch 394for setting watchpoints on kernel address locations only, and avoid 395its use on user mode address spaces. 396.Pp 397.It Ic dhwatch Ar addr Ns Li , Ns Ar size 398Delete specified hardware watchpoint. 399.Pp 400.It Ic step Ns Op Li / Ns Cm p 401.It Ic s Ns Op Li / Ns Cm p 402Single step 403.Ar count 404times (the comma is a mandatory part of the syntax). 405If the 406.Cm p 407modifier is specified, print each instruction at each step. 408Otherwise, only print the last instruction. 409.Pp 410.Sy Warning : 411depending on machine type, it may not be possible to 412single-step through some low-level code paths or user space code. 413On machines with software-emulated single-stepping (e.g., pmax), 414stepping through code executed by interrupt handlers will probably 415do the wrong thing. 416.Pp 417.It Ic continue Ns Op Li / Ns Cm c 418.It Ic c Ns Op Li / Ns Cm c 419Continue execution until a breakpoint or watchpoint. 420If the 421.Cm c 422modifier is specified, count instructions while executing. 423Some machines (e.g., pmax) also count loads and stores. 424.Pp 425.Sy Warning : 426when counting, the debugger is really silently single-stepping. 427This means that single-stepping on low-level code may cause strange 428behavior. 429.Pp 430.It Ic until Ns Op Li / Ns Cm p 431Stop at the next call or return instruction. 432If the 433.Cm p 434modifier is specified, print the call nesting depth and the 435cumulative instruction count at each call or return. 436Otherwise, 437only print when the matching return is hit. 438.Pp 439.It Ic next Ns Op Li / Ns Cm p 440.It Ic match Ns Op Li / Ns Cm p 441Stop at the matching return instruction. 442If the 443.Cm p 444modifier is specified, print the call nesting depth and the 445cumulative instruction count at each call or return. 446Otherwise, only print when the matching return is hit. 447.Pp 448.It Xo 449.Ic trace Ns Op Li / Ns Cm u 450.Op Ar pid | tid 451.Op Li , Ns Ar count 452.Xc 453.It Xo 454.Ic t Ns Op Li / Ns Cm u 455.Op Ar pid | tid 456.Op Li , Ns Ar count 457.Xc 458.It Xo 459.Ic where Ns Op Li / Ns Cm u 460.Op Ar pid | tid 461.Op Li , Ns Ar count 462.Xc 463.It Xo 464.Ic bt Ns Op Li / Ns Cm u 465.Op Ar pid | tid 466.Op Li , Ns Ar count 467.Xc 468Stack trace. 469The 470.Cm u 471option traces user space; if omitted, 472.Ic trace 473only traces 474kernel space. 475The optional argument 476.Ar count 477is the number of frames to be traced. 478If 479.Ar count 480is omitted, all frames are printed. 481.Pp 482.Sy Warning : 483User space stack trace is valid 484only if the machine dependent code supports it. 485.Pp 486.It Xo 487.Ic search Ns Op Li / Ns Cm bhl 488.Ar addr 489.Ar value 490.Op Ar mask 491.Op Li , Ns Ar count 492.Xc 493Search memory for 494.Ar value . 495This command might fail in interesting 496ways if it does not find the searched-for value. 497This is because 498.Nm 499does not always recover from touching bad memory. 500The optional 501.Ar count 502argument limits the search. 503.Pp 504.It Ic show Cm all procs Ns Op Li / Ns Cm m 505.It Ic ps Ns Op Li / Ns Cm m 506Display all process information. 507The process information may not be shown if it is not 508supported in the machine, or the bottom of the stack of the 509target process is not in the main memory at that time. 510The 511.Cm m 512modifier will alter the display to show VM map 513addresses for the process and not show other info. 514.Pp 515.It Ic show Cm registers Ns Op Li / Ns Cm u 516Display the register set. 517If the 518.Cm u 519modifier is specified, it displays user registers instead of 520kernel or currently saved one. 521.Pp 522.Sy Warning : 523The support of the 524.Cm u 525modifier depends on the machine. 526If not supported, incorrect information will be displayed. 527.Pp 528.It Ic show Cm sysregs 529Show system registers (e.g., 530.Li cr0-4 531on i386.) 532Not present on some platforms. 533.Pp 534.It Ic show Cm geom Op Ar addr 535If the 536.Ar addr 537argument is not given, displays the entire GEOM topology. 538If the 539.Ar addr 540is given, displays details about the given GEOM object (class, geom, provider 541or consumer). 542.Pp 543.It Ic show Cm map Ns Oo Li / Ns Cm f Oc Ar addr 544Prints the VM map at 545.Ar addr . 546If the 547.Cm f 548modifier is specified the 549complete map is printed. 550.Pp 551.It Ic show Cm object Ns Oo Li / Ns Cm f Oc Ar addr 552Prints the VM object at 553.Ar addr . 554If the 555.Cm f 556option is specified the 557complete object is printed. 558.Pp 559.It Ic show Cm vnode Ar addr 560Displays details about the given vnode. 561.Pp 562.It Ic show Cm mount 563Displays short info about all currently mounted file systems. 564.Pp 565.It Ic show Cm mount Ar addr 566Displays details about the given mount point. 567.Pp 568.It Ic show Cm watches 569Displays all watchpoints. 570.Pp 571.It Ic gdb 572Toggles between remote GDB and DDB mode. 573In remote GDB mode, another machine is required that runs 574.Xr gdb 1 575using the remote debug feature, with a connection to the serial 576console port on the target machine. 577Currently only available on the 578i386 579architecture. 580.Pp 581.It Ic halt 582Halt the system. 583.Pp 584.It Ic kill Ar sig pid 585Send signal 586.Ar sig 587to process 588.Ar pid . 589The signal is acted on upon returning from the debugger. 590This command can be used to kill a process causing resource contention 591in the case of a hung system. 592See 593.Xr signal 3 594for a list of signals. 595Note that the arguments are reversed relative to 596.Xr kill 2 . 597.Pp 598.It Ic reboot 599.It Ic reset 600Hard reset the system. 601.Pp 602.It Ic help 603Print a short summary of the available commands and command 604abbreviations. 605.Pp 606.It Ic capture on 607.It Ic capture off 608.It Ic capture reset 609.It Ic capture status 610.Nm 611supports a basic output capture facility, which can be used to retrieve the 612results of debugging commands from userpsace using 613.Xr sysctl 2 . 614.Ic capture on 615enables output capture; 616.Ic capture off 617disables capture. 618.Ic capture reset 619will clear the capture buffer and disable capture. 620.Ic capture status 621will report current buffer use, buffer size, and disposition of output 622capture. 623.Pp 624Userspace processes may inspect and manage 625.Nm 626capture state using 627.Xr sysctl 8 : 628.Pp 629.Dv debug.ddb.capture.bufsize 630may be used to query or set the current capture buffer size. 631.Pp 632.Dv debug.ddb.capture.maxbufsize 633may be used to query the compile-time limit on the capture buffer size. 634.Pp 635.Dv debug.ddb.capture.bytes 636may be used to query the number of bytes of output currently in the capture 637buffer. 638.Pp 639.Dv debug.ddb.capture.data 640returns the contents of the buffer as a string to an appropriately privileged 641process. 642.Pp 643This facility is particularly useful in concert with the scripting and 644.Xr textdump 4 645facilities, allowing scripted debugging output to be captured and 646committed to disk as part of a textdump for later analysis. 647The contents of the capture buffer may also be inspected in a kernel core dump 648using 649.Xr kgdb 1 . 650.Pp 651.It Ic run 652.It Ic script 653.It Ic scripts 654.It Ic unscript 655Run, define, list, and delete scripts. 656See the 657.Sx SCRIPTING 658section for more information on the scripting facility. 659.Pp 660.It Ic textdump set 661.It Ic textdump status 662.It Ic textdump unset 663The 664.Ic textdump set 665command may be used to force the next kernel core dump to be a textdump 666rather than a traditional memory dump or minidump. 667.Ic textdump status 668reports whether a textdump has been scheduled. 669.Ic textdump unset 670cancels a request to perform a textdump as the next kernel core dump. 671More information may be found in 672.Xr textdump 4 . 673.El 674.Sh VARIABLES 675The debugger accesses registers and variables as 676.Li $ Ns Ar name . 677Register names are as in the 678.Dq Ic show Cm registers 679command. 680Some variables are suffixed with numbers, and may have some modifier 681following a colon immediately after the variable name. 682For example, register variables can have a 683.Cm u 684modifier to indicate user register (e.g., 685.Dq Li $eax:u ) . 686.Pp 687Built-in variables currently supported are: 688.Pp 689.Bl -tag -width ".Va tabstops" -compact 690.It Va radix 691Input and output radix. 692.It Va maxoff 693Addresses are printed as 694.Dq Ar symbol Ns Li + Ns Ar offset 695unless 696.Ar offset 697is greater than 698.Va maxoff . 699.It Va maxwidth 700The width of the displayed line. 701.It Va lines 702The number of lines. 703It is used by the built-in pager. 704.It Va tabstops 705Tab stop width. 706.It Va work Ns Ar xx 707Work variable; 708.Ar xx 709can take values from 0 to 31. 710.El 711.Sh EXPRESSIONS 712Most expression operators in C are supported except 713.Ql ~ , 714.Ql ^ , 715and unary 716.Ql & . 717Special rules in 718.Nm 719are: 720.Bl -tag -width ".No Identifiers" 721.It Identifiers 722The name of a symbol is translated to the value of the symbol, which 723is the address of the corresponding object. 724.Ql \&. 725and 726.Ql \&: 727can be used in the identifier. 728If supported by an object format dependent routine, 729.Sm off 730.Oo Ar filename : Oc Ar func : lineno , 731.Sm on 732.Oo Ar filename : Oc Ns Ar variable , 733and 734.Oo Ar filename : Oc Ns Ar lineno 735can be accepted as a symbol. 736.It Numbers 737Radix is determined by the first two letters: 738.Ql 0x : 739hex, 740.Ql 0o : 741octal, 742.Ql 0t : 743decimal; otherwise, follow current radix. 744.It Li \&. 745.Va dot 746.It Li + 747.Va next 748.It Li .. 749address of the start of the last line examined. 750Unlike 751.Va dot 752or 753.Va next , 754this is only changed by 755.Ic examine 756or 757.Ic write 758command. 759.It Li ' 760last address explicitly specified. 761.It Li $ Ns Ar variable 762Translated to the value of the specified variable. 763It may be followed by a 764.Ql \&: 765and modifiers as described above. 766.It Ar a Ns Li # Ns Ar b 767A binary operator which rounds up the left hand side to the next 768multiple of right hand side. 769.It Li * Ns Ar expr 770Indirection. 771It may be followed by a 772.Ql \&: 773and modifiers as described above. 774.El 775.Sh SCRIPTING 776.Nm 777supports a basic scripting facility to allow automating tasks or responses to 778specific events. 779Each script consists of a list of DDB commands to be executed sequentially, 780and is assigned a unique name. 781Certain script names have special meaning, and will be automatically run on 782various 783.Nm 784events if scripts by those names have been defined. 785.Pp 786The 787.Ic script 788command may be used to define a script by name. 789Scripts consist of a series of 790.Nm 791commands separated with the 792.Ic ; 793character. 794For example: 795.Bd -literal -offset indent 796script kdb.enter.panic=bt; show pcpu 797script lockinfo=show alllocks; show lockedvnods 798.Ed 799.Pp 800The 801.Ic scripts 802command lists currently defined scripts. 803.Pp 804The 805.Ic run 806command execute a script by name. 807For example: 808.Bd -literal -offset indent 809run lockinfo 810.Ed 811.Pp 812The 813.Ic unscript 814command may be used to delete a script by name. 815For example: 816.Bd -literal -offset indent 817unscript kdb.enter.panic 818.Ed 819.Pp 820These functions may also be performed from userspace using the 821.Xr ddb 8 822command. 823.Pp 824Certain scripts are run automatically, if defined, for specific 825.Nm 826events. 827The follow scripts are run when various events occur: 828.Bl -tag -width kdb.enter.powerfail 829.It Dv kdb.enter.acpi 830The kernel debugger was entered as a result of an 831.Xr acpi 4 832event. 833.It Dv kdb.enter.bootflags 834The kernel debugger was entered at boot as a result of the debugger boot 835flag being set. 836.It Dv kdb.enter.break 837The kernel debugger was entered as a result of a serial or console break. 838.It Dv kdb.enter.cam 839The kernel debugger was entered as a result of a 840.Xr CAM 4 841event. 842.It Dv kdb.enter.mac 843The kernel debugger was entered as a result of an assertion failure in the 844.Xr mac_test 4 845module of the 846TrustedBSD MAC Framework. 847.It Dv kdb.enter.ndis 848The kernel debugger was entered as a result of an 849.Xr ndis 4 850breakpoint event. 851.It Dv kdb.enter.netgraph 852The kernel debugger was entered as a result of a 853.Xr netgraph 4 854event. 855.It Dv kdb.enter.panic 856.Xr panic 9 857was called. 858.It Dv kdb.enter.powerfail 859The kernel debugger was entered as a result of a powerfail NMI on the sparc64 860platform. 861.It Dv kdb.enter.powerpc 862The kernel debugger was entered as a result of an unimplemented interrupt 863type on the powerpc platform. 864.It Dv kdb.enter.sysctl 865The kernel debugger was entered as a result of the 866.Dv debug.kdb.enter 867sysctl being set. 868.It Dv kdb.enter.trapsig 869The kernel debugger was entered as a result of a trapsig event on the sparc64 870or sun4v platform. 871.It Dv kdb.enter.unionfs 872The kernel debugger was entered as a result of an assertion failure in the 873union file system. 874.It Dv kdb.enter.unknown 875The kernel debugger was entered, but no reason has been set. 876.It Dv kdb.enter.vfslock 877The kernel debugger was entered as a result of a VFS lock violation. 878.It Dv kdb.enter.watchdog 879The kernel debugger was entered as a result of a watchdog firing. 880.It Dv kdb.enter.witness 881The kernel debugger was entered as a result of a 882.Xr witness 4 883violation. 884.El 885.Pp 886In the event that none of these scripts is found, 887.Nm 888will attempt to execute a default script: 889.Bl -tag -width kdb.enter.powerfail 890.It Dv kdb.enter.default 891The kernel debugger was entered, but a script exactly matching the reason for 892entering was not defined. 893This can be used as a catch-all to handle cases not specifically of interest; 894for example, 895.Dv kdb.enter.witness 896might be defined to have special handling, and 897.Dv kdb.enter.default 898might be defined to simply panic and reboot. 899.El 900.Sh HINTS 901On machines with an ISA expansion bus, a simple NMI generation card can be 902constructed by connecting a push button between the A01 and B01 (CHCHK# and 903GND) card fingers. 904Momentarily shorting these two fingers together may cause the bridge chipset to 905generate an NMI, which causes the kernel to pass control to 906.Nm . 907Some bridge chipsets do not generate a NMI on CHCHK#, so your mileage may vary. 908The NMI allows one to break into the debugger on a wedged machine to 909diagnose problems. 910Other bus' bridge chipsets may be able to generate NMI using bus specific 911methods. 912.Sh SEE ALSO 913.Xr gdb 1 , 914.Xr kgdb 1 , 915.Xr acpi 4 , 916.Xr CAM 4 , 917.Xr mac_test 4 , 918.Xr ndis 4 , 919.Xr netgraph 4 , 920.Xr textdump 4 , 921.Xr witness 4 , 922.Xr ddb 8 , 923.Xr sysctl 8 , 924.Xr panic 9 925.Sh HISTORY 926The 927.Nm 928debugger was developed for Mach, and ported to 929.Bx 386 0.1 . 930This manual page translated from 931.Xr man 7 932macros by 933.An Garrett Wollman . 934.Pp 935.An Robert N. M. Watson 936added support for 937.Nm 938output capture, 939.Xr textdump 4 940and scripting in 941.Fx 8.0 . 942