46 lines · plain
1How to create vmcores for tests2===============================3 41. Boot a FreeBSD VM with as little memory as possible and create a core dump5 per `FreeBSD Handbook Kernel Debugging Chapter`_. Note that you may need to6 reboot with more memory after the kernel panic as otherwise savecore(8) may7 fail.8 9 For instance, I was able to boot FreeBSD and qemu-system-x86_64 with 128 MiB10 RAM but had to increase it to 256 MiB for the boot after kernel panic.11 122. Transfer the kernel image (``/boot/kernel/kernel``) and vmcore13 (``/var/crash/vmcore.latest``) from the VM.14 153. Patch libfbsdvmcore using ``libfbsdvmcore-hacks.patch`` and build LLDB16 against the patched library.17 184. Patch LLDB using ``lldb-minimize-processes.patch`` and build it.19 20 WARNING: LLDB will now modify core files in order to make the resulting21 test vmcores smaller. Make a backup if necessary.22 235. Do a test run of ``test.script`` in LLDB against the kernel + vmcore::24 25 lldb -b -s test.script --core /path/to/core /path/to/kernel26 27 If everything works fine, the LLDB output should be interspersed with28 ``%RD`` lines. The vmcore will also be modified to shorten the process29 list in ``allproc``.30 316. Open the vmcore in the patched LLDB again and choose interesting threads32 for testing. Update thread numbers in ``test.script`` if necessary.33 347. Use the ``copy-sparse.py`` tool to create a sparse version of the vmcore::35 36 lldb -b -s test.script --core /path/to/core /path/to/kernel |37 grep '^% RD' | python copy-sparse.py /path/to/core vmcore.sparse38 398. Compress the sparse vmcore file using ``bzip2``::40 41 bzip2 -9 vmcore.sparse42 43 44.. _FreeBSD Handbook Kernel Debugging Chapter:45 https://docs.freebsd.org/en/books/developers-handbook/kerneldebug/46