1.\" $NetBSD: ddb.4,v 1.66 2003/05/18 09:04:52 wiz Exp $ 2.\" 3.\" Copyright (c) 1997 - 2003 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Luke Mewburn 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the NetBSD 20.\" Foundation, Inc. and its contributors. 21.\" 4. Neither the name of The NetBSD Foundation nor the names of its 22.\" contributors may be used to endorse or promote products derived 23.\" from this software without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" 37.\" --- 38.\" This manual page was derived from a -man.old document which bore 39.\" the following copyright message: 40.\" --- 41.\" 42.\" Mach Operating System 43.\" Copyright (c) 1991,1990 Carnegie Mellon University 44.\" All Rights Reserved. 45.\" 46.\" Permission to use, copy, modify and distribute this software and its 47.\" documentation is hereby granted, provided that both the copyright 48.\" notice and this permission notice appear in all copies of the 49.\" software, derivative works or modified versions, and any portions 50.\" thereof, and that both notices appear in supporting documentation. 51.\" 52.\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 53.\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 54.\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 55.\" 56.\" Carnegie Mellon requests users of this software to return to 57.\" 58.\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 59.\" School of Computer Science 60.\" Carnegie Mellon University 61.\" Pittsburgh PA 15213-3890 62.\" 63.\" any improvements or extensions that they make and grant Carnegie Mellon 64.\" the rights to redistribute these changes. 65.\" 66.Dd May 15, 2003 67.Dt DDB 4 68.Os 69.Sh NAME 70.Nm ddb 71.Nd in-kernel debugger 72.Sh SYNOPSIS 73.Cd options DDB 74.Pp 75To enable history editing: 76.Cd options DDB_HISTORY_SIZE=integer 77.Pp 78To disable entering 79.\" XXX: hack; .Nm automatically introduces newline in SYNOPSIS 80.Ic ddb 81upon kernel panic: 82.Cd options DDB_ONPANIC=0 83.Sh DESCRIPTION 84.Nm 85is the in-kernel debugger. 86It may be entered at any time via a special key sequence, and 87optionally may be invoked when the kernel panics. 88.Sh ENTERING THE DEBUGGER 89Unless 90.Dv DDB_ONPANIC 91is set to 0, 92.Nm 93will be activated whenever the kernel would otherwise panic. 94.Pp 95.Nm 96may also be activated from the console. 97In general, sending a break on a serial console will activate 98.Nm . 99There are also key sequences for each port that will activate 100.Nm 101from the keyboard: 102.Bl -tag -offset indent -width "mvme68k" -compact 103.It alpha 104\*[Lt]Ctrl\*[Gt]-\*[Lt]Alt\*[Gt]-\*[Lt]Esc\*[Gt] on PC style keyboards. 105.It amiga 106\*[Lt]LAlt\*[Gt]-\*[Lt]LAmiga\*[Gt]-\*[Lt]F10\*[Gt] 107.It atari 108\*[Lt]Alt\*[Gt]-\*[Lt]LeftShift\*[Gt]-\*[Lt]F9\*[Gt] 109.It hp300 110\*[Lt]Shift\*[Gt]-\*[Lt]Reset\*[Gt] 111.It hpcmips 112\*[Lt]Ctrl\*[Gt]-\*[Lt]Alt\*[Gt]-\*[Lt]Esc\*[Gt] 113.It hpcsh 114\*[Lt]Ctrl\*[Gt]-\*[Lt]Alt\*[Gt]-\*[Lt]Esc\*[Gt] 115.It i386 116\*[Lt]Ctrl\*[Gt]-\*[Lt]Alt\*[Gt]-\*[Lt]Esc\*[Gt] 117.br 118\*[Lt]Break\*[Gt] on serial console. 119.It mac68k 120\*[Lt]Command\*[Gt]-\*[Lt]Power\*[Gt], or the Interrupt switch. 121.It macppc 122Some models: 123\*[Lt]Command\*[Gt]-\*[Lt]Option\*[Gt]-\*[Lt]Power\*[Gt] 124.It mvme68k 125Abort switch on CPU card. 126.It pmax 127\*[Lt]Do\*[Gt] on 128.Tn LK-201 129rcons console. 130.br 131\*[Lt]Break\*[Gt] on serial console. 132.It sparc 133\*[Lt]L1\*[Gt]-A, or \*[Lt]Stop\*[Gt]-A on a 134.Tn Sun 135keyboard. 136.br 137\*[Lt]Break\*[Gt] on serial console. 138.It sun3 139\*[Lt]L1\*[Gt]-A, or \*[Lt]Stop\*[Gt]-A on a 140.Tn Sun 141keyboard. 142.br 143\*[Lt]Break\*[Gt] on serial console. 144.It sun3x 145\*[Lt]L1\*[Gt]-A, or \*[Lt]Stop\*[Gt]-A on a 146.Tn Sun 147keyboard. 148.br 149\*[Lt]Break\*[Gt] on serial console. 150.It x68k 151Interrupt switch on the body. 152.El 153.Pp 154In addition, 155.Nm 156may be explicitly activated by the debugging code in the kernel 157if 158.Cm DDB 159is configured. 160.Sh COMMAND SYNTAX 161The general command syntax is: 162.Bd -ragged -offset indent 163.Ic command Ns Op Cm / Ns Ar modifier 164.Ar address 165.Op Cm , Ns Ar count 166.Ed 167.Pp 168The current memory location being edited is referred to as 169.Ar dot , 170and the next location is 171.Ar next . 172They are displayed as hexadecimal numbers. 173.Pp 174Commands that examine and/or modify memory update 175.Ar dot 176to the address of the last line examined or the last location 177modified, and set 178.Ar next 179to the next location to be examined or modified. 180Other commands don't change 181.Ar dot , 182and set 183.Ar next 184to be the same as 185.Ar dot . 186.Pp 187A blank line repeats the previous command from the address 188.Ar next 189with the previous 190.Cm count 191and no modifiers. 192Specifying 193.Cm address 194sets 195.Em dot 196to the address. 197If 198.Cm address 199is omitted, 200.Em dot 201is used. 202A missing 203.Cm count 204is taken to be 1 for printing commands, and infinity for stack traces. 205.Pp 206The syntax: 207.Bd -ragged -offset indent 208.Ic Cm , Ns Ar count 209.Ed 210.Pp 211repeats the previous command, just as a blank line does, but with 212the specified 213.Cm count . 214.Pp 215.Nm 216has a 217.Xr more 1 -like 218functionality; if a number of lines in a command's output exceeds the number 219defined in the 220.Va lines 221variable, then 222.Nm 223displays 224.Dq "--db more--" 225and waits for a response, which may be one of: 226.Bl -tag -offset indent -width "\*[Lt]return\*[Gt]" 227.It \*[Lt]return\*[Gt] 228one more line. 229.It \*[Lt]space\*[Gt] 230one more page. 231.It Ic q 232abort the current command, and return to the command input mode. 233.El 234.Pp 235If 236.Nm 237history editing is enabled (by defining the 238.D1 Cd options DDB_HISTORY_SIZE=num 239kernel option), then a history of the last 240.Cm num 241commands is kept. 242The history can be manipulated with the following key sequences: 243.Bl -tag -offset indent -width "\*[Lt]Ctrl\*[Gt]-P" 244.It \*[Lt]Ctrl\*[Gt]-P 245retrieve previous command in history (if any). 246.It \*[Lt]Ctrl\*[Gt]-N 247retrieve next command in history (if any). 248.El 249.Sh COMMANDS 250.Nm 251supports the following commands: 252.Bl -tag -width 5n 253.It Xo 254.Sm off 255.Ic ! 256.Ar address 257.Oo 258.Cm ( Ar expression 259.Op Ar ,... 260.Cm ) 261.Oc 262.Sm on 263.Xc 264A synonym for 265.Ic call . 266.It Xo 267.Ic break Ns Op Cm /u 268.Ar address Ns Op Cm , Ns Ar count 269.Xc 270Set a breakpoint at 271.Ar address . 272If 273.Ar count 274is supplied, continues 275.Pq Ar count Ns -1 276times before stopping at the breakpoint. 277If the breakpoint is set, a breakpoint number is printed with 278.Sq \&# . 279This number can be used to 280.Ic delete 281the breakpoint, or to add 282conditions to it. 283.Pp 284If 285.Cm /u 286is specified, 287set a breakpoint at a user-space address. 288Without 289.Cm /u , 290.Ar address 291is considered to be in the kernel-space, and an address in the wrong 292space will be rejected, and an error message will be emitted. 293This modifier may only be used if it is supported by machine dependent 294routines. 295.Pp 296Warning: if a user text is shadowed by a normal user-space debugger, 297user-space breakpoints may not work correctly. 298Setting a breakpoint at the low-level code paths may also cause 299strange behavior. 300.It Xo 301.Ic bt Ns Op Cm /u 302.Sm off 303.Op Ar frame-address 304.Op Cm , Ar count 305.Sm on 306.Xc 307A synonym for 308.Ic trace . 309.It Xo 310.Ic bt/t 311.Sm off 312.Op Ar pid 313.Op Cm , Ar count 314.Sm on 315.Xc 316A synonym for 317.Ic trace . 318.It Xo 319.Ic call 320.Sm off 321.Ar address 322.Oo 323.Cm ( Ar expression 324.Op Ar ,... 325.Cm ) 326.Oc 327.Sm on 328.Xc 329Call the function specified by 330.Ar address 331with the argument(s) listed in parentheses. 332Parentheses may be omitted if the function takes no arguments. 333The number of arguments is currently limited to 10. 334.It Ic continue Ns Op Cm /c 335Continue execution until a breakpoint or watchpoint. 336If 337.Cm /c 338is specified, count instructions while executing. 339Some machines (e.g., pmax) also count loads and stores. 340.Pp 341Warning: when counting, the debugger is really silently 342single-stepping. 343This means that single-stepping on low-level may cause strange 344behavior. 345.It Xo 346.Ic delete 347.Ar "address" | 348.Cm # Ns Ar number 349.Xc 350Delete a breakpoint. 351The target breakpoint may be specified by 352.Ar address , 353as per 354.Ic break , 355or by the breakpoint number returned by 356.Ic break 357if it's prefixed with 358.Sq Cm \&# . 359.It Xo 360.Ic dmesg 361.Xc 362Prints the contents of the kernel message buffer. 363.It Xo 364.Ic dwatch 365.Ar address 366.Xc 367Delete the watchpoint at 368.Ar address 369that was previously set with 370.Ic watch 371command. 372.It Xo 373.Ic examine Ns Op Cm / Ns Ar modifier 374.Ar address Ns Op Cm , Ns Ar count 375.Xc 376Display the address locations according to the format in 377.Ar modifier . 378Multiple modifier formats display multiple locations. 379If 380.Ar modifier 381isn't specified, the modifier from the last use of 382.Ic examine 383is used. 384.Pp 385The valid format characters for 386.Ar modifier 387are: 388.Bl -tag -offset indent -width 2n -compact 389.It Cm b 390examine bytes (8 bits). 391.It Cm h 392examine half-words (16 bits). 393.It Cm l 394examine words (legacy 395.Dq long , 39632 bits). 397.It Cm L 398examine long words (implementation dependent) 399.It Cm a 400print the location being examined. 401.It Cm A 402print the location with a line number if possible. 403.It Cm x 404display in unsigned hex. 405.It Cm z 406display in signed hex. 407.It Cm o 408display in unsigned octal. 409.It Cm d 410display in signed decimal. 411.It Cm u 412display in unsigned decimal. 413.It Cm r 414display in current radix, signed. 415.It Cm c 416display low 8 bits as a character. 417Non-printing characters as displayed as an octal escape code 418(e.g., 419.Sq \e000 ) . 420.It Cm s 421display the NUL terminated string at the location. 422Non-printing characters are displayed as octal escapes. 423.It Cm m 424display in unsigned hex with a character dump at the end of each line. 425The location is displayed as hex at the beginning of each line. 426.It Cm i 427display as a machine instruction. 428.It Cm I 429display as a machine instruction, with possible alternative formats 430depending upon the machine: 431.Bl -tag -offset indent -width "sparc" -compact 432.It alpha 433print register operands 434.It m68k 435use Motorola syntax 436.It pc532 437print instruction bytes in hex 438.It vax 439don't assume that each external label is a procedure entry mask 440.El 441.El 442.It Xo 443.Ic kill 444.Ar pid Ns Op Cm , Ns Ar signal_number 445.Xc 446Send a signal to the process specified by the 447.Ar pid . 448Note that 449.Ar pid 450is interpreted using the current radix (see 451.Cm trace/t 452command for details). 453If 454.Ar signal_number 455isn't specified, the SIGTERM signal is sent. 456.It Ic match Ns Op Cm /p 457A synonym for 458.Ic next . 459.It Ic next Ns Op Cm /p 460Stop at the matching return instruction. 461If 462.Cm /p 463is specified, print the call nesting depth and the 464cumulative instruction count at each call or return. 465Otherwise, only print when the matching return is hit. 466.It Xo 467.Ic print Ns Op Cm /axzodurc 468.Ar address Op Ar address ... 469.Xc 470Print addresses 471.Ar address 472according to the modifier character, as per 473.Ic examine . 474Valid modifiers are: 475.Cm /a , 476.Cm /x , 477.Cm /z , 478.Cm /o , 479.Cm /d , 480.Cm /u , 481.Cm /r , 482and 483.Cm /c 484(as per 485.Ic examine ) . 486If no modifier is specified, the most recent one specified is used. 487.Ar address 488may be a string, and is printed 489.Dq as-is . 490For example: 491.Bd -literal -offset indent 492print/x "eax = " $eax "\enecx = " $ecx "\en" 493.Ed 494.Pp 495will produce: 496.Bd -literal -offset indent 497eax = xxxxxx 498ecx = yyyyyy 499.Ed 500.It Xo 501.Sm off 502.Ic ps 503.Op Cm /a 504.Op Cm /n 505.Op Cm /w 506.Sm on 507.Xc 508A synonym for 509.Ic "show all procs" . 510.It Ic reboot Op Ar flags 511Reboot, using the optionally supplied boot 512.Ar flags . 513.Pp 514Note: Limitations of the command line interface preclude 515specification of a boot string. 516.It Xo 517.Ic search Ns Op Cm /bhl 518.Ar address 519.Ar value 520.Op Ar mask 521.Op Cm , Ns Ar count 522.Xc 523Search memory from 524.Ar address 525for 526.Ar value . 527The unit size is specified with a modifier character, as per 528.Ic examine . 529Valid modifiers are: 530.Cm /b , 531.Cm /h , 532and 533.Cm /l . 534If no modifier is specified, 535.Cm /l 536is used. 537.Pp 538This command might fail in interesting ways if it doesn't find 539.Ar value . 540This is because 541.Nm 542doesn't always recover from touching bad memory. 543The optional 544.Ar count 545limits the search. 546.It Xo 547.Ic set 548.Cm $ Ns Ar variable 549.Op Cm = 550.Ar expression 551.Xc 552Set the named variable or register to the value of 553.Ar expression . 554Valid variable names are described in 555.Sx VARIABLES . 556.It Xo 557.Sm off 558.Ic "show\ all\ procs" 559.Op Cm /a 560.Op Cm /n 561.Op Cm /w 562.Sm on 563.Xc 564Display all process information. 565Valid modifiers: 566.Bl -tag -width 3n 567.It Cm /n 568show process information in a 569.Xr ps 1 570style format (this is the default). 571Information printed includes: process ID, parent process ID, 572process group, UID, process status, process flags, process 573command name, and process wait channel message. 574.It Cm /a 575show the kernel virtual addresses of each process' 576proc structure, u-area, and vmspace structure. 577The vmspace address is also the address of the process' 578vm_map structure, and can be used in the 579.Ic "show map" 580command. 581.It Cm /w 582show each process' PID, command, system call emulation, wait channel 583address, and wait channel message. 584.El 585.It Ic "show breaks" 586Display all breakpoints. 587.It Xo 588.Ic "show buf" Ns Op Cm /f 589.Ar address 590.Xc 591Print the struct buf at 592.Ar address . 593The 594.Cm /f 595does nothing at this time. 596.It Xo 597.Ic "show event" Ns Op Cm /f 598.Xc 599Print all the non-zero 600.Xr evcnt 9 601event counters. 602If 603.Cm /f 604is specified, all event counters with a count of zero are printed as well. 605.It Xo 606.Ic "show map" Ns Op Cm /f 607.Ar address 608.Xc 609Print the vm_map at 610.Ar address . 611If 612.Cm /f 613is specified, the complete map is printed. 614.It Ic "show ncache" Ar address 615Dump the namecache list associated with vnode at 616.Ar address . 617.It Xo 618.Ic "show object" Ns Op Cm /f 619.Ar address 620.Xc 621Print the vm_object at 622.Ar address . 623If 624.Cm /f 625is specified, the complete object is printed. 626.It Xo 627.Ic "show page" Ns Op Cm /f 628.Ar address 629.Xc 630Print the vm_page at 631.Ar address . 632If 633.Cm /f 634is specified, the complete page is printed. 635.It Xo 636.Ic "show pool" Ns Op Cm /clp 637.Ar address 638.Xc 639Print the pool at 640.Ar address . 641Valid modifiers: 642.Bl -tag -width 4n -compact 643.It Cm /c 644Print the cachelist and its statistics for this pool. 645.It Cm /l 646Print the log entries for this pool. 647.It Cm /p 648Print the pagelist for this pool. 649.El 650.It Ic "show registers" Ns Op Cm /u 651Display the register set. 652If 653.Cm /u 654is specified, display user registers instead of kernel registers 655or the currently save one. 656.Pp 657Warning: support for 658.Cm /u 659is machine dependent. 660If not supported, incorrect information will be displayed. 661.It Ic "show uvmexp" 662Print a selection of UVM counters and statistics. 663.It Xo 664.Ic "show vnode" Ns Op Cm /f 665.Ar address 666.Xc 667Print the vnode at 668.Ar address . 669If 670.Cm /f 671is specified, the complete vnode is printed. 672.It Ic "show watches" 673Display all watchpoints. 674.It Xo 675.Ic sifting Ns Op Cm /F 676.Ar string 677.Xc 678Search the symbol tables for all symbols of which 679.Ar string 680is a substring, and display them. 681If 682.Cm /F 683is specified, a character is displayed immediately after each symbol 684name indicating the type of symbol. 685.Pp 686For 687.Ns Xr a.out 5 -format 688symbol tables, 689absolute symbols display 690.Sy @ , 691text segment symbols display 692.Sy * , 693data segment symbols display 694.Sy + , 695.Tn BSS 696segment symbols display 697.Sy - , 698and filename symbols display 699.Sy / . 700For 701.Tn ELF Ns -format 702symbol tables, 703object symbols display 704.Sy + , 705function symbols display 706.Sy * , 707section symbols display 708.Sy \*[Am] , 709and file symbols display 710.Sy / . 711.Pp 712To sift for a string beginning with a number, escape the first 713character with a backslash as: 714.Bd -literal -offset indent 715sifting \\386 716.Ed 717.It Xo 718.Ic step Ns Op Cm /p 719.Op Cm , Ns Ar count 720.Xc 721Single-step 722.Ar count 723times. 724If 725.Cm /p 726is specified, print each instruction at each step. 727Otherwise, only print the last instruction. 728.Pp 729Warning: depending on the machine type, it may not be possible 730to single-step through some low-level code paths or user-space 731code. 732On machines with software-emulated single-stepping (e.g., pmax), 733stepping through code executed by interrupt handlers will probably 734do the wrong thing. 735.It Ic sync 736Force a crash dump, and then reboot. 737.It Xo 738.Ic trace 739.Ic Ns Op Cm /u Ns Op Cm l 740.Sm off 741.Op Ar frame-address 742.Op Cm , Ar count 743.Sm on 744.Xc 745Stack trace from 746.Ar frame-address . 747If 748.Cm /u 749is specified, trace user-space, otherwise trace kernel-space. 750.Ar count 751is the number of frames to be traced. 752If 753.Ar count 754is omitted, all frames are printed. 755If 756.Cm /l 757is specified, the trace is printed and also stored in the kernel 758message buffer. 759.Pp 760Warning: user-space stack trace is valid only if the machine dependent 761code supports it. 762.It Xo 763.Ic trace/t Ns Op Cm l 764.Sm off 765.Op Ar pid 766.Op Cm , Ar count 767.Sm on 768.Xc 769Stack trace by 770.Dq thread 771(process, on 772.Nx ) 773rather than by stack frame address. 774Note that 775.Ar pid 776is interpreted using the current radix, whilst 777.Ic ps 778displays pids in decimal; prefix 779.Ar pid 780with 781.Sq 0t 782to force it to be interpreted as decimal (see 783.Sx VARIABLES 784section for radix). 785If 786.Cm /l 787is specified, the trace is printed and also stored in the kernel 788message buffer. 789.Pp 790Warning: trace by pid is valid only if the machine dependent code 791supports it. 792.It Ic until Ns Op Cm /p 793Stop at the next call or return instruction. 794If 795.Cm /p 796is specified, print the call nesting depth and the 797cumulative instruction count at each call or return. 798Otherwise, only print when the matching return is hit. 799.It Xo 800.Ic watch 801.Sm off 802.Ar address 803.Op Cm , Ar size 804.Sm on 805.Xc 806Set a watchpoint for a region. 807Execution stops when an attempt to modify the region occurs. 808.Ar size 809defaults to 4. 810.Pp 811If you specify a wrong space address, the request is 812rejected with an error message. 813.Pp 814Warning: attempts to watch wired kernel memory may cause 815an unrecoverable error in some systems such as i386. 816Watchpoints on user addresses work the best. 817.It Xo 818.Ic write Ns Op Cm /bhl 819.Ar address 820.Ar expression Op Ar expression ... 821.Xc 822Write the 823.Ar expression Ns s 824at succeeding locations. 825The unit size is specified with a modifier character, as per 826.Ic examine . 827Valid modifiers are: 828.Cm /b , 829.Cm /h , 830and 831.Cm /l . 832If no modifier is specified, 833.Cm /l 834is used. 835.Pp 836Warning: since there is no delimiter between 837.Ar expression Ns s , 838strange things may occur. 839It's best to enclose each 840.Ar expression 841in parentheses. 842.It Xo 843.Ic x Ns Op Cm / Ns Ar modifier 844.Ar address Ns Op Cm , Ns Ar count 845.Xc 846A synonym for 847.Ic examine . 848.\" XXX - these commands aren't implemented; jhawk 19 May 2000 849.\" .It Ic xf 850.\" Examine forward. 851.\" .Ic xf 852.\" re-executes the most recent 853.\" .Ic execute 854.\" command with the same parameters except that 855.\" .Ar address 856.\" is set to 857.\" .Ar next . 858.\" .It Ic xb 859.\" Examine backward. 860.\" .Ic xb 861.\" re-executes the most recent 862.\" .Ic execute 863.\" command with the same parameters, except that 864.\" .Ar address 865.\" is set to the last start address minus its size. 866.El 867.Sh MACHINE-SPECIFIC COMMANDS 868The "glue" code that hooks 869.Nm 870into the 871.Nx 872kernel for any given port can also add machine specific commands 873to the 874.Nm 875command parser. 876All of these commands are preceded by the command word 877.Em machine 878to indicate that they are part of the machine-specific command 879set (e.g. 880.Ic "machine reboot" ) . 881Some of these commands are: 882.Ss ALPHA 883.Bl -tag -width "intrchain" -compact 884.It Ic halt 885Call the PROM monitor to halt the CPU. 886.It Ic reboot 887Call the PROM monitor to reboot the CPU. 888.El 889.Ss ARM32 890.Bl -tag -width "intrchain" -compact 891.It Ic vmstat 892Equivalent to 893.Xr vmstat 1 894output with "-s" option (statistics). 895.It Ic vnode 896Print out a description of a vnode. 897.It Ic intrchain 898Print the list of IRQ handlers. 899.It Ic panic 900Print the current "panic" string. 901.It Ic frame 902Given a trap frame address, print out the trap frame. 903.El 904.Ss MIPS 905.Bl -tag -width "intrchain" -compact 906.It Ic kvtop 907Print the physical address for a given kernel virtual address. 908.It Ic tlb 909Print out the Translation Lookaside Buffer (TLB). 910Only works in 911.Nx 912kernels compiled with 913.Dv DEBUG 914option. 915.El 916.Ss SH3 917.Bl -tag -width "intrchain" -compact 918.It Ic tlb 919Print TLB entries 920.It Ic cache 921Print cache entries 922.It Ic frame 923Print switch frame and trap frames. 924.It Ic stack 925Print kernel stack usage. 926Only works in NetBSD kernels compiled with the KSTACK_DEBUG option. 927.El 928.Ss SPARC 929.Bl -tag -width "intrchain" -compact 930.It Ic prom 931Exit to the Sun PROM monitor. 932.El 933.Ss SPARC64 934.Bl -tag -width "intrchain" -compact 935.It Ic buf 936Print buffer information. 937.It Ic ctx 938Print process context information. 939.It Ic dtlb 940Print data translation look-aside buffer context information. 941.It Ic dtsb 942Display data translation storage buffer information. 943.It Ic kmap 944Display information about the listed mapping in the kernel pmap. 945Use the 946.Dq f 947modifier to get a full listing. 948.It Ic pcb 949Display information about the 950.Dq struct pcb 951listed. 952.It Ic pctx 953Attempt to change process context. 954.It Ic page 955Display the pointer to the 956.Dq struct vm_page 957for this physical address. 958.It Ic phys 959Display physical memory. 960.It Ic pmap 961Display the pmap. 962Use the 963.Dq f 964modifier to get a fuller listing. 965.It Ic proc 966Display some information about the process pointed to, or curproc. 967.It Ic prom 968Enter the OFW PROM. 969.It Ic pv 970Display the 971.Dq struct pv_entry 972pointed to. 973.It Ic stack 974Dump the window stack. 975Use the 976.Dq u 977modifier to get userland information. 978.It Ic tf 979Display full trap frame state. 980This is most useful for inclusion with bug reports. 981.It Ic ts 982Display trap state. 983.It Ic traptrace 984Display or set trap trace information. 985Use the 986.Dq r 987and 988.Dq f 989modifiers to get reversed and full information, respectively. 990.It Ic uvmdump 991Dumps the UVM histories. 992.It Ic watch 993Set or clear a physical or virtual hardware watchpoint. 994Pass the address to be watched, or 995.Dq 0 996to clear the watchpoint. 997Append 998.Dq p 999to the watch point to use the physical watchpoint registers. 1000.It Ic window 1001Print register window information about given address. 1002.El 1003.Ss SUN3 and SUN3X 1004.Bl -tag -width "intrchain" -compact 1005.It Ic abort 1006Drop into monitor via abort (allows continue). 1007.It Ic halt 1008Exit to Sun PROM monitor as in 1009.Xr halt 8 . 1010.It Ic reboot 1011Reboot the machine as in 1012.Xr reboot 8 . 1013.It Ic pgmap 1014Given an address, print the address, segment map, page map, and 1015Page Table Entry (PTE). 1016.El 1017.Sh VARIABLES 1018.Nm 1019accesses registers and variables as 1020.Cm $ Ns Ar name . 1021Register names are as per the 1022.Ic "show registers" 1023command. 1024Some variables are suffixed with numbers, and may have a modifier 1025following a colon immediately after the variable name. 1026For example, register variables may have a 1027.Sq u 1028modifier to indicate user register 1029(e.g., 1030.Li "$eax:u" ) . 1031.Pp 1032Built-in variables currently supported are: 1033.Bl -tag -offset indent -width "maxwidth" -compact 1034.It Va lines 1035The number of lines. 1036This is used by the 1037.Ic more 1038feature. 1039.It Va maxoff 1040Addresses are printed as 1041.Li 'symbol'+offset 1042unless 1043.Li offset 1044is greater than 1045.Va maxoff . 1046.It Va maxwidth 1047The width of the displayed line. 1048.It Va onpanic 1049If non-zero (the default), 1050.Nm 1051will be invoked when the kernel panics. 1052If the kernel configuration option 1053.D1 Cd options DDB_ONPANIC=0 1054is used, 1055.Va onpanic 1056will be initialized to off. 1057.It Va fromconsole 1058If non-zero (the default), 1059the kernel allows to enter 1060.Nm 1061from the console (by break signal or special key sequence). 1062If the kernel configuration option 1063.D1 Cd options DDB_FROMCONSOLE=0 1064is used, 1065.Va fromconsole 1066will be initialized to off. 1067.It Va radix 1068Input and output radix. 1069.It Va tabstops 1070Tab stop width. 1071.\" .It Va work Ns Sy xx 1072.\" Temporary work variable. 1073.\" .Sq Sy xx 1074.\" is between 0 and 31. 1075.El 1076.Pp 1077All built-in variables are accessible via 1078.Xr sysctl 3 . 1079.Sh EXPRESSIONS 1080Almost all expression operators in C are supported, except 1081.Sq \&~ , 1082.Sq \&^ , 1083and unary 1084.Sq \&\*[Am] . 1085Special rules in 1086.Nm 1087are: 1088.Bl -tag -offset indent -width "identifier" 1089.It Ar identifier 1090name of a symbol. 1091It is translated to the address (or value) of it. 1092.Sq \&. 1093and 1094.Sq \&: 1095can be used in the identifier. 1096If supported by an object format dependent routine, 1097.Sm off 1098.Xo 1099.Oo Ar filename : Oc 1100.Ar function 1101.Oo : Ar "line number" Oc , 1102.Xc 1103.Xo 1104.Oo Ar filename : Oc 1105.Ar variable , 1106.Xc 1107and 1108.Xo 1109.Ar filename 1110.Oo : Ar "line number" Oc , 1111.Xc 1112.Sm on 1113can be accepted as a symbol. 1114The symbol may be prefixed with 1115.Ar symbol_table_name : : 1116(e.g., 1117.Li emulator::mach_msg_trap ) 1118to specify other than kernel symbols. 1119.It Ar number 1120number. 1121Radix is determined by the first two characters: 1122.Sq 0x 1123- hex, 1124.Sq 0o 1125- octal, 1126.Sq 0t 1127- decimal, 1128otherwise follow current radix. 1129.It Cm . 1130.Ar dot 1131.It Cm + 1132.Ar next 1133.It Cm .. 1134address of the start of the last line examined. 1135Unlike 1136.Ar dot 1137or 1138.Ar next , 1139this is only changed by the 1140.Ic examine 1141or 1142.Ic write 1143commands. 1144.It Cm \&" 1145last address explicitly specified. 1146.It Cm $ Ns Ar name 1147register name or variable. 1148It is translated to the value of it. 1149It may be followed by a 1150.Sq \&: 1151and modifiers as described above. 1152.It Cm a 1153multiple of right-hand side. 1154.It Cm * Ns Ar expr 1155expression indirection. 1156It may be followed by a 1157.Sq \&: 1158and modifiers as described above. 1159.El 1160.Sh SEE ALSO 1161.Xr options 4 , 1162.Xr sysctl 8 1163.Sh HISTORY 1164The 1165.Nm 1166kernel debugger was written as part of the MACH project at 1167Carnegie-Mellon University. 1168