开发者

Viewing Kernel logs after crash

I'm debugging a 开发者_如何学Csystem crash. I got OOPS message and found the buggy piece of code. I wish I had the output of dmesg just before the crash. However, I have the System.map file for the kernel. How can I use it to view the last messages collected by the ring buffer used by dmesg.

The log messages are certainly being appended to some logfile in the RAM. Can you help me to find the address where the logfile is being created or how can I extract the logfile?

~Thanks


Amit,

In my experience developing Linux device drivers, I've found serial debugging indispensable. This of course assumes you have a second system available to catch the serial output.

To enable this functionality you need to do two things:

  • Enabled SERIAL_8250_CONSOLE in your kernel. If you prefer using make menuconfig it can be found under Device Drivers \--> Character devices \--> Serial drivers \--> Console on 8250/16550 and compatible serial port.

  • Also you need to boot your kernel with the following parameters to keep both your normal screen display working along with serial output console=tty0 console=ttyS0,115200.

  • Connect serial port from your development station to serial port on another station (I usually use a Windows machine running HyperTerm).

Again, this is just an option that I have found invaluable in Linux debugging. I hope you can put it to good use.


easier than finding a serial cable these days (my 2 notebooks doesn't even have one serial port), but only works with the crash happens after syslogd can write to disk

boot, crash, boot a livecd, read /var/log/messages

if it happens before you have filesystem, you may have luck using a loghost too via UDP. see syslog/syslog-ng manual

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