tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to read crash log of NetBSD 7.0.2?



On Tue, Feb 28, 2017 at 10:50:04PM +0800, Jia-Ju Bai wrote:
 > Unluckily, after my driver is loaded, I do not see any my "printf" messages
 > on the screen before the crash occurs :(

Most likely the problem is either it's dying before any of your
prints, or it dies and resets itself and clears the screen before you
see anything.

One of the tricks, when you're trying to find out how far something
gets before dying, is to insert delays along with prints. Adding
delays tends to make drivers not work, but it also lets you see what
happens. Worst case is that you can see one print with a delay after
it, and then everything after that is broken because of the delay, but
this still lets you find how far you're getting by doing a binary
search. (It's slow going though.)

Another thing is, be sure to use a kernel with DIAGNOSTIC,
DDB_ONPANIC, and DEBUG turned on, and depending on what you're doing
maybe LOCKDEBUG too. And load up your code with KASSERTs.

Years ago I had a test machine that would wait a couple seconds after
a fatal crash before resetting and clearing the screen. This was
invaluable for kernel debugging. Unfortunately it was a 486 and it's
long gone...

 > After the rebooting of the crash, I do not see useful messages in
 > /var/log/messages or using "dmesg" command. I find two files in /var/crash:
 > netbsd.0.gz and netbsd.0.core.gz. And I uncompress them and open them using
 > "vim", but they are not readable :(

Run gdb on the kernel and use "target kvm netbsd.0.core" after
uncompressing it.

You're better off using the original kernel image and not the one
saved by savecore - I have found that sometimes the one saved in
/var/crash is broken. Also, for better results still, set 'makeoptions
DEBUG="-g"' in the kernel config and use gdb on the netbsd.gdb left in
the kernel build directory; that will have full debug info.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index