xref: /freebsd/sys/tools/gdb/README.txt (revision df21a004be237a1dccd03c7b47254625eea62fa9)
1This directory contains Python scripts that can be loaded by GDB to help debug
2FreeBSD kernel crashes.
3
4Add new commands and functions in their own files.  Functions with general
5utility should be added to freebsd.py.  sys/tools/kernel-gdb.py is installed
6into the kernel debug directory (typically /usr/lib/debug/boot/kernel).  It will
7be automatically loaded by kgdb when opening a vmcore, so if you add new GDB
8commands or functions, that script should be updated to import them, and you
9should document them here.
10
11When improving these scripts, you can use the "kgdb-reload" command to reload
12them from /usr/lib/debug/boot/kernel/gdb/*.
13
14To provide some rudimentary testing, selftest.py tries to exercise all of the
15commands and functions defined here.  To use it, run selftest.sh to panic the
16system.  Then, create a kernel dump or attach to the panicked kernel, and invoke
17the script with "python import selftest" in (k)gdb.
18
19Commands:
20acttrace	Display a backtrace for all on-CPU threads
21kgdb-reload     Reload all gdb modules, useful when developing the modules
22                themselves.
23
24Functions:
25$PCPU(<field>[, <cpuid>])	Display the value of a PCPU/DPCPU field
26$V(<variable>[, <vnet>])	Display the value of a VNET variable
27