Linux kernel panic

Linux panic分为hard panics(AIeee)和soft panic(Oops)两种主要类型的kernel panic

常见linux kernel panic报错内容:

kernel panic - not syncing: fatal exception in interrupt

kernel panic - not syncing: Attempted to kill the idle task

kernel panic - not syncing: Killing interrupt handler

kernel panic - not syncing: Attempted to kill init


1、内核在crush的时候会打印如下:

Linux kernel panic_第1张图片

1)要在内核中添加配置如下,否则Call Trace只打印地址而不会打印地址对应的符号

General Setup -->

    -*- Configure standard kernel features -->

        [*] Load all symbols for debugging/ksymoops


2)上图中一些符号的意思

epc: exception program counter

ra: return address


2、查看System.map文件

在Call Trace中有一行“[<8029f72c>] dwc_otg_pcd_ep_queue+0xec/0x888”

意思是dwc_otg_pcd_ep_queue函数有0x888这么大,Oops发生在这个函数的0xec偏移处,

从System.map文件看到dwc_otg_pcd_ep_queue函数起始地址是0x8029f640,

于是发生Oops发生在0x8029f640 + 0xec = 0x8029f72c

说明:System.map文件保存函数等符号的地址。


3、使用gdb调试

编译时需要选择compile with debug info选项

执行gdb vmlinux.elf,进入gdb终端,

1)执行list *0x8029f72c或者list *(dwc_otg_pcd_ep_queue+0xec),如下,直接可以看出哪个文件哪一行了。

Linux kernel panic_第2张图片



4、其他

这里有一篇文章介绍ARM系统上kernel panic的小例子

http://www.opensourceforu.com/2011/01/understanding-a-kernel-oops/




你可能感兴趣的:(linux驱动)