免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 7892 | 回复: 20
打印 上一主题 下一主题

[内核模块] 关于 内核调试 kdump 与crash的疑问,查了很多资料还是没有明白 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-08-28 19:57 |只看该作者 |倒序浏览
关于 内核调试 kdump 与crash的疑问,最近想要利用这两个工具查下自己写的内核模块驱动的问题,但是这两个工具一直没有能够运行起来希望知道的指点一二。
是这样的我用的是centos6.5的系统,系统的内核版本是2.6.32-431.el6.i686;自己又重新编译了一个内核版本为2.6.32.14。先前编写内核模块加运行一直是在
2.6.32.14内核上的,但是最近发现程序会导致系统崩溃,所以想找下bug。因此就想用用kdump 与crash;kdump系统本身是有的,我只是修改了一下配置,但是
在安装crash中的kernel-debuginfo和其支持包kernel-debuginfo-common时候,发现http://debuginfo.centos.org/6  这个网站上根本就没有与版本2.6.32.14内核相匹配
的kernel-debuginfo和其支持包kernel-debuginfo-common 这两个包,上面所有的 只是centos系统内核版本相匹配的包。但是我是在 编译过的内核中来调试的啊,所以不
太明白我哪里有问题。应该不是用与centos本身系统所匹配的kernel-debuginfo和包kernel-debuginfo-common的吧?


还有一个疑问的地方是我目前有两个内核一个是2.6.32.14;一个是系统自带的。当内核模块运行崩溃时候,利用kdump时候我的理解是由2.6.32.14切换到2.6.32-431.el6.i686,不知道对不对。

下面是我自己找的与2.6.32.版本接近的kernel-debuginfo和kernel-debuginfo-common 这两个包,我crash之后就会出现问题,红字处。请大家指导下。


[root@csc csc]# crash

crash 6.1.0-5.el6
Copyright (C) 2002-2012  Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation
Copyright (C) 1999-2006  Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012  Fujitsu Limited
Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011  NEC Corporation
Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions.  Enter "help copying" to see the conditions.
This program has absolutely no warranty.  Enter "help warranty" for details.

crash: cannot find booted kernel -- please enter namelist argument


Usage:

  crash [OPTION]... NAMELIST MEMORY-IMAGE  (dumpfile form)
  crash [OPTION]... [NAMELIST]             (live system form)

Enter "crash -h" for details.
[root@csc csc]#




[root@csc csc]# crash /var/crash/127.0.0.1-2014-08-28-01:14:52/vmcore /usr/lib/debug/lib/modules/2.6.18-371.11.1.el5/vmlinux

crash 6.1.0-5.el6
Copyright (C) 2002-2012  Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation
Copyright (C) 1999-2006  Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012  Fujitsu Limited
Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011  NEC Corporation
Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions.  Enter "help copying" to see the conditions.
This program has absolutely no warranty.  Enter "help warranty" for details.

GNU gdb (GDB) 7.3.1
Copyright (C) 2011 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 "i686-pc-linux-gnu"...

crash: cannot determine base kernel version
crash: /usr/lib/debug/lib/modules/2.6.18-371.11.1.el5/vmlinux and /var/crash/127.0.0.1-2014-08-28-01:14:52/vmcore do not match!


Usage:

  crash [OPTION]... NAMELIST MEMORY-IMAGE  (dumpfile form)
  crash [OPTION]... [NAMELIST]             (live system form)

Enter "crash -h" for details.
[root@csc csc]#

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
2 [报告]
发表于 2014-08-28 20:29 |只看该作者
你的VMCORE和VMLINUX参数顺序反了。

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
3 [报告]
发表于 2014-08-28 20:30 |只看该作者
/usr/lib/debug/lib/modules/2.6.18-371.11.1.el5/vmlinux and /var/crash/127.0.0.1-2014-08-28-01:14:52/vmcore do not match!

请认真检查一下,你真正用的内核和这个/usr/lib/debug/lib/modules/2.6.18-371.11.1.el5/vmlinux 是否完全一致。

