(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