xref: /freebsd/tools/debugscripts/README (revision 05248206f720394d95c2a7475429311df670a2e9)
10fa02ea5SGreg Lehey
20fa02ea5SGreg LeheyThis directory contains gdb macros for kernel debugging.  When you
30fa02ea5SGreg Leheybuild a debug kernel, the target "gdbinit" in the kernel Makefile will
40fa02ea5SGreg Leheycreate the correct .gdbinit files in the kernel build directory.  To
50fa02ea5SGreg Leheyperform kernel debugging, you would do:
60fa02ea5SGreg Lehey
70fa02ea5SGreg Lehey  # cd /usr/obj/usr/src/sys/GENERIC  (or name of kernel config)
80fa02ea5SGreg Lehey  # make gdbinit
90fa02ea5SGreg Lehey  # gdb kernel.debug
100fa02ea5SGreg Lehey  This GDB was configured as "i386-undermydesk-freebsd"...
110fa02ea5SGreg Lehey  Ready to go.  Enter 'tr' to connect to remote target
120fa02ea5SGreg Lehey  and 'getsyms' after connection to load kld symbols.
130fa02ea5SGreg Lehey  (kgdb)
140fa02ea5SGreg Lehey
150fa02ea5SGreg Lehey
16*290bb03cSChristian BruefferThis directory also contains a kgdb script that, given a crash dump number,
17*290bb03cSChristian Bruefferautomatically extracts the path to the kernel source, runs gdb to extract
18*290bb03cSChristian Bruefferinformation about kernel modules loaded, and then reruns gdb loading the
19cf02bf24SJohn-Mark Gurneynecessary symbols for the modules.  You need to make sure you build the
2032ba16b6SUlrich Spörleinmodules w/ debugging symbols separately to get things to work.
21