| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 4 年前 | ||
| 3 年前 | ||
| 4 年前 | ||
| 4 年前 | ||
| 4 年前 |
How to create vmcores for tests
-
Boot a FreeBSD VM with as little memory as possible and create a core dump per
FreeBSD Handbook Kernel Debugging Chapter_. Note that you may need to reboot with more memory after the kernel panic as otherwise savecore(8) may fail.For instance, I was able to boot FreeBSD and qemu-system-x86_64 with 128 MiB RAM but had to increase it to 256 MiB for the boot after kernel panic.
-
Transfer the kernel image (
/boot/kernel/kernel) and vmcore (/var/crash/vmcore.latest) from the VM. -
Patch libfbsdvmcore using
libfbsdvmcore-hacks.patchand build LLDB against the patched library. -
Patch LLDB using
lldb-minimize-processes.patchand build it.WARNING: LLDB will now modify core files in order to make the resulting test vmcores smaller. Make a backup if necessary.
-
Do a test run of
test.scriptin LLDB against the kernel + vmcore::lldb -b -s test.script --core /path/to/core /path/to/kernel
If everything works fine, the LLDB output should be interspersed with
%RDlines. The vmcore will also be modified to shorten the process list inallproc. -
Open the vmcore in the patched LLDB again and choose interesting threads for testing. Update thread numbers in
test.scriptif necessary. -
Use the
copy-sparse.pytool to create a sparse version of the vmcore::lldb -b -s test.script --core /path/to/core /path/to/kernel | grep '^% RD' | python copy-sparse.py /path/to/core vmcore.sparse -
Compress the sparse vmcore file using
bzip2::bzip2 -9 vmcore.sparse
.. _FreeBSD Handbook Kernel Debugging Chapter: https://docs.freebsd.org/en/books/developers-handbook/kerneldebug/