xref: /openbsd-src/share/man/man4/ddb.4 (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1.\"	$OpenBSD: ddb.4,v 1.72 2011/07/05 07:08:25 tedu 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: July 5 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.
215Multiple modifier formats display multiple locations.
216If no format is specified, the last formats specified for this command
217are used.
218.Pp
219The format characters are:
220.Pp
221.Bl -tag -width 4n -compact
222.It Cm /b
223look at by bytes (8 bits)
224.It Cm /h
225look at by half words (16 bits)
226.It Cm /l
227look at by long words (32 bits) (default)
228.It Cm /q
229look at by long longs (64 bits) (only available on 64-bit platforms)
230.It Cm /a
231print the location being displayed
232.It Cm /A
233print the location with a line number if possible
234.It Cm /x
235display in unsigned hex
236.It Cm /z
237display in signed hex
238.It Cm /o
239display in unsigned octal
240.It Cm /d
241display in signed decimal
242.It Cm /u
243display in unsigned decimal
244.It Cm /r
245display in current radix, signed
246.It Cm /c
247display low 8 bits as a character.
248Non-printing characters are displayed as an octal escape code (e.g., '\e000').
249.It Cm /s
250display the null-terminated string at the location.
251Non-printing characters are displayed as octal escapes.
252.It Cm /m
253display in unsigned hex with character dump at the end of each line.
254The location is also displayed in hex at the beginning of each line.
255.It Cm /i
256display as an instruction
257.It Cm /I
258display as an alternate format instruction depending on the
259machine:
260.Pp
261.Bl -tag -width powerpc_ -compact
262.It alpha
263Print affected register contents for every instruction.
264.It amd64 ,
265.It i386
266Do not skip padding to the next long word boundary for unconditional jumps.
267.It m68k
268Use
269.Tn Motorola
270assembly syntax.
271.It m88k
272Decode instructions for the opposite CPU model (e.g. m88110 when running on an
273m88100 processor).
274.It vax
275Don't assume that each external label is a procedure entry mask.
276.El
277.El
278.Pp
279The value of
280.Va next
281is set to the
282.Ar addr
283plus the size of the data examined.
284.\" --------------------
285.It Xo
286.Ic print
287.Op Cm /axzodurc
288.Op Ar addr Op Ar addr ...
289.Xc
290Print each
291.Ar addr
292according to the modifier character.
293The valid modifiers are a subset of those from the
294.Ic examine
295command, and act as described there.
296If no modifier is specified, the last one specified in a
297previous use of
298.Ic print
299is used.
300The
301.Ar addr
302argument
303can be a string, and it is printed as a literal.
304.Pp
305For example,
306.Bd -literal -offset indent
307print/x "eax = " $eax "\enecx = " $ecx "\en"
308.Ed
309.Pp
310will print something like this:
311.Bd -literal -offset indent
312eax = xxxxxx
313ecx = yyyyyy
314.Ed
315.\" --------------------
316.\" .It Xo Ic w Ns Op Cm /bhl
317.\" .Op Ar addr
318.\" .Ar expr Op expr ...
319.\" .Xc
320.It Xo
321.Ic w Ns Op Ic rite
322.Op Cm /bhl
323.Op Ar addr
324.Ar expr Op Ar expr ...
325.Xc
326Write the value of each
327.Ar expr
328expression at succeeding locations start at
329.Ar addr .
330The write unit size can be specified using one of the modifiers:
331.Pp
332.Bl -tag -width 4n -offset indent -compact
333.It Cm /b
334byte (8 bits)
335.It Cm /h
336half word (16 bits)
337.It Cm /l
338long word (32 bits) (default)
339.El
340.Pp
341The value of
342.Va next
343is set to
344.Ar addr
345plus the size of values written.
346.Pp
347.Sy Warning:
348since there is no delimiter between expressions, the
349command may not parse as you expect.
350It is best to enclose each expression in parentheses.
351.\" --------------------
352.It Xo Ic set
353.Ic $ Ns Ar name
354.Op Ic =
355.Ar expr
356.Xc
357Set the named variable or register with the value of
358.Ar expr .
359Valid variable names are described below.
360.It Ic boot Ar how
361Reboot the machine depending on
362.Ar how :
363.Pp
364.Bl -tag -width "boot poweroff" -compact
365.It Ic boot sync
366Sync disks and reboot.
367.It Ic boot crash
368Dump core and reboot.
369.It Ic boot dump
370Sync disks, dump core and reboot.
371.It Ic boot halt
372Just halt.
373.It Ic boot reboot
374Just reboot.
375.It Ic boot poweroff
376Power down the machine whenever possible; if it fails, just halt.
377.El
378.\" --------------------
379.It Xo
380.Ic break
381.Op Ar addr Ns
382.Op Ic \&, Ns Ar count
383.Xc
384Set a break point at
385.Ar addr .
386If
387.Ar count
388is supplied,
389.Nm
390allows the breakpoint to be silently hit
391.Ar ( count No \- 1 )
392times before stopping at the
393break point.
394.Pp
395If the break point is successfully set, a break point number is
396displayed, in the form
397.Ic # Ns Ar number .
398This can later be used in deleting the break point
399or for adding conditions to it.
400.\" --------------------
401.\" .It Xo Ic d
402.\" .Op Ar addr | Ic # Ns Ar number
403.\" .Xc
404.It Xo
405.Ic d Ns Op Ic elete
406.Op Ar addr | Ic # Ns Ar number
407.Xc
408Delete the break point set with the
409.Ic break
410command.
411.\" --------------------
412.\" .It Xo Ic s Ns Op Cm /p
413.\" .Op Ic \&, Ns Ar count
414.\" .Xc
415.It Xo
416.Ic s Ns Op Ic tep
417.Op Cm /p
418.Op Ic \&, Ns Ar count
419.Xc
420Single step
421.Ar count
422times.
423If the
424.Cm /p
425modifier is specified, print each instruction at each step.
426Otherwise, only print the last instruction.
427.Pp
428.Sy Warning:
429depending on machine type, it may not be possible to
430single-step through some low-level code paths.
431On machines with software-emulated single-stepping (e.g., alpha),
432stepping through code executed by interrupt handlers will probably
433do the wrong thing.
434.\" --------------------
435.It Ic call Ar name Ns Xo
436.Ic \&( Ns Ar expr
437.Op Ic \&, Ar expr ...
438.Ic \&)
439.Xc
440Call the function named by
441.Ar name
442with the argument(s) listed in parentheses.
443Parentheses may be omitted if the function takes no arguments.
444The number of arguments is currently limited to 10.
445.\" --------------------
446.\" .It Ic c Ns Op Cm /c
447.It Xo
448.Ic c Ns Op Ic ontinue
449.Op Cm /c
450.Xc
451Continue execution until a breakpoint or watchpoint.
452If the
453.Cm /c
454modifier is given, instructions are counted while executing.
455.Pp
456.Sy Warning:
457when counting with
458.Cm /c ,
459.Nm
460is really silently single-stepping.
461This means that single-stepping on low-level code may cause strange
462behavior.
463.\" --------------------
464.It Xo
465.Ic watch
466.Ar addr
467.Op Ic \&, Ns Ar size
468.Xc
469Set a watchpoint for the region starting at
470.Ar addr .
471Execution stops and control returns to
472.Nm
473when an attempt is made to modify a watched region.
474The
475.Ar size
476argument defaults to 4.
477.Pp
478If you specify a wrong space address, the request is rejected
479with an error message.
480.Pp
481.Sy Warning:
482attempts to watch wired kernel memory
483may cause an unrecoverable error on some systems (e.g., i386).
484.\" --------------------
485.It Ic dwatch Ar addr
486Delete the watchpoint at address
487.Ar addr
488that was previously set with a
489.Ic watch
490command.
491.\" --------------------
492.It Xo
493.Ic hangman
494.Op Cm /s Ns Op Ic 0-9
495.Xc
496This is a tiny and handy tool for random kernel hangs analysis, of which its
497depth is controlled by the optional argument of the default value of five.
498It uses some sophisticated heuristics to spot the global symbol that
499caused the hang.
500Since the discovering algorithm is a probabilistic one,
501you may spend substantial time to figure the exact symbol name.
502This smart thing requires a little of your attention, the input it accepts
503is mostly of the same format as that of the famous
504.Xr hangman 6
505game, to which it, apparently, is obliged by the name.
506Hint: the
507.Xr nm 1
508utility might help.
509.\" --------------------
510.It Ic until Op Cm /p
511Stop at the next
512.Qq call
513or
514.Qq return
515instruction.
516If the
517.Cm /p
518modifier is specified,
519.Nm
520prints the call nesting depth and the
521cumulative instruction count at each call or return.
522Otherwise, it stays silent until the matching return is hit.
523.\" --------------------
524.It Ic match Op Cm /p
525Stop at the next matching return instruction.
526If the
527.Cm /p
528modifier is specified,
529.Nm
530prints the call nesting depth and the
531cumulative instruction count at each call or return.
532Otherwise, it remains mostly quiet.
533.\" --------------------
534.It Ic next Op Cm /p
535The
536.Ic next
537command is a synonym for
538.Ic match .
539.\" --------------------
540.It Xo
541.Ic trace
542.Op Cm /pu
543.Op Ar frameaddr Ns
544.Op Ic \&, Ns Ar count
545.Xc
546Show the stack trace.
547The
548.Cm /p
549modifier interprets the
550.Ar frameaddr
551argument as the PID of a process and shows the stack trace of
552that process.
553The
554.Cm /p
555modifier is not supported on all platforms.
556The
557.Cm /u
558modifier shows the stack trace of user space;
559if omitted, the kernel stack is traced instead.
560The
561.Ar count
562argument is the limit on the number of frames to be followed.
563If
564.Ar count
565is omitted, all frames are printed.
566.Pp
567.Sy Warning:
568user space stack trace is valid
569only if the machine dependent code supports it.
570.\" --------------------
571.It Xo
572.Ic search
573.Op Cm /bhl
574.Op Ar addr
575.Ar value
576.Op Ar mask
577.Op Ic \&, Ns Ar count
578.Xc
579Search memory for a value beginning at
580.Ar addr .
581This command might fail in interesting
582ways if it doesn't find the searched-for value.
583This is because
584.Nm
585doesn't always recover from touching bad memory.
586The optional
587.Ar count
588argument limits the search.
589The modifiers are the same as those of the
590.Ic write
591command.
592.Pp
593The
594.Va next
595address is set to the address where
596.Ar value
597is found, or just after where the search area finishes.
598.\" --------------------
599.It Ic show Ar what
600Displays various things, depending on
601.Ar what :
602.Bl -tag -width 4n
603.\" --------------------
604.It Ic show bcstats
605Prints the buffer cache statistics.
606.\" --------------------
607.It Ic show breaks
608Prints a list of all breakpoints that have been set with the
609.Ic break
610command.
611.\" --------------------
612.It Xo
613.Ic show buf
614.Op Cm /f
615.Ar addr
616.Xc
617Prints the
618.Li struct buf
619at
620.Ar addr .
621If the
622.Cm /f
623modifier is specified output will also include
624.Li softdep
625printout, if those are available.
626.\" --------------------
627.It Ic show extents
628Prints a detailed list of all extents.
629.\" --------------------
630.It Ic show malloc Op Ar addr
631Prints malloc debugging information if available.
632If an optional address is specified, only information about that address
633is printed.
634.\" --------------------
635.It Xo
636.Ic show map
637.Op Cm /f
638.Ar addr
639.Xc
640Prints the
641.Li vm_map
642at
643.Ar addr .
644If the
645.Cm /f
646modifier is specified the complete map is printed.
647.\" --------------------
648.It Ic show mbuf Ar addr
649Prints the
650.Li struct mbuf
651header at
652.Ar addr .
653Depending on the mbuf flags
654.Li struct pkthdr
655and
656.Li struct m_ext
657are printed as well.
658.\" --------------------
659.It Xo
660.Ic show mount
661.Op Cm /f
662.Ar addr
663.Xc
664Prints the
665.Li struct mount
666at
667.Ar addr .
668If the
669.Cm /f
670modifier is specified prints out all
671.Li vnodes
672(see also
673.Cm show vnode )
674and also all
675.Li bufs
676(see also
677.Cm show buf )
678on all those vnodes.
679.\" --------------------
680.It Xo
681.Ic show nfsnode
682.Op Cm /f
683.Ar addr
684.Xc
685Prints the
686.Li struct nfsnode
687at
688.Ar addr .
689If the
690.Cm /f
691modifier is specified prints out additional
692information as well.
693.\" --------------------
694.It Xo
695.Ic show nfsreq
696.Op Cm /f
697.Ar addr
698.Xc
699Prints the
700.Li struct nfsreq
701at
702.Ar addr .
703If the
704.Cm /f
705modifier is specified prints out additional
706information as well.
707.\" --------------------
708.It Xo
709.Ic show object
710.Op Cm /f
711.Ar addr
712.Xc
713Prints the
714.Li vm_object
715at
716.Ar addr .
717If the
718.Cm /f
719modifier is specified the complete object is printed.
720.\" --------------------
721.It Xo
722.Ic show offset
723.Ar offset
724.Xc
725Prints a list of the known kernel structure fields which occur at the given
726.Ar offset
727from the beginning of the struct, as well as their size.
728The
729.Cm option DDB_STRUCT
730is required for this command to be available.
731.\" --------------------
732.It Xo
733.Ic show page
734.Op Cm /f
735.Ar addr
736.Xc
737Prints the
738.Li vm_page
739at
740.Ar addr .
741If the
742.Cm /f
743modifier is specified the complete page is printed.
744.\" --------------------
745.It Ic show panic
746Prints the panic string.
747.\" --------------------
748.It Xo
749.Ic show pool
750.Op Cm /p
751.Ar addr
752.Xc
753Prints the
754.Li pool
755at
756.Ar addr .
757Valid modifiers:
758.Bl -tag -width xxx -compact
759.It Cm /p
760Print the pagelist for this pool.
761.El
762.\" --------------------
763.It Ic show proc Op Ar addr
764Prints the
765.Li struct proc
766at
767.Ar addr .
768If an optional address is not specified
769.Li curproc
770is assumed.
771.\" --------------------
772.It Ic show registers Op Cm /u
773Display the register set.
774If the
775.Cm /u
776modifier is specified, it displays user registers (or the currently
777saved registers) instead of the kernel's.
778Note: The
779.Cm /u
780modifier is not supported on every machine, in which case
781incorrect information may be displayed.
782.\" --------------------
783.It Xo
784.Ic show struct
785.Ar name
786.Op addr
787.Xc
788Prints the content of the memory at
789.Ar addr
790as a struct
791.Ar name .
792Nested structures and bit fields are not printed.
793Character arrays are printed as bytes.
794The
795.Cm option DDB_STRUCT
796is required for this command to be available.
797.\" --------------------
798.It Ic show uvmexp
799Displays a selection of uvm counters and statistics.
800.\" --------------------
801.It Xo
802.Ic show vnode
803.Op Cm /f
804.Ar addr
805.Xc
806Prints the
807.Li struct vnode
808at
809.Ar addr .
810If the
811.Cm /f
812modifier is specified prints out all
813.Li bufs
814(see also
815.Cm show buf )
816currently attached to this
817.Li vnode .
818.\" --------------------
819.It Ic show watches
820Displays all watchpoints set with the
821.Ic watch
822command.
823.\" --------------------
824.It Ic show all procs Op Cm /anw
825Display information on all processes.
826.Pp
827.Bl -tag -width foo -compact
828.It Cm /n
829(Default) Show process information in a
830.Xr ps 1 Ns \&-like
831format.
832Information printed includes process ID, parent
833process ID, process group, UID, process status, process flags, process
834command name, and process wait channel message.
835.It Cm /a
836Shows the kernel virtual addresses of each process'
837proc structure, u-area, and vmspace structure.
838The vmspace address is also the address of the process'
839.Li vm_map
840structure
841and can be used in the
842.Ic show map
843command.
844.It Cm /w
845Shows each process' PID, command, system call emulation,
846wait channel address, and wait channel message.
847.El
848.\" --------------------
849.It Ic show all bufs Op Cm /f
850Display information about all buffers in the system.
851.Pp
852.Bl -tag -width foo -compact
853.It Cm /f
854For each buffer, print a more detailed output.
855See the
856.Ic show buf
857command for more information.
858.El
859.\" --------------------
860.It Ic show all callout
861Display the contents of the callout table.
862.\" --------------------
863.It Ic show all pools Op Cm /a
864Display information about all system pools in a format similar to
865.Xr vmstat 8 .
866.Pp
867.Bl -tag -width foo -compact
868.It Cm /a
869Displays
870.Dq interesting
871address information.
872.El
873.\" --------------------
874.It Ic show all mounts Op Cm /f
875Display information on all mounted filesystems.
876.Pp
877.Bl -tag -width foo -compact
878.It Cm /f
879For each filesystem, list all its struct vnode addresses.
880These addresses can be used in the
881.Ic show vnode
882command.
883.El
884.\" --------------------
885.It Ic show all nfsnodes Op Cm /f
886Display information about all nfsnodes in the system.
887.Pp
888.Bl -tag -width foo -compact
889.It Cm /f
890For each nfsnode, print a more detailed output.
891See the
892.Ic show nfsnode
893command for more information.
894.El
895.\" --------------------
896.It Ic show all nfsreqs Op Cm /f
897Display information for all outstanding NFS requests.
898.Pp
899.Bl -tag -width foo -compact
900.It Cm /f
901For each NFS requests, print a more detailed output.
902See the
903.Ic show nfsreq
904command for more information.
905.El
906.\" --------------------
907.It Ic show all vnodes Op Cm /f
908Display information about all vnodes in the system.
909.Pp
910.Bl -tag -width foo -compact
911.It Cm /f
912For each vnode, print a more detailed output.
913See the
914.Ic show vnode
915command for more information.
916.El
917.El
918.\" --------------------
919.It Ic callout
920A synonym for the
921.Ic show all callout
922command.
923.\" --------------------
924.It Ic ps Op Cm /anw
925A synonym for
926.Ic show all procs .
927.\" --------------------
928.El
929.Sh VARIABLES
930.Nm
931denotes registers and variables by
932.Ic $ Ns Va name .
933Register names can be found with the
934.Ic show registers
935command.
936.Pp
937Some variable names are suffixed with numbers, and some may have a modifier
938following a colon immediately after the variable name.
939For example, register variables can have the
940.Ql :u
941modifier to indicate a
942user register (e.g.,
943.Ql $eax:u ) .
944.Pp
945Built-in debugger variables currently supported are:
946.Bl -tag -width 10n -compact -offset indent
947.It Va $radix
948Input and output radix.
949.It Va $maxoff
950Addresses are printed as
951.Ar symbol Ns Li + Ns Ar offset
952unless
953.Ar offset
954is greater than
955.Va $maxoff .
956.It Va $maxwidth
957The width of the displayed lines.
958.It Va $lines
959The number of lines to page.
960This is used by the
961.Dq more
962feature.
963.It Va $tabstops
964Tab stop width.
965.It Va $log
966Controls whether the output of ddb will also appear in the system message
967buffer.
968.El
969.Pp
970These variables can also be controlled outside ddb via the
971.Sq ddb
972.Xr sysctl 8
973hierarchy.
974.Sh EXPRESSIONS
975Almost all expression operators in C are supported except for
976.Ql ~ ,
977.Ql ^ ,
978and unary
979.Ql & .
980Special rules for expressions in
981.Nm
982are:
983.Bl -tag -width 15n -compact -offset indent
984.It Ar identifier
985The name of a symbol.
986It is translated to the address (or value) of the symbol.
987.Ql \&.
988and
989.Ql \&:
990can be used in the identifier.
991The following can be accepted as an identifier,
992if supported by an object format dependent routine:
993.Bl -item -offset indent -compact
994.It
995.Sm off
996.Oo Ar filename Li \&: Oc Ar func
997.Op \&: Ar linenumber
998.It
999.Op Ar filename \&:
1000.Ar variable
1001.It
1002.Ar filename
1003.Op \&: Ar linenumber
1004.Sm on
1005.El
1006The symbol may be prefixed with
1007.Sq Ar symboltablename Ns ::
1008(e.g.,
1009.Ql emulator::mach_msg_trap )
1010to specify other than kernel symbols.
1011.It Ar number
1012The radix is determined by the first two letters:
1013.Ql 0x :
1014hex,
1015.Ql 0o :
1016octal,
1017.Ql 0t :
1018decimal, otherwise, the value of
1019.Va $radix
1020is used.
1021.It Li \&.
1022.Va dot :
1023the current address.
1024.It Li +
1025.Va next :
1026the next address.
1027.It Li ..
1028The address of the start of the last line examined.
1029Unlike
1030.Va dot
1031or
1032.Va next ,
1033this is only changed by the
1034.Ic examine
1035or
1036.Ic write
1037command.
1038.It Li '
1039The last address explicitly specified.
1040.It Li $ Ns Ar variable
1041The value of a register or variable.
1042The name may be followed by a
1043.Ql \&:
1044and modifiers as described above with
1045.Ar identifier .
1046.It Ar expr Li # Ar expr
1047A binary operator which rounds up the left hand side to the next
1048multiple of right hand side.
1049.It Li * Ns Ar expr
1050Indirection.
1051It may be followed by a ':' and modifiers as described above.
1052.El
1053.Sh SEE ALSO
1054.Xr gdb 1 ,
1055.Xr nm 1 ,
1056.Xr sysctl.conf 5 ,
1057.Xr hangman 6 ,
1058.Xr kgdb 7 ,
1059.Xr crash 8 ,
1060.Xr sysctl 8 ,
1061.Xr extent 9 ,
1062.Xr pool 9 ,
1063.Xr uvm 9
1064.Sh HISTORY
1065This kernel facility first appeared in the MACH 2 operating system
1066developed by CMU.
1067Hangman (which stands for "hangs maniacal analyzer") first appeared in
1068.Ox 1.2 .
1069