网站大量收购独家精品文档,联系QQ:2885784924

Linux 驱动调试.ppt

  1. 1、本文档共18页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Linux 驱动调试

第十二讲 之二 驱动调试 主讲人:UUCP wuchangping@ 第一章 调试 1.1.工作环境配置 1) 安装好编译用的 kernel-source :RedHat :kernel-devel-xxx.rpm, suse:kernel-source-xxx.rpm,自己编译的kernel source ; 2)GCC包,gcc,g++,cpp, 3) as,ld,objdump,etc 4) glibc/uclibc 5) make 6) gdb 7)SSH 工具 : SSH secure Shell 用于windows 系统与Linux系统之间的文件传输 8)串口工具,用于调试拿log 信息,windos 下用超级终端或者 secureCRT,Linux 下用minicom ,C-Kermit 1.2 printk 在内核中printk()的级别定义: #define KERN_EMERG 0 /* system is unusable */ #define KERN_ALERT 1 /* action must be taken immediately */ #define KERN_CRIT 2 /* critical conditions */ #define KERN_ERR 3 /* error conditions */ #define KERN_WARNING 4 /* warning conditions */ #define KERN_NOTICE 5 /* normal but significant condition */ #define KERN_INFO 6 /* informational */ #define KERN_DEBUG 7 /* debug-level messages */ 通过/proc/sys/kernel/printk 文件可以调节printk的输出级别, 通过如下命令可以使得Linux内核的任何printk都被输出: #echo 8 /proc/sys/kernel/printk 同时设置 grub.conf : 在 Kernel 这一行加上 : console=tty0,console=ttyS0,115200 1.3 oops和panic 1.3.1 API oops DEBUG .定位 OOPS 示例:apioops.c: #include stdio.h #include stdlib.h Const char array[]=\x6b\xc0 ; int main(int argc, char *argv[]) { printf(%p\n, array); *(int *)0 = 0; } 1.)编译时打开complie with debug info选项(-g) ,选项 [root@localhost ~]# gcc -g -o apioops apioops.c 2)执行 api_oops: [root@localhost ~]# ./apioops 显示屏输出信息 0x4005e0 Segmentation fault [root@localhost ~]# 串口输出信息: apioops[28910]: segfault at 0000000000000000 rip 00000000004004c0 rsp 00007fff22e15760 error 6 rip 00000000004004c0 : 表示执行到这个位置是 出错 EIP RIP 值 一般表示代码运行时 ,出错的位置 3)调试 [root@localhost ~]# gdb apioops GNU gdb Fedora (6.8-27.el5) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later /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-redhat-linux-gnu... (gdb) 1.list 调试RIP 地址:很明显 出错在第11行 ,访问空指针

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档