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.
本文及其他文件,可由此下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/。
若有 FreeBSD 方面疑問,請先閱讀
FreeBSD 相關文件,如不能解決的話,再洽詢
<questions@FreeBSD.org>。
關於本文件的問題,請洽詢
<doc@FreeBSD.org>。