[Debug]Kernel panic学习笔记(二)

来源:互联网 发布:淘宝的市场定位 编辑:程序博客网 时间:2024/05/14 00:33

1,发生kernel panic后相关的调试方法

点击打开链接

点击打开链接

example[<ffffffc0002035a8>] el1_irq+0x68  其中:ffffffc0002035a8 表示函数地址,+0x68表示的是偏移。
 (cpu_idle+0x74/0xe4) from [<c4508930>] (start_kernel+0x298/0x2f4)是说start_kernel()调用了cpu_idle,其中start_kernel(),cpu_idle()函数的长度分别是0x2f4 0xe4


2, 如何分析linux的dump文件



3,ARM各个寄存器的相关含义

pc 程序计数器, 指向当前指令的下条指令的地址lr 链接寄存器, 程序调用返回地址psr 当前程序状态寄存sp 堆栈指针ip 内部过程调用寄存器
fp 帧指针


4,Exception的含义

Exception:Events that alters the normal sequence of execution and force the processor to execute special instructions in a privileged state
Synchronous:  
page fault(devide by 0) 
Prefetch abort:
[The prefetch abort exception] Occurs when the processor attempts to execute an instruction that has prefetched from an illegal address, that is, an address that the memory management subsystem has determined is inaccessible to the processor in its current mode.
Prefetch Abort occurs when you try to execute code from non-existing memory regions.
For example: BL 0X 41000000 (When the system does not have address 0x41000000)
Data abort: [The Data Abort exception] Occurs when a data transfer instruction attempts to load or store data at an illegal address
Data load, Data access
Asynchronous: interrupt
     data abortarm异常的一种。当程序试图读或者写一个不合法的内存地址时发生(没有权限访问或者不存在的地址), 可以通过以下方式计算不合法的内存地址:
    R14(LR)-8得到导致data abort异常的指令,从指令的寄存器中得到需要操作的地址。
    一般而言,导致这种异常的指令为STR,LDR(涉及到内存读写的指令)。反应在C或者C++语言里,一般是某个指针指向的地址有问题或者存储指针的地址有问题。
 
prefetch abort exception:
   Prefetch Abort occurs when you've attempted to execute code at an invalid memory address.
   预取指令异常。ARM CPU根据一个地址预取指令,发现地址取不出数据或者无法访问,就会触发预取指异常。
   一般是B(执行跳转分支指令)触发。发生此种问题时,需要检查程序的mem map是否有问题。


5,objdump & nm & addr2line等工具的作用
点击打开链接
arm-linux-androideabi-objdump  反汇编目标文件或者可执行文件
arm-linux-androideabi-nm   列出一个目标文件中的各种符号 
arm-linux-androideabi-addr2line    根据一个地址定位目标文件的代码行  $ addr2line -a 0xc0748e10 -e vmlinux


6, dmesg
dmesg displays the current contents of “__log_buf”.




0 0