码迷,mamicode.com
首页 > 其他好文 > 详细

用内核打印信息调试驱动程序

时间:2014-10-13 19:56:27      阅读:336      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   io   ar   strong   sp   

Problem Descriplation:
加载ed_device驱动后,ifconfig不显示ed0连接。但是ifconfig ed0会打印出数据。
ifconfig ed0 192.168.5.1时出现segmentation fault。

eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
Get the Device Major Number is 200
Get the Device Major Number is 201
Get the Device Major Number is 200
Get the Device Major Number is 201
Unable to handle kernel NULL pointer dereference at virtual address 00000000
//内核无法处理指向0的指针
pgd = c3b08000
[00000000] *pgd=33b22031, *pte=00000000, *ppte=00000000
Internal error: Oops: 817 [#1]
last sysfs file: /sys/devices/virtual/vc/vcs4/dev
Modules linked in: ed_device IrDAStudy
CPU: 0    Not tainted  (2.6.32.2-FriendlyARM #1)
PC is at memcpy+0x8c/0x29c
//8c是指令偏移,29c是函数大小。
//出错的地方

LR is at 0x30444500
pc : [<c014402c>]    lr : [<30444500>]    psr: 00000013
sp : c3b19dbc  ip : 0000001c  fp : c3b19dec
r10: c3b6e30c  r9 : c3b8f380  r8 : c3b8f380
r7 : 00000001  r6 : 00000080  r5 : bf006aa0  r4 : bf006f10
r3 : bf006594  r2 : ffffffe6  r1 : bf006af4  r0 : 00000000
Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: c000717f  Table: 33b08000  DAC: 00000015
Process ifconfig (pid: 796, stack limit = 0xc3b18270)
Stack: (0xc3b19dbc to 0xc3b1a000)
9da0:                                                                bf006aa0
9dc0: 00000080 00000001 c3b8f380 00000000 bf006f10 bf0065b4 bf006f10 bf006aa0
9de0: c3b19e04 c3b19df0 c02c4338 bf0065a4 bf006f10 000000c1 c3b19e24 c3b19e08
9e00: c02c3894 c02c4278 c3b18000 bed6ec80 c3b19e50 00008914 c3b19eac c3b19e28
9e20: c0305a8c c02c382c bed6ec80 bed6ec80 00000020 00000000 00008913 bf006f10
9e40: 0105a8c0 c3b19e60 c3b6e300 00000000 00306465 00000000 00000000 00000000
9e60: 000000c1 0105a8c0 bed6ef59 00000000 000000c1 0105a8c0 bed6ef59 00000000
9e80: bed6ef59 00008914 bed6ec80 c02b2240 00000003 c0030088 c3b18000 00000000
9ea0: c3b19ebc c3b19eb0 c0306f48 c0305370 c3b19edc c3b19ec0 c02b22b4 c0306d9c
9ec0: c3be4300 00008914 c02b2240 00000003 c3b19efc c3b19ee0 c00a79f0 c02b2250
9ee0: bed6ec80 bed6ec80 00008914 00000003 c3b19f7c c3b19f00 c00a7ce8 c00a79c8
9f00: c002f1e0 c0036ba0 000000b0 00100077 c3940780 000d1000 c3b19f7c c3b19f28
9f20: c008db44 c008d49c 00100077 00000000 00000000 000000b0 00000000 60000013
9f40: c3bf7210 c3940780 000d1000 c39407b4 000b0000 c3be4300 bed6ec80 00008914
9f60: 00000003 c0030088 c3b18000 00000000 c3b19fa4 c3b19f80 c00a8290 c00a7c8c
9f80: 40229000 00000000 00099ad8 bed6ee7c 0008ad68 00000036 00000000 c3b19fa8
9fa0: c002fee0 c00a8260 00099ad8 bed6ee7c 00000003 00008914 bed6ec80 00099ad8
9fc0: 00099ad8 bed6ee7c 0008ad68 00000036 0008adc8 00000000 40024000 00000000
9fe0: bed6ec83 bed6ec60 0000f0b8 401c0b1c 20000010 00000003 00000000 00000000
//出错的地方是地址c014402c,回溯这附近函数。
//cat /proc/kallsyms发现c014402c地址附近的函数是memcpy,地址为
c0143fa0。c0143fa0加偏移量8c就是c014402c。


Backtrace:
[<bf006594>] (ednet_open+0x0/0x4c [ed_device]) from [<c02c4338>] (dev_open+0xd0/0x12c)
 r5:bf006aa0 r4:bf006f10
[<c02c4268>] (dev_open+0x0/0x12c) from [<c02c3894>] (dev_change_flags+0x78/0x17c)
 r5:000000c1 r4:bf006f10
[<c02c381c>] (dev_change_flags+0x0/0x17c) from [<c0305a8c>] (devinet_ioctl+0x72c/0x810)
 r7:00008914 r6:c3b19e50 r5:bed6ec80 r4:c3b18000
[<c0305360>] (devinet_ioctl+0x0/0x810) from [<c0306f48>] (inet_ioctl+0x1bc/0x1c8)
[<c0306d8c>] (inet_ioctl+0x0/0x1c8) from [<c02b22b4>] (sock_ioctl+0x74/0x274)
[<c02b2240>] (sock_ioctl+0x0/0x274) from [<c00a79f0>] (vfs_ioctl+0x38/0x7c)
 r7:00000003 r6:c02b2240 r5:00008914 r4:c3be4300
[<c00a79b8>] (vfs_ioctl+0x0/0x7c) from [<c00a7ce8>] (do_vfs_ioctl+0x6c/0x5d4)
 r7:00000003 r6:00008914 r5:bed6ec80 r4:bed6ec80
[<c00a7c7c>] (do_vfs_ioctl+0x0/0x5d4) from [<c00a8290>] (sys_ioctl+0x40/0x68)
[<c00a8250>] (sys_ioctl+0x0/0x68) from [<c002fee0>] (ret_fast_syscall+0x0/0x28)
 r7:00000036 r6:0008ad68 r5:bed6ee7c r4:00099ad8
Code: e4805004 e4806004 e4807004 e4808004 (e480e004)
---[ end trace cb70d696cb70d696 ]---


Reference

[1].http://liu1227787871.blog.163.com/blog/static/20536319720126101202205/



用内核打印信息调试驱动程序

标签:des   style   blog   http   color   io   ar   strong   sp   

原文地址:http://my.oschina.net/lvyi/blog/330206

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!