xref: /freebsd/sys/tools/gdb/README.txt (revision ea675a43f09ba569adf1dd17b4f1ced970e48de4)
1*ea675a43SMark JohnstonThis directory contains Python scripts that can be loaded by GDB to help debug
2*ea675a43SMark JohnstonFreeBSD kernel crashes.
3*ea675a43SMark Johnston
4*ea675a43SMark JohnstonAdd new commands and functions in their own files.  Functions with general
5*ea675a43SMark Johnstonutility should be added to freebsd.py.  sys/tools/kernel-gdb.py is installed
6*ea675a43SMark Johnstoninto the kernel debug directory (typically /usr/lib/debug/boot/kernel).  It will
7*ea675a43SMark Johnstonbe automatically loaded by kgdb when opening a vmcore, so if you add new GDB
8*ea675a43SMark Johnstoncommands or functions, that script should be updated to import them, and you
9*ea675a43SMark Johnstonshould document them here.
10*ea675a43SMark Johnston
11*ea675a43SMark JohnstonTo provide some rudimentary testing, selftest.py tries to exercise all of the
12*ea675a43SMark Johnstoncommands and functions defined here.  To use it, run selftest.sh to panic the
13*ea675a43SMark Johnstonsystem.  Then, create a kernel dump or attach to the panicked kernel, and invoke
14*ea675a43SMark Johnstonthe script with "python import selftest" in (k)gdb.
15*ea675a43SMark Johnston
16*ea675a43SMark JohnstonCommands:
17*ea675a43SMark Johnstonacttrace	Display a backtrace for all on-CPU threads
18*ea675a43SMark Johnston
19*ea675a43SMark JohnstonFunctions:
20*ea675a43SMark Johnston$PCPU(<field>[, <cpuid>])	Display the value of a PCPU/DPCPU field
21*ea675a43SMark Johnston$V(<variable>[, <vnet>])	Display the value of a VNET variable
22