内核panic后使用GDB调试
内核运行时若出现panic,可以根据EIT的值用GDB来定位出错代码:
例如我的出错代码的EIT的值为0x80cf7c00+0x6f,可以在GDB下用b或l方式来定位代码。
yin123@yin:~/work/XXXXX$ gdb ./android/out/target/product/Your_Image_Name/obj/kernel/vmlinux
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04
Copyright (C) 2012 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 "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/yin123/work/XXXXX/android/out/target/product/Your_Image_Name/obj/kernel/vmlinux...done.
(gdb) b *0x80cf7c6f
Breakpoint 1 at 0x80cf7c6f: file /home/yin123/work/XXXXX/linux-3.10/drivers/cpufreq/yyyyy.c, line 123.
(gdb) l *oc_thread+0x6f
0x80cf7c6f is in oc_thread (/home/yin123/work/XXXXX/linux-3.10/drivers/cpufreq/yyyyy.c:123).
warning: Source file is more recent than executable.
118 *(strchr(buf, ‘.‘)) = ‘\0‘;
119 sscanf(buf, "%u", &tmp_runtime);
120
121 /* get last recorded uptime */
122 get_data_from_sysfs(FILE_PATH, buf);
123 (strchr(buf, ‘ ‘)) = ‘\0‘;
124 sscanf(buf, "%u", &old_runtime);
125
126 if (tmp_runtime <= old_runtime)
127 {
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。