(1)從oops crash的地方開始查起,首先找到指標訪問錯誤的程式碼
a)重新編譯核心時,選上kernel hacking--->compile the kernel with debug info
---->kernel
debugging
使得核心包含調試資訊,
b)然後從Oops資訊中找到“PC is at
free_block+0x8c/0x168”
##########################################################
Unable to handle kernel paging request at
virtual address 000c0604 //非法指標地址
pgd = 40004000
[000c0604] *pgd=00000000
Internal error: Oops: 817 [#1]
Modules linked in:
CPU: 0
Not tainted (2.6.27.18 #221)
PC is at free_block+0x78/0x168 //當前指令地址
LR is at release_console_sem+0x19c/0x1b8 //函數返回地址
##########################################################
從system_map中查到free_block地址0x40097ac0,+0x78得到0x40097B38
c)在核心根目錄運行arm-wrs-linux-gnueabi-armv6jel_vfp-uclibc_small-gdb
vmlinux
就可以得到出錯行
[root@kqyang-hikvision
linux-2.6.27_svn_quyong]# arm-wrs-linux-gnueabi-armv6jel_vfp-uclibc_small-gdb
vmlinux
GNU gdb
(Wind River Linux Sourcery G++ 4.3-85) 6.8.50.20080821-cvs
Copyright
(C) 2008 Free Software Foundation, Inc.
License
GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is
free software: you are free to change and redistribute it.
There is
NO WARRANTY, to the extent permitted by law.
Type "show copying"
and
"show warranty" for details.
This GDB
was configured as "--host=i686-pc-linux-gnu
--target=arm-wrs-linux-gnueabi".
For bug
reporting instructions, please see:
<support@windriver.com>...
(gdb) l
*0x40097B38
0x40097b38 is in free_block (include/linux/list.h:93).
88 * the prev/next entries already!
89 */
90 #include <linux/kernel.h>
91 static inline void __list_del(struct
list_head * prev, struct list_head * next)
92 {
93 next->prev = prev;
94 prev->next = next;
95 }
96
97 /**
(gdb)
另外,有個關於oops分析的文章不錯,地址如下:
http://blog.chinaunix.net/space.php?uid=11134731&do=blog&cuid=1166585