论坛徽章:
15
射手座
日期:2014-02-26 13:45:082015年迎新春徽章
日期:2015-03-04 09:54:452015年辞旧岁徽章
日期:2015-03-03 16:54:15羊年新春福章
日期:2015-02-26 08:47:552015年亚洲杯之卡塔尔
日期:2015-02-03 08:33:45射手座
日期:2014-12-31 08:36:51水瓶座
日期:2014-06-04 08:33:52天蝎座
日期:2014-05-14 14:30:41天秤座
日期:2014-04-21 08:37:08处女座
日期:2014-04-18 16:57:05戌狗
日期:2014-04-04 12:21:33技术图书徽章
日期:2014-03-25 09:00:29
4 [报告]
发表于 2014-08-29 08:38 |只看该作者
需要用完全匹配的debuginfo信息,既然你自己编的内核,就应该有vmlinux文件吧,只需要这个文件就可以了。。。

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
5 [报告]
发表于 2014-08-29 09:00 |只看该作者
晕,看到humjb的贴才发现你自己又编了一下内核。你自己的编译的内核生成的VMCORE,要用回你自己的VMLINUX文件!同时内核编译时要把调试信息打开。

论坛徽章:
0
6 [报告]
发表于 2014-08-29 20:25 |只看该作者
回复 3# Tinnal

您说的是 这句吗:
[root@csc csc]# crash /var/crash/127.0.0.1-2014-08-28-01:14:52/vmcore /usr/lib/debug/lib/modules/2.6.18-371.11.1.el5/vmlinux

如果是的话 我反过来也输入国,结果还是一样的


   

论坛徽章:
0
7 [报告]
发表于 2014-08-29 20:30 |只看该作者
回复 3# Tinnal

我现在运行的是2.6.32.14 这个版本的,也就是我自己下载的linux内核然后编译后的;但是为什么反而稳定版本的linux 源码例如 2.6.32.14
却找不到相应版本的kernel-debuginfo和kernel-debuginfo-common;我想问问稳定版本的linux的 kernel-debuginfo和kernel-debuginfo-common这两个上哪里下载,不是系统版本

   

论坛徽章:
0
8 [报告]
发表于 2014-08-29 20:35 |只看该作者
回复 4# humjb_1983

您的意思是不是,我自己在http://www.kernel.org/pub/linux/kernel/网站下载的内核编译以后,就不需要安装这两个kernel-debuginfo和kernel-debuginfo-common包了呢?如果可以找到vmlinux的话,可以直接用crash了,但是这样的话 我直接输入crash命令就会出现下面情况啊;

[root@csc csc]# crash

crash 6.1.0-5.el6
Copyright (C) 2002-2012  Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation
Copyright (C) 1999-2006  Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012  Fujitsu Limited
Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011  NEC Corporation
Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions.  Enter "help copying" to see the conditions.
This program has absolutely no warranty.  Enter "help warranty" for details.

crash: cannot find booted kernel -- please enter namelist argument


Usage:

  crash [OPTION]... NAMELIST MEMORY-IMAGE  (dumpfile form)
  crash [OPTION]... [NAMELIST]             (live system form)

Enter "crash -h" for details.
[root@csc csc]#


   

论坛徽章:
0
9 [报告]
发表于 2014-08-29 20:40 |只看该作者
回复 5# Tinnal

小弟刚刚接触linux内核,一切都是按照书本或者网络来的,难道比如在centos6.5上要进行内核驱动开发,不是 在https://www.kernel.org/这个网站上下载内核并且编译在新内核上进行驱动开发吗?centos6.5本身版本可以直接进行内核开发吗?


   

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
10 [报告]
发表于 2014-08-29 22:10 |只看该作者
回复 7# ierent168

kernel-debuginfo是发行版本发布的,不是官方发布的,发行版本选什么内核编译,就是同时发布什么版本的kernel-debuginfo,因此,不是所有版本的内核都参找到kernel-debuginfo。你既然自己编译了内核 ,就不用找kernel-debuginfo了,用自己编译出来的vmlinux就行了。

只实crach要求很简单,生的vmcore必须找到对应的vmlinux!
   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP