This chapter should give you an introduction how to obtain a crash dump after a kernel panic and how to extract useful information for the developers out of the dump.

-

[[!toc levels=3 ]]

***Contributed by Matthias Schmidt***

@@ -21,10+20,9 @@ To circumvent this problem you can change the default settings in `/etc/rc.conf`

-[[!table data="""

-| `dumpdev` | Indicates the device (usually a swap partition) to which a crash dump should be written in the event of a system crash.

- `dumpdir` | savecore(8) will save that crash dump and a copy of the kernel to the directory specified by the dumpdir variable. The default value is /var/crash. You can set this to another directory on another partition with more space available to safely obtain the dump. |

-

+[[!table header=no data="""

+> `dumpdev` | | Indicates the device (usually a swap partition) to which a crash dump should be written in the event of a system crash.

+> `dumpdir` | | savecore(8) will save that crash dump and a copy of the kernel to the directory specified by the dumpdir variable. The default value is /var/crash. You can set this to another directory on another partition with more space available to safely obtain the dump.

"""]]

If you are unsure about your swap partition device, use [swapinfo(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#swapinfo&section8) or look into `/etc/fstab` :

@@ -32,46+30,33 @@ If you are unsure about your swap partition device, use [swapinfo(8)](http://lea

# swapinfo

-

Device 1K-blocks Used Avail Capacity Type

-

/dev/ad0s1b 1048448 0 1048448 0% Interleaved

-

-

# cat /etc/fstab | grep swap

-

/dev/ad0s1b none swap sw 0 0

+### Enable debugging options in your custom kernel config

-

-

-### Enable debugging options in your kernel config

-

-

-

-If you don't know how to configure a custom kernel, look into [Configuring the DragonFly Kernel](kernelconfig.html). You have to add the following lines to compile your kernel with debugging symbols:

+If you run a custom kernel you have to add the following lines to compile your kernel with debugging symbols:

makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols

-

If you want additional support for the interactive kernel debugger [ddb(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#ddb&section4) and invariant debugging, also add these lines:

# Debugging for Development

-

options DDB

-

options DDB_TRACE

-

options INVARIANTS

+You don't have to do anything to get debugging enabled in the default GENERIC kernel as it's already there.

Before your machine reboots a crash dump is saved into your swap partition (if you have one and don't disabled crash dumps). Writing the dump to disk takes some time depending on your machine and the amount of RAM installed. This might look like this:

Now your machine reboots, checks its file system and finally extracts the crash dump from the swap partition to your `dumpdir` (see `rc.conf` setting above). If your `/var` partition is to small, you'll see an error similar to the following: