DDB(8)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… DDB(8) β€” the ddb girlie's guide to poking the kernel debugger ✨

ok so real talk: ddb is a lil system management utility (the man page calls it a "System Manager's Manual" situation) that lets u tweak certain aspects of the ddb(4) kernel debugger from user space πŸ’– β€” specifically the stuff that isn't set at compile-time and isn't easy to do through sysctl(8) MIB entries. no cap, it's the missing piece 🫢


🌸 SYNOPSIS 🌸

ddb capture [-M -core] [-N -system] print
ddb capture [-M -core] [-N -system] status
ddb script scriptname
ddb script scriptname=script
ddb scripts
ddb unscript scriptname
ddb pathname

✨ DESCRIPTION ✨

okay so ddb configures certain aspects of the ddb(4) kernel debugger from user space β€” the ones that are not configured at compile-time, and not easily configured via sysctl(8) MIB entries. iconic behavior honestly πŸ‘‘

And to make ur life easier πŸŽ€ commands can be put in a file, and that file gets processed using ddb β€” that's the last line of the synopsis up there, ddb pathname. An absolute pathname must be used, ok? don't be out here with relative paths bestie 😭

The file gets read line by line and applied as arguments to the ddb utility. Whitespace at the beginning of lines is ignored πŸ™ˆ β€” and so are lines where the first non-whitespace character is # (comments, we love her πŸ’…).


πŸ¦‹ OUTPUT CAPTURE πŸ¦‹

The ddb utility can be used to extract the contents of the ddb(4) output capture buffer β€” either of the current live kernel πŸ”₯ or from the crash dump of a kernel on disk πŸ’€. The following debugger commands are available from the command line:

  • capture [-M core] [-N system] print β€” print the current contents of the ddb(4) output capture buffer ⭐
  • capture [-M core] [-N system] status β€” print the current status of the ddb(4) output capture buffer 🌈

πŸŽ€ SCRIPTING πŸŽ€

The ddb utility can also be used to configure aspects of ddb(4) scripting from user space β€” and the scripting support is described in more detail over in ddb(4) iykyk πŸ“–. Each of the debugger commands is available from the command line:

  • script scriptname β€” print the script named scriptname 🧚
  • script scriptname=script β€” define a script named scriptname. And listen πŸ‘€: since so many scripts contain characters that the shell interprets in special ways, it is advisable to enclose script in quotes β€” fr fr, save urself the pain πŸ’€
  • scripts β€” list currently defined scripts πŸ“‹
  • unscript scriptname β€” delete the script named scriptname πŸ’”

πŸ’œ EXIT STATUS πŸ’œ

The ddb utility exits 0 on success, and >0 if an error occurs. that's it, that's the vibe check 🌸


⭐ EXAMPLES ⭐

The following example defines a script that will execute when the kernel debugger is entered as a result of a break signal πŸ”₯:

ddb script kdb.enter.break="show pcpu; bt"

The following example will delete the script πŸ’…:

ddb unscript kdb.enter.break

For further examples, see the ddb(4) and textdump(4) manual pages 🫢


🌈 SEE ALSO 🌈

ddb(4), mac_ddb(4), textdump(4), sysctl(8) πŸ‘‘


πŸŽ€ HISTORY πŸŽ€

The ddb utility first appeared in FreeBSD 7.1 ⏳ β€” a whole era.


πŸ’– AUTHORS πŸ’–

Robert N M Watson 🫢


πŸ’€ BUGS πŸ’€

ngl, ideally ddb would not exist at all, because all pertinent aspects of ddb(4) could be configured directly via sysctl(8) πŸ™ˆ. that's the actual documented take, and honestly? she said what she said.


and that's the whole page bestie!! this lil Debian build is dated December 24, 2008 and the manual is DDB(8) β€” go forth and debug, mwah πŸ’‹βœ¨
πŸ“¦ where this page comes from