For lack of a better place, here are some unorganized kernel debugging tips.

The GDB scripts I use are at https://github.com/bsdjhb/kdbg/ in the 'gdb' subdirectory.

Finding the range of corrupted data for a UMA use after a free panic

Finding the relative offset of the corruption:

(gdb) p (char *)p - mem
$1 = 17382
(gdb) find /w p, p+cnt, 0xdeadc0de
0xfffffe0149627790
....
(gdb) p (char *)0xfffffe0149627790 - (char *)p
$2 = 17352

In this case, the corrupted data was 17382 bytes long at an offset of 17382 within memory region.

Examining the most recent crash on a box

% kgdb -n last

Examining a crash from another box where the kernel isn't in /boot

This assumes the kernel and debug symbols are in the same relative sysroot, e.g. /tmp/foo/boot/kernel and symbols in /tmp/foo/usr/lib/debug/boot/kernel:

% gdb -iex "set sysroot /tmp/foo" /tmp/foo/boot/kernel/kernel
(gdb) target vmcore /path/to/vmcore

JohnBaldwin/KernelDebugTips (last edited 2021-06-19T00:16:52+0000 by JohnBaldwin)