Patch below enables DWARF line decoding in ddb; e.g.,
Debugger() at Debugger+0x9 [../../../../arch/amd64/amd64/db_interface.c:405]
ddb_sysctl() at ddb_sysctl+0x1b4 [../../../../ddb/db_usrreq.c:104]
sys___sysctl() at sys___sysctl+0x216 [../../../../kern/kern_sysctl.c:229]
syscall() at syscall+0x297 [../../../../sys/syscall_mi.h:84]
--- syscall (number 202) ---
end of kernel
end trace frame: 0x7f7ffffcf1d7, count: -4
Full set of instructions to apply and test (assuming amd64 MP):
# Apply patch
patch < /path/to/diff
# Enable DEBUG="-g"
# uncomment ``makeoptions DEBUG="-g"'' line and save
# Build new kernel
# Build new boot(8)
Now reboot and boot the "nbsd" kernel. Stack traces in ddb should
include file and line numbers.
For file/line numbers to appear, all of the following are necessary:
1. New boot(8)
2. New kernel
3. Kernel built with DEBUG="-g"
4. Boot bsd.gdb instead of bsd
Under any other conditions, ddb should gracefully fall back to bare
stack traces. I've tested most combinations, but additional testing
- boot(8) now loads the ELF header string table so it can identify
section names. It also now loads the ".debug_line" section into
memory, and marks loaded sections with SHF_ALLOC.
- ddb when generating stack traces now checks if there's a section
named ".debug_line" that's marked SHF_ALLOC; and if so, ddb parses
the section contents to translate program counter values into
- New boot(8) should be backwards compatible with old kernels, because
they won't care if ".debug_line" is loaded; new bsd.gdb should be
compatible with old boot(8) because ".debug_line" isn't normally