1.\" $OpenBSD: ddb.4,v 1.73 2011/11/07 20:29:56 miod Exp $ 2.\" $NetBSD: ddb.4,v 1.5 1994/11/30 16:22:09 jtc Exp $ 3.\" 4.\" Mach Operating System 5.\" Copyright (c) 1991,1990 Carnegie Mellon University 6.\" All Rights Reserved. 7.\" 8.\" Permission to use, copy, modify and distribute this software and its 9.\" documentation is hereby granted, provided that both the copyright 10.\" notice and this permission notice appear in all copies of the 11.\" software, derivative works or modified versions, and any portions 12.\" thereof, and that both notices appear in supporting documentation. 13.\" 14.\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 15.\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 16.\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 17.\" 18.\" Carnegie Mellon requests users of this software to return to 19.\" 20.\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 21.\" School of Computer Science 22.\" Carnegie Mellon University 23.\" Pittsburgh PA 15213-3890 24.\" 25.\" any improvements or extensions that they make and grant Carnegie Mellon 26.\" the rights to redistribute these changes. 27.\" 28.Dd $Mdocdate: November 7 2011 $ 29.Dt DDB 4 30.Os 31.Sh NAME 32.Nm ddb 33.Nd kernel debugger 34.Sh DESCRIPTION 35The 36.Nm 37debugger provides a means for debugging the kernel, 38and analysing the kernel after a system crash ("panic"), with a 39.Xr gdb 1 Ns \&-like 40syntax. 41.Pp 42.Nm 43is invoked upon a kernel panic when the 44.Xr sysctl 8 45.Va ddb.panic 46is set to 1. 47It may be invoked from the console when the sysctl 48.Va ddb.console 49is set to 1, using any of the following methods: 50.Bl -dash -offset 3n 51.It 52Using the key sequence 53.Li Ctrl-Alt-Esc . 54.It 55Sending a 56.Dv BREAK 57when using a serial console. 58.It 59Writing to the sysctl 60.Va ddb.trigger . 61.It 62For i386 and amd64 architectures, 63using the key sequence 64.Li Ctrl-Alt-Delete 65when the sysctl 66.Va machdep.kbdreset 67is set to 2. 68.El 69.Pp 70.Nm 71prompts for commands on the console with: 72.Pp 73.Dl ddb\*(Gt 74.Pp 75The general syntax of a 76.Nm 77command is: 78.Bd -ragged -offset indent 79.Ar command 80.Oo Ic / Ns Ar modifiers Oc " " 81.Oo Ar address Oc Ns 82.Op Ic \&, Ns Ar count 83.Ed 84.Pp 85To save typing, 86.Nm 87makes use of a context inferred from previous commands. 88In this context, 89the current location is called 90.Va dot . 91.\" The 92.\" .Va dot 93.\" is displayed with 94.\" a hexadecimal format at a prompt. 95The 96.Ic examine , 97.Ic search , 98.Ic show struct , 99and 100.Ic write 101commands update 102.Va dot 103to be that of the last address 104examined or the last location modified, and 105have intuitive effects on 106.Va next 107and 108.Va prev . 109All the other commands do not change 110.Va dot , 111and set 112.Va next 113to be the same. 114(See 115.Sx VARIABLES . ) 116.Pp 117.\" Specifying 118.\" .Ar address 119.\" in a command sets 120.\" .Va dot . 121An expression can be used in place of 122.Ar address 123(see 124.Sx EXPRESSIONS ) . 125Omitting 126.Ar address 127in a command uses the last value of 128.Va dot . 129A missing 130.Ar count 131is taken to be 1 for printing commands or \*(If 132for stack traces. 133Entering a blank line causes the last command to be repeated using 134.Va next 135in place of 136.Ar address , 137a 138.Ar count 139of 1, and no modifiers. 140.Pp 141.Nm 142has a feature like 143.Xr more 1 144for the output. 145If the number of lines output in response to one command exceeds the number 146set in the 147.Va $lines 148variable, it displays the message 149.Ql "--db_more--" 150and waits for a response. 151.Pp 152The valid responses are: 153.Pp 154.Bl -tag -width 10n -offset indent -compact 155.It Aq Ic space 156One more page. 157.It Aq Ic return 158One more line. 159.It Ic q 160Abort the current command, and return to the command input mode. 161.El 162.Pp 163The following command line editing keys are provided: 164.Pp 165.Bl -tag -width 10n -offset indent -compact 166.It Ic ^b 167back one character 168.It Ic ^f 169forward one character 170.It Ic ^a 171beginning of line 172.It Ic ^e 173end of line 174.It Ic ^w 175erase word back 176.It Ic ^h | Aq Ic del 177erase previous character 178.It Ic ^d 179erase next character 180.It Ic ^k 181delete to end of line 182.It Ic ^u 183delete line 184.It Ic ^p 185previous in command history 186.It Ic ^n 187next in command history 188.It Ic ^r 189redraw line 190.It Ic ^t 191exchange the two characters to the left of the cursor 192.El 193.Sh COMMANDS 194The following commands may be typed at the 195.Ql ddb\*(Gt 196prompt. 197Some commands consist of more than one word, and if only the first word 198or words are entered, the possible alternatives to complete the command 199are displayed and no other action is performed. 200.Bl -tag -width 10n 201.\" -------------------- 202.It Ic help 203List the available commands. 204.\" -------------------- 205.It Xo 206.Oo Ic e Oc Ns 207.Ic x Ns Op Ic amine 208.Op Cm /bhlqaAxzodurcsmiI 209.Op Ar addr Ns 210.Op Ic \&, Ns Ar count 211.Xc 212Display the contents at address 213.Ar addr 214according to the formats in the modifier. 215If no format is specified, the last formats specified for this command 216are used. 217.Pp 218The format characters are: 219.Pp 220.Bl -tag -width 4n -compact 221.It Cm /b 222look at by bytes (8 bits) 223.It Cm /h 224look at by half words (16 bits) 225.It Cm /l 226look at by long words (32 bits) (default) 227.It Cm /q 228look at by long longs (64 bits) (only available on 64-bit platforms) 229.It Cm /a 230print the location being displayed 231.It Cm /A 232print the location with a line number if possible 233.It Cm /x 234display in unsigned hex 235.It Cm /z 236display in signed hex 237.It Cm /o 238display in unsigned octal 239.It Cm /d 240display in signed decimal 241.It Cm /u 242display in unsigned decimal 243.It Cm /r 244display in current radix, signed 245.It Cm /c 246display low 8 bits as a character. 247Non-printing characters are displayed as an octal escape code (e.g., '\e000'). 248.It Cm /s 249display the null-terminated string at the location. 250Non-printing characters are displayed as octal escapes. 251.It Cm /m 252display in unsigned hex with character dump at the end of each line. 253The location is also displayed in hex at the beginning of each line. 254.It Cm /i 255display as an instruction 256.It Cm /I 257display as an alternate format instruction depending on the 258machine: 259.Pp 260.Bl -tag -width powerpc_ -compact 261.It alpha 262Print affected register contents for every instruction. 263.It amd64 , 264.It i386 265Do not skip padding to the next long word boundary for unconditional jumps. 266.It m68k 267Use 268.Tn Motorola 269assembly syntax. 270.It m88k 271Decode instructions for the opposite CPU model (e.g. m88110 when running on an 272m88100 processor). 273.It vax 274Don't assume that each external label is a procedure entry mask. 275.El 276.El 277.Pp 278The value of 279.Va next 280is set to the 281.Ar addr 282plus the size of the data examined. 283.\" -------------------- 284.It Xo 285.Ic print 286.Op Cm /axzodurc 287.Op Ar addr Op Ar addr ... 288.Xc 289Print each 290.Ar addr 291according to the modifier character. 292The valid modifiers are a subset of those from the 293.Ic examine 294command, and act as described there. 295If no modifier is specified, the last one specified in a 296previous use of 297.Ic print 298is used. 299The 300.Ar addr 301argument 302can be a string, and it is printed as a literal. 303.Pp 304For example, 305.Bd -literal -offset indent 306print/x "eax = " $eax "\enecx = " $ecx "\en" 307.Ed 308.Pp 309will print something like this: 310.Bd -literal -offset indent 311eax = xxxxxx 312ecx = yyyyyy 313.Ed 314.\" -------------------- 315.\" .It Xo Ic w Ns Op Cm /bhl 316.\" .Op Ar addr 317.\" .Ar expr Op expr ... 318.\" .Xc 319.It Xo 320.Ic w Ns Op Ic rite 321.Op Cm /bhl 322.Op Ar addr 323.Ar expr Op Ar expr ... 324.Xc 325Write the value of each 326.Ar expr 327expression at succeeding locations start at 328.Ar addr . 329The write unit size can be specified using one of the modifiers: 330.Pp 331.Bl -tag -width 4n -offset indent -compact 332.It Cm /b 333byte (8 bits) 334.It Cm /h 335half word (16 bits) 336.It Cm /l 337long word (32 bits) (default) 338.El 339.Pp 340The value of 341.Va next 342is set to 343.Ar addr 344plus the size of values written. 345.Pp 346.Sy Warning: 347since there is no delimiter between expressions, the 348command may not parse as you expect. 349It is best to enclose each expression in parentheses. 350.\" -------------------- 351.It Xo Ic set 352.Ic $ Ns Ar name 353.Op Ic = 354.Ar expr 355.Xc 356Set the named variable or register with the value of 357.Ar expr . 358Valid variable names are described below. 359.It Ic boot Ar how 360Reboot the machine depending on 361.Ar how : 362.Pp 363.Bl -tag -width "boot poweroff" -compact 364.It Ic boot sync 365Sync disks and reboot. 366.It Ic boot crash 367Dump core and reboot. 368.It Ic boot dump 369Sync disks, dump core and reboot. 370.It Ic boot halt 371Just halt. 372.It Ic boot reboot 373Just reboot. 374.It Ic boot poweroff 375Power down the machine whenever possible; if it fails, just halt. 376.El 377.\" -------------------- 378.It Xo 379.Ic break 380.Op Ar addr Ns 381.Op Ic \&, Ns Ar count 382.Xc 383Set a break point at 384.Ar addr . 385If 386.Ar count 387is supplied, 388.Nm 389allows the breakpoint to be silently hit 390.Ar ( count No \- 1 ) 391times before stopping at the 392break point. 393.Pp 394If the break point is successfully set, a break point number is 395displayed, in the form 396.Ic # Ns Ar number . 397This can later be used in deleting the break point 398or for adding conditions to it. 399.\" -------------------- 400.\" .It Xo Ic d 401.\" .Op Ar addr | Ic # Ns Ar number 402.\" .Xc 403.It Xo 404.Ic d Ns Op Ic elete 405.Op Ar addr | Ic # Ns Ar number 406.Xc 407Delete the break point set with the 408.Ic break 409command. 410.\" -------------------- 411.\" .It Xo Ic s Ns Op Cm /p 412.\" .Op Ic \&, Ns Ar count 413.\" .Xc 414.It Xo 415.Ic s Ns Op Ic tep 416.Op Cm /p 417.Op Ic \&, Ns Ar count 418.Xc 419Single step 420.Ar count 421times. 422If the 423.Cm /p 424modifier is specified, print each instruction at each step. 425Otherwise, only print the last instruction. 426.Pp 427.Sy Warning: 428depending on machine type, it may not be possible to 429single-step through some low-level code paths. 430On machines with software-emulated single-stepping (e.g., alpha), 431stepping through code executed by interrupt handlers will probably 432do the wrong thing. 433.\" -------------------- 434.It Ic call Ar name Ns Xo 435.Ic \&( Ns Ar expr 436.Op Ic \&, Ar expr ... 437.Ic \&) 438.Xc 439Call the function named by 440.Ar name 441with the argument(s) listed in parentheses. 442Parentheses may be omitted if the function takes no arguments. 443The number of arguments is currently limited to 10. 444.\" -------------------- 445.\" .It Ic c Ns Op Cm /c 446.It Xo 447.Ic c Ns Op Ic ontinue 448.Op Cm /c 449.Xc 450Continue execution until a breakpoint or watchpoint. 451If the 452.Cm /c 453modifier is given, instructions are counted while executing. 454.Pp 455.Sy Warning: 456when counting with 457.Cm /c , 458.Nm 459is really silently single-stepping. 460This means that single-stepping on low-level code may cause strange 461behavior. 462.\" -------------------- 463.It Xo 464.Ic watch 465.Ar addr 466.Op Ic \&, Ns Ar size 467.Xc 468Set a watchpoint for the region starting at 469.Ar addr . 470Execution stops and control returns to 471.Nm 472when an attempt is made to modify a watched region. 473The 474.Ar size 475argument defaults to 4. 476.Pp 477If you specify a wrong space address, the request is rejected 478with an error message. 479.Pp 480.Sy Warning: 481attempts to watch wired kernel memory 482may cause an unrecoverable error on some systems (e.g., i386). 483.\" -------------------- 484.It Ic dwatch Ar addr 485Delete the watchpoint at address 486.Ar addr 487that was previously set with a 488.Ic watch 489command. 490.\" -------------------- 491.It Xo 492.Ic hangman 493.Op Cm /s Ns Op Ic 0-9 494.Xc 495This is a tiny and handy tool for random kernel hangs analysis, of which its 496depth is controlled by the optional argument of the default value of five. 497It uses some sophisticated heuristics to spot the global symbol that 498caused the hang. 499Since the discovering algorithm is a probabilistic one, 500you may spend substantial time to figure the exact symbol name. 501This smart thing requires a little of your attention, the input it accepts 502is mostly of the same format as that of the famous 503.Xr hangman 6 504game, to which it, apparently, is obliged by the name. 505Hint: the 506.Xr nm 1 507utility might help. 508.\" -------------------- 509.It Ic until Op Cm /p 510Stop at the next 511.Qq call 512or 513.Qq return 514instruction. 515If the 516.Cm /p 517modifier is specified, 518.Nm 519prints the call nesting depth and the 520cumulative instruction count at each call or return. 521Otherwise, it stays silent until the matching return is hit. 522.\" -------------------- 523.It Ic match Op Cm /p 524Stop at the next matching return instruction. 525If the 526.Cm /p 527modifier is specified, 528.Nm 529prints the call nesting depth and the 530cumulative instruction count at each call or return. 531Otherwise, it remains mostly quiet. 532.\" -------------------- 533.It Ic next Op Cm /p 534The 535.Ic next 536command is a synonym for 537.Ic match . 538.\" -------------------- 539.It Xo 540.Ic trace 541.Op Cm /pu 542.Op Ar frameaddr Ns 543.Op Ic \&, Ns Ar count 544.Xc 545Show the stack trace. 546The 547.Cm /p 548modifier interprets the 549.Ar frameaddr 550argument as the PID of a process and shows the stack trace of 551that process. 552The 553.Cm /p 554modifier is not supported on all platforms. 555The 556.Cm /u 557modifier shows the stack trace of user space; 558if omitted, the kernel stack is traced instead. 559The 560.Ar count 561argument is the limit on the number of frames to be followed. 562If 563.Ar count 564is omitted, all frames are printed. 565.Pp 566.Sy Warning: 567user space stack trace is valid 568only if the machine dependent code supports it. 569.\" -------------------- 570.It Xo 571.Ic search 572.Op Cm /bhl 573.Op Ar addr 574.Ar value 575.Op Ar mask 576.Op Ic \&, Ns Ar count 577.Xc 578Search memory for a value beginning at 579.Ar addr . 580This command might fail in interesting 581ways if it doesn't find the searched-for value. 582This is because 583.Nm 584doesn't always recover from touching bad memory. 585The optional 586.Ar count 587argument limits the search. 588The modifiers are the same as those of the 589.Ic write 590command. 591.Pp 592The 593.Va next 594address is set to the address where 595.Ar value 596is found, or just after where the search area finishes. 597.\" -------------------- 598.It Ic show Ar what 599Displays various things, depending on 600.Ar what : 601.Bl -tag -width 4n 602.\" -------------------- 603.It Ic show bcstats 604Prints the buffer cache statistics. 605.\" -------------------- 606.It Ic show breaks 607Prints a list of all breakpoints that have been set with the 608.Ic break 609command. 610.\" -------------------- 611.It Xo 612.Ic show buf 613.Op Cm /f 614.Ar addr 615.Xc 616Prints the 617.Li struct buf 618at 619.Ar addr . 620If the 621.Cm /f 622modifier is specified output will also include 623.Li softdep 624printout, if those are available. 625.\" -------------------- 626.It Ic show extents 627Prints a detailed list of all extents. 628.\" -------------------- 629.It Ic show malloc Op Ar addr 630Prints malloc debugging information if available. 631If an optional address is specified, only information about that address 632is printed. 633.\" -------------------- 634.It Xo 635.Ic show map 636.Op Cm /f 637.Ar addr 638.Xc 639Prints the 640.Li vm_map 641at 642.Ar addr . 643If the 644.Cm /f 645modifier is specified the complete map is printed. 646.\" -------------------- 647.It Ic show mbuf Ar addr 648Prints the 649.Li struct mbuf 650header at 651.Ar addr . 652Depending on the mbuf flags 653.Li struct pkthdr 654and 655.Li struct m_ext 656are printed as well. 657.\" -------------------- 658.It Xo 659.Ic show mount 660.Op Cm /f 661.Ar addr 662.Xc 663Prints the 664.Li struct mount 665at 666.Ar addr . 667If the 668.Cm /f 669modifier is specified prints out all 670.Li vnodes 671(see also 672.Cm show vnode ) 673and also all 674.Li bufs 675(see also 676.Cm show buf ) 677on all those vnodes. 678.\" -------------------- 679.It Xo 680.Ic show nfsnode 681.Op Cm /f 682.Ar addr 683.Xc 684Prints the 685.Li struct nfsnode 686at 687.Ar addr . 688If the 689.Cm /f 690modifier is specified prints out additional 691information as well. 692.\" -------------------- 693.It Xo 694.Ic show nfsreq 695.Op Cm /f 696.Ar addr 697.Xc 698Prints the 699.Li struct nfsreq 700at 701.Ar addr . 702If the 703.Cm /f 704modifier is specified prints out additional 705information as well. 706.\" -------------------- 707.It Xo 708.Ic show object 709.Op Cm /f 710.Ar addr 711.Xc 712Prints the 713.Li vm_object 714at 715.Ar addr . 716If the 717.Cm /f 718modifier is specified the complete object is printed. 719.\" -------------------- 720.It Xo 721.Ic show offset 722.Ar offset 723.Xc 724Prints a list of the known kernel structure fields which occur at the given 725.Ar offset 726from the beginning of the struct, as well as their size. 727The 728.Cm option DDB_STRUCT 729is required for this command to be available. 730.\" -------------------- 731.It Xo 732.Ic show page 733.Op Cm /f 734.Ar addr 735.Xc 736Prints the 737.Li vm_page 738at 739.Ar addr . 740If the 741.Cm /f 742modifier is specified the complete page is printed. 743.\" -------------------- 744.It Ic show panic 745Prints the panic string. 746.\" -------------------- 747.It Xo 748.Ic show pool 749.Op Cm /p 750.Ar addr 751.Xc 752Prints the 753.Li pool 754at 755.Ar addr . 756Valid modifiers: 757.Bl -tag -width xxx -compact 758.It Cm /p 759Print the pagelist for this pool. 760.El 761.\" -------------------- 762.It Ic show proc Op Ar addr 763Prints the 764.Li struct proc 765at 766.Ar addr . 767If an optional address is not specified 768.Li curproc 769is assumed. 770.\" -------------------- 771.It Ic show registers Op Cm /u 772Display the register set. 773If the 774.Cm /u 775modifier is specified, it displays user registers (or the currently 776saved registers) instead of the kernel's. 777Note: The 778.Cm /u 779modifier is not supported on every machine, in which case 780incorrect information may be displayed. 781.\" -------------------- 782.It Xo 783.Ic show struct 784.Ar name 785.Op addr 786.Xc 787Prints the content of the memory at 788.Ar addr 789as a struct 790.Ar name . 791Nested structures and bit fields are not printed. 792Character arrays are printed as bytes. 793The 794.Cm option DDB_STRUCT 795is required for this command to be available. 796.\" -------------------- 797.It Ic show uvmexp 798Displays a selection of uvm counters and statistics. 799.\" -------------------- 800.It Xo 801.Ic show vnode 802.Op Cm /f 803.Ar addr 804.Xc 805Prints the 806.Li struct vnode 807at 808.Ar addr . 809If the 810.Cm /f 811modifier is specified prints out all 812.Li bufs 813(see also 814.Cm show buf ) 815currently attached to this 816.Li vnode . 817.\" -------------------- 818.It Ic show watches 819Displays all watchpoints set with the 820.Ic watch 821command. 822.\" -------------------- 823.It Ic show all procs Op Cm /anw 824Display information on all processes. 825.Pp 826.Bl -tag -width foo -compact 827.It Cm /n 828(Default) Show process information in a 829.Xr ps 1 Ns \&-like 830format. 831Information printed includes process ID, parent 832process ID, process group, UID, process status, process flags, process 833command name, and process wait channel message. 834.It Cm /a 835Shows the kernel virtual addresses of each process' 836proc structure, u-area, and vmspace structure. 837The vmspace address is also the address of the process' 838.Li vm_map 839structure 840and can be used in the 841.Ic show map 842command. 843.It Cm /w 844Shows each process' PID, command, system call emulation, 845wait channel address, and wait channel message. 846.El 847.\" -------------------- 848.It Ic show all bufs Op Cm /f 849Display information about all buffers in the system. 850.Pp 851.Bl -tag -width foo -compact 852.It Cm /f 853For each buffer, print a more detailed output. 854See the 855.Ic show buf 856command for more information. 857.El 858.\" -------------------- 859.It Ic show all callout 860Display the contents of the callout table. 861.\" -------------------- 862.It Ic show all pools Op Cm /a 863Display information about all system pools in a format similar to 864.Xr vmstat 8 . 865.Pp 866.Bl -tag -width foo -compact 867.It Cm /a 868Displays 869.Dq interesting 870address information. 871.El 872.\" -------------------- 873.It Ic show all mounts Op Cm /f 874Display information on all mounted filesystems. 875.Pp 876.Bl -tag -width foo -compact 877.It Cm /f 878For each filesystem, list all its struct vnode addresses. 879These addresses can be used in the 880.Ic show vnode 881command. 882.El 883.\" -------------------- 884.It Ic show all nfsnodes Op Cm /f 885Display information about all nfsnodes in the system. 886.Pp 887.Bl -tag -width foo -compact 888.It Cm /f 889For each nfsnode, print a more detailed output. 890See the 891.Ic show nfsnode 892command for more information. 893.El 894.\" -------------------- 895.It Ic show all nfsreqs Op Cm /f 896Display information for all outstanding NFS requests. 897.Pp 898.Bl -tag -width foo -compact 899.It Cm /f 900For each NFS requests, print a more detailed output. 901See the 902.Ic show nfsreq 903command for more information. 904.El 905.\" -------------------- 906.It Ic show all vnodes Op Cm /f 907Display information about all vnodes in the system. 908.Pp 909.Bl -tag -width foo -compact 910.It Cm /f 911For each vnode, print a more detailed output. 912See the 913.Ic show vnode 914command for more information. 915.El 916.El 917.\" -------------------- 918.It Ic callout 919A synonym for the 920.Ic show all callout 921command. 922.\" -------------------- 923.It Ic ps Op Cm /anw 924A synonym for 925.Ic show all procs . 926.\" -------------------- 927.El 928.Sh VARIABLES 929.Nm 930denotes registers and variables by 931.Ic $ Ns Va name . 932Register names can be found with the 933.Ic show registers 934command. 935.Pp 936Some variable names are suffixed with numbers, and some may have a modifier 937following a colon immediately after the variable name. 938For example, register variables can have the 939.Ql :u 940modifier to indicate a 941user register (e.g., 942.Ql $eax:u ) . 943.Pp 944Built-in debugger variables currently supported are: 945.Bl -tag -width 10n -compact -offset indent 946.It Va $radix 947Input and output radix. 948.It Va $maxoff 949Addresses are printed as 950.Ar symbol Ns Li + Ns Ar offset 951unless 952.Ar offset 953is greater than 954.Va $maxoff . 955.It Va $maxwidth 956The width of the displayed lines. 957.It Va $lines 958The number of lines to page. 959This is used by the 960.Dq more 961feature. 962.It Va $tabstops 963Tab stop width. 964.It Va $log 965Controls whether the output of ddb will also appear in the system message 966buffer. 967.El 968.Pp 969These variables can also be controlled outside ddb via the 970.Sq ddb 971.Xr sysctl 8 972hierarchy. 973.Sh EXPRESSIONS 974Almost all expression operators in C are supported except for 975.Ql ~ , 976.Ql ^ , 977and unary 978.Ql & . 979Special rules for expressions in 980.Nm 981are: 982.Bl -tag -width 15n -compact -offset indent 983.It Ar identifier 984The name of a symbol. 985It is translated to the address (or value) of the symbol. 986.Ql \&. 987and 988.Ql \&: 989can be used in the identifier. 990The following can be accepted as an identifier, 991if supported by an object format dependent routine: 992.Bl -item -offset indent -compact 993.It 994.Sm off 995.Oo Ar filename Li \&: Oc Ar func 996.Op \&: Ar linenumber 997.It 998.Op Ar filename \&: 999.Ar variable 1000.It 1001.Ar filename 1002.Op \&: Ar linenumber 1003.Sm on 1004.El 1005The symbol may be prefixed with 1006.Sq Ar symboltablename Ns :: 1007(e.g., 1008.Ql emulator::mach_msg_trap ) 1009to specify other than kernel symbols. 1010.It Ar number 1011The radix is determined by the first two letters: 1012.Ql 0x : 1013hex, 1014.Ql 0o : 1015octal, 1016.Ql 0t : 1017decimal, otherwise, the value of 1018.Va $radix 1019is used. 1020.It Li \&. 1021.Va dot : 1022the current address. 1023.It Li + 1024.Va next : 1025the next address. 1026.It Li .. 1027The address of the start of the last line examined. 1028Unlike 1029.Va dot 1030or 1031.Va next , 1032this is only changed by the 1033.Ic examine 1034or 1035.Ic write 1036command. 1037.It Li ' 1038The last address explicitly specified. 1039.It Li $ Ns Ar variable 1040The value of a register or variable. 1041The name may be followed by a 1042.Ql \&: 1043and modifiers as described above with 1044.Ar identifier . 1045.It Ar expr Li # Ar expr 1046A binary operator which rounds up the left hand side to the next 1047multiple of right hand side. 1048.It Li * Ns Ar expr 1049Indirection. 1050It may be followed by a ':' and modifiers as described above. 1051.El 1052.Sh SEE ALSO 1053.Xr gdb 1 , 1054.Xr nm 1 , 1055.Xr sysctl.conf 5 , 1056.Xr hangman 6 , 1057.Xr kgdb 7 , 1058.Xr crash 8 , 1059.Xr sysctl 8 , 1060.Xr extent 9 , 1061.Xr pool 9 , 1062.Xr uvm 9 1063.Sh HISTORY 1064This kernel facility first appeared in the MACH 2 operating system 1065developed by CMU. 1066Hangman (which stands for "hangs maniacal analyzer") first appeared in 1067.Ox 1.2 . 1068