What do you do if a kernel dumped core but you did not expect it,
and it is therefore not compiled using config -g
? Not
everything is lost here. Do not panic!
Of course, you still need to enable crash dumps. See above for the options you have to specify in order to do this.
Go to your kernel config directory
(/usr/src/sys/arch/conf
)
and edit your configuration file. Uncomment (or add, if it does not
exist) the following line:
makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
Rebuild the kernel. Due to the time stamp change on the Makefile,
some other object files will be rebuilt, for example
trap.o
. With a bit of luck, the added
-g
option will not change anything for the generated
code, so you will finally get a new kernel with similar code to the
faulting one but with some debugging symbols. You should at least verify the
old and new sizes with the size(1) command. If there is a
mismatch, you probably need to give up here.
Go and examine the dump as described above. The debugging symbols
might be incomplete for some places, as can be seen in the stack trace
in the example above where some functions are displayed without line
numbers and argument lists. If you need more debugging symbols, remove
the appropriate object files, recompile the kernel again and repeat the
gdb -k
session until you know enough.
All this is not guaranteed to work, but it will do it fine in most cases.
All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/
Questions that are not answered by the
documentation may be
sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.