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 $
61 .\" $DragonFly: src/share/man/man4/ddb.4,v 1.2 2003/06/17 04:36:58 dillon Exp $
67 .Nd interactive kernel debugger
71 To prevent activation of the debugger on kernel
73 .Cd options DDB_UNATTENDED
77 kernel debugger has most of the features of the old kdb,
78 but with a more rational syntax
81 If linked into the running kernel,
82 it can be invoked locally with the
86 The debugger is also invoked on kernel
89 .Va debug.debugger_on_panic
91 MIB variable is set non-zero,
97 The current location is called `dot'. The `dot' is displayed with
98 a hexadecimal format at a prompt.
99 Examine and write commands update `dot' to the address of the last line
100 examined or the last location modified, and set `next' to the address of
101 the next location to be examined or changed.
102 Other commands don't change `dot', and set `next' to be the same as `dot'.
104 The general command syntax is:
105 .Cm command Ns Op Li \&/ Ns Ar modifier
106 .Ar address Ns Op Li , Ns Ar count
108 A blank line repeats the previous command from the address `next' with
109 count 1 and no modifiers. Specifying
114 uses `dot'. A missing
117 to be 1 for printing commands or infinity for stack traces.
121 debugger has a feature like the
124 for the output. If an output line exceeds the number set in the
126 variable, it displays
128 and waits for a response.
129 The valid responses for it are:
131 .Bl -tag -compact -width SPC
137 abort the current command, and return to the command input mode
142 provides a small (currently 10 items) command history, and offers
143 simple emacs-style command line editing capabilities. In addition to
144 the emacs control keys, the usual ANSI arrow keys might be used to
145 browse through the history buffer, and move the cursor within the
151 Display the addressed locations according to the formats in the modifier.
152 Multiple modifier formats display multiple locations.
153 If no format is specified, the last formats specified for this command
156 The format characters are:
157 .Bl -tag -compact -width indent
159 look at by bytes (8 bits)
161 look at by half words (16 bits)
163 look at by long words (32 bits)
165 print the location being displayed
167 print the location with a line number if possible
169 display in unsigned hex
171 display in signed hex
173 display in unsigned octal
175 display in signed decimal
177 display in unsigned decimal
179 display in current radix, signed
181 display low 8 bits as a character.
182 Non-printing characters are displayed as an octal escape code (e.g., `\e000').
184 display the null-terminated string at the location.
185 Non-printing characters are displayed as octal escapes.
187 display in unsigned hex with character dump at the end of each line.
188 The location is also displayed in hex at the beginning of each line.
190 display as an instruction
192 display as an instruction with possible alternate formats depending on the
194 .Bl -tag -width MIPS -compact
196 don't assume that each external label is a procedure entry mask
198 don't round to the next long word boundary
200 print register contents
205 Execute an examine command with the last specified parameters to it
206 except that the next address displayed by it is used as the start address.
209 Execute an examine command with the last specified parameters to it
210 except that the last start address subtracted by the size displayed by it
211 is used as the start address.
212 .It Cm print Ns Op Cm /acdoruxz
215 according to the modifier character (as described above for
227 If no modifier is specified, the last one specified to it is used.
229 can be a string, in which case it is printed as it is. For example:
230 .Bd -literal -offset indent
231 print/x \&"eax = \&" $eax \&"\enecx = \&" $ecx \&"\en\&"
235 .Bd -literal -offset indent
240 .Cm write Ns Op Cm /bhl
241 .Ar addr Ar expr1 Op Ar "expr2 ..."
243 Write the expressions specified after
245 on the command line at succeeding locations starting with
247 The write unit size can be specified in the modifier with a letter
253 (long word) respectively. If omitted,
254 long word is assumed.
257 since there is no delimiter between expressions, strange
259 It's best to enclose each expression in parentheses.
262 .Li \&$ Ns Ar variable
266 Set the named variable or register with the value of
268 Valid variable names are described below.
269 .It Cm break Ns Op Cm /u
274 is supplied, continues
276 - 1 times before stopping at the
277 break point. If the break point is set, a break point number is
280 This number can be used in deleting the break point
281 or adding conditions to it.
285 modifier is specified, this command sets a break point in user space
288 option, the address is considered in the kernel
289 space, and wrong space address is rejected with an error message.
290 This modifier can be used only if it is supported by machine dependent
294 If a user text is shadowed by a normal user space debugger,
295 user space break points may not work correctly. Setting a break
296 point at the low-level code paths may also cause strange behavior.
297 .It Cm delete Ar addr
298 .It Cm delete Li \&# Ns Ar number
299 Delete the break point. The target break point can be specified by a
300 break point number with
304 specified in the original
307 .It Cm step Ns Op Cm /p
310 times (the comma is a mandatory part of the syntax).
313 modifier is specified, print each instruction at each step.
314 Otherwise, only print the last instruction.
317 depending on machine type, it may not be possible to
318 single-step through some low-level code paths or user space code.
319 On machines with software-emulated single-stepping (e.g., pmax),
320 stepping through code executed by interrupt handlers will probably
322 .It Cm continue Ns Op Cm /c
323 Continue execution until a breakpoint or watchpoint.
326 modifier is specified, count instructions while executing.
327 Some machines (e.g., pmax) also count loads and stores.
330 when counting, the debugger is really silently single-stepping.
331 This means that single-stepping on low-level code may cause strange
333 .It Cm until Ns Op Cm /p
334 Stop at the next call or return instruction.
337 modifier is specified, print the call nesting depth and the
338 cumulative instruction count at each call or return. Otherwise,
339 only print when the matching return is hit.
340 .It Cm next Ns Op Cm /p
341 .It Cm match Ns Op Cm /p
342 Stop at the matching return instruction.
345 modifier is specified, print the call nesting depth and the
346 cumulative instruction count at each call or return. Otherwise,
347 only print when the matching return is hit.
349 .Cm trace Ns Op Cm /u
355 option traces user space; if omitted,
360 is the number of frames to be traced.
363 is omitted, all frames are printed.
366 User space stack trace is valid
367 only if the machine dependent code supports it.
369 .Cm search Ns Op Cm /bhl
377 This command might fail in interesting
378 ways if it doesn't find the searched-for value. This is because
379 ddb doesn't always recover from touching bad memory. The optional
381 argument limits the search.
382 .It Cm show all procs Ns Op Cm /m
383 .It Cm ps Ns Op Cm /m
384 Display all process information.
385 The process information may not be shown if it is not
386 supported in the machine, or the bottom of the stack of the
387 target process is not in the main memory at that time.
390 modifier will alter the display to show VM map
391 addresses for the process and not show other info.
392 .It Cm show registers Ns Op Cm /u
393 Display the register set.
396 option is specified, it displays user registers instead of
397 kernel or currently saved one.
402 modifier depends on the machine. If
403 not supported, incorrect information will be displayed.
405 .Cm show map Ns Op Cm /f
412 modifier is specified the
413 complete map is printed.
415 .Cm show object Ns Op Cm /f
418 Prints the VM object at
422 option is specified the
423 complete object is printed.
424 .It Cm "show watches"
425 Displays all watchpoints.
428 .Ar addr Ns Li \&, Ns Ar size
430 Set a watchpoint for a region. Execution stops
431 when an attempt to modify the region occurs.
434 argument defaults to 4.
435 If you specify a wrong space address, the request is rejected
436 with an error message.
439 Attempts to watch wired kernel memory
440 may cause unrecoverable error in some systems such as i386.
441 Watchpoints on user addresses work best.
443 Toggles between remote GDB and DDB mode. In remote GDB mode, another
444 machine is required that runs
446 using the remote debug feature, with a connection to the serial
447 console port on the target machine. Currently only available on the
451 Print a short summary of the available commands and command
455 The debugger accesses registers and variables as
457 Register names are as in the
458 .Dq Cm show registers
460 Some variables are suffixed with numbers, and may have some modifier
461 following a colon immediately after the variable name.
462 For example, register variables can have a
464 modifier to indicate user register (e.g.,
467 Built-in variables currently supported are:
468 .Bl -tag -width tabstops -compact
470 Input and output radix
472 Addresses are printed as 'symbol'+offset unless offset is greater than maxoff.
474 The width of the displayed line.
476 The number of lines. It is used by "more" feature.
485 Almost all expression operators in C are supported except
493 .Bl -tag -width Identifiers
495 The name of a symbol is translated to the value of the symbol, which
496 is the address of the corresponding object.
500 can be used in the identifier.
501 If supported by an object format dependent routine,
503 .Oo Em filename : Oc Em func : lineno ,
505 .Oo Em filename : Oc Ns Em variable ,
507 .Oo Em filename : Oc Ns Em lineno
508 can be accepted as a symbol.
510 Radix is determined by the first two letters:
516 decimal; otherwise, follow current radix.
522 address of the start of the last line examined.
523 Unlike `dot' or `next', this is only changed by
529 last address explicitly specified.
530 .It Li \&$ Ns Em variable
531 Translated to the value of the specified variable.
532 It may be followed by a
534 and modifiers as described above.
535 .It Em a Ns Li \&# Ns Em b
536 a binary operator which rounds up the left hand side to the next
537 multiple of right hand side.
538 .It Li \&* Ns Em expr
539 indirection. It may be followed by a
541 and modifiers as described above.
548 debugger was developed for Mach, and ported to
550 This manual page translated from
552 macros by Garrett Wollman.