内核异常kernel panic该如何定位?

异常信息:

[   3.970213] Switched to NOHz mode on CPU #0

[   3.987118] Unhandled kernel unaligned access[#1]:

[   3.996675] Cpu 0

[   4.000556] zero[$0]=00000000   at[$1]=00000075  v0[$2]=ffffffed   v1[$3]=00000001

[   4.016275]   a0[$4]=ffffffed    a1[$5]=806c105c  a2[$6]=8077e6d0   a3[$7]=00000000

[   4.031989]   t0[$8]=806c105d    t1[$9]=00000001  t2[$10]=8075b0c0  t3[$11]=031c0084

[   4.047705]   t4[$12]=8075c1b0 t5[$13]=00000007 t6[$14]=40008100  t7[$15]=00000000

[   4.063421]   s0[$16]=ffffffed  s1[$17]=00000001  s2[$18]=88113400  s3[$19]=80759518

[   4.079137]   s4[$20]=80759520  s5[$21]=80900000  s6[$22]=00000000  s7[$23]=88113408

[   4.094853]   t8[$24]=00000000  t9[$25]=8001a484  k0[$26]=80838708  k1[$27]=80015820

[   4.110569]   gp[$28]=88030000  sp[$29]=88031d58  s8[$30]=00000000  ra[$31]=80011f78

[   4.126283] Hi    : 00000000

[   4.132107] Lo    : 00000000

[   4.137971] epc  : 802b8ee0 regulator_is_enabled+0x14/0x8c

[   4.149243]     Not tainted

[   4.154899] ra   : 80011f78usb_audio_select+0x38/0xc0

[   4.165485] Status: 10000c03    KERNEL EXL IE

[   4.174486] Cause : 00800010

[   4.180316] This is Address error exception (load or instruction fetch)

[   4.193736] BadVA : 00000019

[   4.199566] PrId  : 7ae1024f (Ingenic Xburst)

[   4.208396] Modules linked in:

[   4.214578] Process swapper (pid: 1, threadinfo=88030000, task=88028000,tls=00000000)

[   4.230646] Stack : 00000001 88113400 80759518 80759520 80900000 ffffffed00000001 80011f78

[    4.247238]         88113400 8034bbc8 00000000 0000000088114980 00000001 88114980 8034bd58

[   4.264190]         8075952880759554 807823c8 0000000000000000 8029f7dc 807823c8 80759520

[   4.281142]         8084000080759554 807823c8 0000000000000000 00000000 00000000 8029fb40

[   4.298094]         88112a80 8022cd40 88114700 8811470080759520 807823c8 8075955488114700

[   4.315046]         ...

[   4.320348] Call Trace:

[   4.325293] [<802b8ee0>]regulator_is_enabled+0x14/0x8c

[   4.335897] [<80011f78>] usb_audio_select+0x38/0xc0

[   4.345790] [<8034bd58>] dwc2_jz_probe+0x170/0x468

[   4.355501] [<8029fb40>] driver_probe_device+0xa4/0x1e0

[   4.366092] [<8029fd38>] __driver_attach+0xbc/0xc4

[   4.375802] [<8029e6d8>] bus_for_each_dev+0x4c/0xa8

[    4.385690] [<8029f3a0>]bus_add_driver+0x1d4/0x2b8

[   4.395579] [<802a04c0>] driver_register+0x90/0x1a0

[   4.405468] [<80010564>] do_one_initcall+0x164/0x1f0

[   4.415526]

[   4.418526]

[   4.418530] Code: afbf001c  afb10018 00808021 <8c84002c> 0c17a987  24840040 8e04002c  8c820000  8c42000c

[   4.441405] ---[ end trace 13b17594e01c34f1 ]---

[   4.450749] Kernel panic - not syncing: Attempted to kill init!

[   4.462707] Rebooting in 3 seconds..Restarting after 4 ms

 

确认异常位置:

异常发生的函数名及其在函数里的位置:epc   :802b8ee0 regulator_is_enabled+0x14/0x8c

异常所在函数的上一级函数名称是:ra    : 80011f78usb_audio_select+0x38/0xc0

 

如何找到该异常函数据所在的文件及位置:

1)编译含debug info的内核包,打开如下选项:

CONFIG_DEBUG_KERNEL=y

CONFIG_DEBUG_INFO=y

 

2)用gdb调试vmlinux,通过b *0x80011f78打印出异常的代码位置:

mipsel-linux-android-gdb kernel/vmlinux

(gdb) b *0x80011f78

Breakpoint 1 at 0x80011f78: filearch/mips/xburst/soc-m200/chip-m200/glass/common/audio_usb_select.c, line 90.

 

Ps:gdbandroid的交叉编译工具包里,prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.7/bin/mipsel-linux-android-gdb,我列举的是mips,如果是arm,则选arm的工具。

你可能感兴趣的:(内核异常kernel panic该如何定位?)