2 .\" Mach Operating System
3 .\" Copyright (c) 1991,1990 Carnegie Mellon University
4 .\" All Rights Reserved.
6 .\" Permission to use, copy, modify and distribute this software and its
7 .\" documentation is hereby granted, provided that both the copyright
8 .\" notice and this permission notice appear in all copies of the
9 .\" software, derivative works or modified versions, and any portions
10 .\" thereof, and that both notices appear in supporting documentation.
12 .\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 .\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 .\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
16 .\" Carnegie Mellon requests users of this software to return to
18 .\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 .\" School of Computer Science
20 .\" Carnegie Mellon University
21 .\" Pittsburgh PA 15213-3890
23 .\" any improvements or extensions that they make and grant Carnegie Mellon
24 .\" the rights to redistribute these changes.
26 .\" changed a \# to #, since groff choked on it.
30 .\" Revision 1.1 1993/07/15 18:41:02 brezak
33 .\" Revision 2.6 92/04/08 08:52:57 rpd
35 .\" [92/01/17 14:19:22 jsb]
36 .\" Changes for OSF debugger modifications.
39 .\" Revision 2.5 91/06/25 13:50:22 rpd
40 .\" Added some watchpoint explanation.
43 .\" Revision 2.4 91/06/17 15:47:31 jsb
44 .\" Added documentation for continue/c, match, search, and watchpoints.
45 .\" I've not actually explained what a watchpoint is; maybe Rich can
46 .\" do that (hint, hint).
47 .\" [91/06/17 10:58:08 jsb]
49 .\" Revision 2.3 91/05/14 17:04:23 mrt
50 .\" Correcting copyright
52 .\" Revision 2.2 91/02/14 14:10:06 mrt
53 .\" Changed to new Mach copyright
54 .\" [91/02/12 18:10:12 mrt]
56 .\" Revision 2.2 90/08/30 14:23:15 dbg
60 .\" $FreeBSD: src/share/man/man4/ddb.4,v 1.7.2.6 2001/08/17 13:08:37 ru Exp $
67 .Nd interactive kernel debugger
72 .Cd options DDB_UNATTENDED
76 kernel debugger has most of the features of the old kdb,
77 but with a more rational syntax
80 If linked into the running kernel,
81 it can be invoked locally with the
84 action (the default is Control-Alt-Esc).
85 The debugger is also invoked on kernel
88 .Va debug.debugger_on_panic
90 MIB variable is set non-zero,
96 .Va debug.trace_on_panic
98 MIB variable will cause
100 to print a stack trace on
102 It is zero by default unless the
106 The current location is called `dot'. The `dot' is displayed with
107 a hexadecimal format at a prompt.
108 Examine and write commands update `dot' to the address of the last line
109 examined or the last location modified, and set `next' to the address of
110 the next location to be examined or changed.
111 Other commands don't change `dot', and set `next' to be the same as `dot'.
113 The general command syntax is:
114 .Cm command Ns Op Li \&/ Ns Ar modifier
115 .Ar address Ns Op Li , Ns Ar count
117 A blank line repeats the previous command from the address `next' with
118 count 1 and no modifiers. Specifying
123 uses `dot'. A missing
126 to be 1 for printing commands or infinity for stack traces.
130 debugger has a feature like the
133 for the output. If an output line exceeds the number set in the
135 variable, it displays
137 and waits for a response.
138 The valid responses for it are:
140 .Bl -tag -compact -width SPC
146 abort the current command, and return to the command input mode
151 provides a small (currently 10 items) command history, and offers
152 simple emacs-style command line editing capabilities. In addition to
153 the emacs control keys, the usual ANSI arrow keys might be used to
154 browse through the history buffer, and move the cursor within the
163 Display the addressed locations according to the formats in the modifier.
164 Multiple modifier formats display multiple locations.
165 If no format is specified, the last formats specified for this command
168 The format characters are:
169 .Bl -tag -compact -width indent
171 look at by bytes (8 bits)
173 look at by half words (16 bits)
175 look at by long words (32 bits)
177 print the location being displayed
179 print the location with a line number if possible
181 display in unsigned hex
183 display in signed hex
185 display in unsigned octal
187 display in signed decimal
189 display in unsigned decimal
191 display in current radix, signed
193 display low 8 bits as a character.
194 Non-printing characters are displayed as an octal escape code (e.g., `\e000').
196 display the null-terminated string at the location.
197 Non-printing characters are displayed as octal escapes.
199 display in unsigned hex with character dump at the end of each line.
200 The location is also displayed in hex at the beginning of each line.
202 display as an instruction
209 Execute an examine command with the last specified parameters to it
210 except that the next address displayed by it is used as the start address.
213 Execute an examine command with the last specified parameters to it
214 except that the last start address subtracted by the size displayed by it
215 is used as the start address.
225 according to the modifier character (as described above for
237 If no modifier is specified, the last one specified to it is used.
239 can be a string, in which case it is printed as it is. For example:
240 .Bd -literal -offset indent
241 print/x \&"eax = \&" $eax \&"\enecx = \&" $ecx \&"\en\&"
245 .Bd -literal -offset indent
262 Write the expressions specified after
264 on the command line at succeeding locations starting with
266 The write unit size can be specified in the modifier with a letter
272 (long word) respectively. If omitted,
273 long word is assumed.
276 since there is no delimiter between expressions, strange
278 It's best to enclose each expression in parentheses.
281 .Li \&$ Ns Ar variable
285 Set the named variable or register with the value of
287 Valid variable names are described below.
288 .It Cm break Ns Op Cm /u
293 is supplied, continues
295 - 1 times before stopping at the
296 break point. If the break point is set, a break point number is
299 This number can be used in deleting the break point
300 or adding conditions to it.
304 modifier is specified, this command sets a break point in user space
307 option, the address is considered in the kernel
308 space, and wrong space address is rejected with an error message.
309 This modifier can be used only if it is supported by machine dependent
313 If a user text is shadowed by a normal user space debugger,
314 user space break points may not work correctly. Setting a break
315 point at the low-level code paths may also cause strange behavior.
319 .Cm delete Li \&# Ns Ar number
323 .Cm d Li \&# Ns Ar number
325 Delete the break point. The target break point can be specified by a
326 break point number with
330 specified in the original
340 times (the comma is a mandatory part of the syntax).
343 modifier is specified, print each instruction at each step.
344 Otherwise, only print the last instruction.
347 depending on machine type, it may not be possible to
348 single-step through some low-level code paths or user space code.
349 On machines with software-emulated single-stepping (e.g., pmax),
350 stepping through code executed by interrupt handlers will probably
353 .Cm continue Ns Op Cm /c
357 Continue execution until a breakpoint or watchpoint.
360 modifier is specified, count instructions while executing.
361 Some machines (e.g., pmax) also count loads and stores.
364 when counting, the debugger is really silently single-stepping.
365 This means that single-stepping on low-level code may cause strange
367 .It Cm until Ns Op Cm /p
368 Stop at the next call or return instruction.
371 modifier is specified, print the call nesting depth and the
372 cumulative instruction count at each call or return. Otherwise,
373 only print when the matching return is hit.
377 .Cm match Ns Op Cm /p
379 Stop at the matching return instruction.
382 modifier is specified, print the call nesting depth and the
383 cumulative instruction count at each call or return. Otherwise,
384 only print when the matching return is hit.
385 .It Cm call Ar function
388 Could be used for kernel dump with
395 Useful when testing MMU/PMAP.
399 .Cm trace Ns Op Cm /u
403 .Cm where Ns Op Cm /u
409 option traces user space; if omitted,
414 is the number of frames to be traced.
417 is omitted, all frames are printed.
420 User space stack trace is valid
421 only if the machine dependent code supports it.
423 .Cm search Ns Op Cm /bhl
431 This command might fail in interesting
432 ways if it doesn't find the searched-for value. This is because
433 ddb doesn't always recover from touching bad memory. The optional
435 argument limits the search.
437 .Cm show all procs Ns Op Cm /m
441 Display all process information.
442 The process information may not be shown if it is not
443 supported in the machine, or the bottom of the stack of the
444 target process is not in the main memory at that time.
447 modifier will alter the display to show VM map
448 addresses for the process and not show other info.
449 .It Cm show registers Ns Op Cm /u
450 Display the register set.
453 option is specified, it displays user registers instead of
454 kernel or currently saved one.
459 modifier depends on the machine. If
460 not supported, incorrect information will be displayed.
462 .Cm show map Ns Op Cm /f
469 modifier is specified the
470 complete map is printed.
472 .Cm show object Ns Op Cm /f
475 Prints the VM object at
479 option is specified the
480 complete object is printed.
481 .It Cm show ktr Ns Op Cm /v
482 Prints the contents of
487 modifier is specified, timestamp, filename and line number are displayed
490 For every global token, it prints its address, exclusive owner address,
491 number of collisions and description.
492 .It Cm "show watches"
493 Displays all watchpoints.
496 .Ar addr Ns Op Li \&, Ns Ar size
498 Set a watchpoint for a region. Execution stops
499 when an attempt to modify the region occurs.
502 argument defaults to 4.
503 If you specify a wrong space address, the request is rejected
504 with an error message.
507 Attempts to watch wired kernel memory
508 may cause unrecoverable error in some systems.
509 Watchpoints on user addresses work best.
510 .It Cm dwatch Ar addr
511 Delete a watchpoint around
513 .It Cm hwatch Ar addr Ns Op Li \&, Ns Ar size
514 Set a hardware watchpoint for a region.
520 Requires hardware support.
521 You can only have a couple of active hardware watchpoints
522 at a time depending on your hardware.
523 .It Cm dhwatch Ar addr Ns Op Li \&, Ns Ar size
524 Delete a hardware watchpoint that monitors the specified memory range.
525 For a watchpoint to be deleted the provided memory range must be completely
526 within the monitored memory range.
530 If the kernel was compiled with
532 call the ACPICA debugger.
533 For more information, see the
534 .Dq ACPI Component Architecture User Guide and Programmer Reference .
536 Toggles between remote GDB and DDB mode. In remote GDB mode, another
537 machine is required that runs
539 using the remote debug feature, with a connection to the serial
540 console port on the target machine. Currently only available on the
544 Print a short summary of the available commands and command
548 The debugger accesses registers and variables as
550 Register names are as in the
551 .Dq Cm show registers
553 Some variables are suffixed with numbers, and may have some modifier
554 following a colon immediately after the variable name.
555 For example, register variables can have a
557 modifier to indicate user register (e.g.,
560 Built-in variables currently supported are:
561 .Bl -tag -width tabstops -compact
563 Input and output radix
565 Addresses are printed as 'symbol'+offset unless offset is greater than maxoff.
567 The width of the displayed line.
569 The number of lines. It is used by "more" feature.
578 Almost all expression operators in C are supported except
586 .Bl -tag -width Identifiers
588 The name of a symbol is translated to the value of the symbol, which
589 is the address of the corresponding object.
593 can be used in the identifier.
594 If supported by an object format dependent routine,
596 .Oo Em filename : Oc Em func : lineno ,
598 .Oo Em filename : Oc Ns Em variable ,
600 .Oo Em filename : Oc Ns Em lineno
601 can be accepted as a symbol.
603 Radix is determined by the first two letters:
609 decimal; otherwise, follow current radix.
615 address of the start of the last line examined.
616 Unlike `dot' or `next', this is only changed by
622 last address explicitly specified.
623 .It Li \&$ Ns Em variable
624 Translated to the value of the specified variable.
625 It may be followed by a
627 and modifiers as described above.
628 .It Em a Ns Li \&# Ns Em b
629 a binary operator which rounds up the left hand side to the next
630 multiple of right hand side.
631 .It Li \&* Ns Em expr
632 indirection. It may be followed by a
634 and modifiers as described above.
642 debugger was developed for Mach, and ported to
644 This manual page translated from
646 macros by Garrett Wollman.