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的時候會列印如下:
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),如下,直接可以看出哪個檔案哪一行了。
4、其他
這裡有一篇文章介紹ARM系統上kernel panic的小例子
http://www.opensourceforu.com/2011/01/understanding-a-kernel-oops/