arm linux oops 的定位方法(转)

http://blog.chinaunix.net/space.php?uid=13182088&do=blog&id=2904576

Debug an oops

From BUG Wiki

Howto

  • Use openeembedded or poky(the bug device's build system) to build the devshell:
bitbake devshell

That will also build the toolchain that you could use to build the kenrel

  • download the kenrel:
svn co svn://ny-mirror.buglabs.net/bug/trunk/bug-linux-2.6.27.2
cd bug-linux-2.6.27.2
  • copy the defconfig of the default kenrel into the bug-linux-2.6.27.2 directory
cp .../com.buglabs.build.oe/meta-bug/packages/linux/linux-bug-2.6.27.2/defconfig-bug ./.config
  • make changes to the config:
make ARCH=arm xconfig
  • select the following options:
Show timing information on printks (PRINTK_TIME)
Debug preemptible kernel (DEBUG_PREEMPT)
Compile the kernel with debug info (DEBUG_INFO)
Verbose BUG() reporting (adds 70K) (DEBUG_BUGVERBOSE)

in kernel hackingNote that there is a find function in xconfig

  • source the devshell
source .../oetmp/deploy/glibc/addons/arm-angstrom-linux-gnueabi-angstrom-bug-devshell

as I use openembedded I have arm-angstrom-linux-gnueabi-angstrom-bug-devshell but your devshell script may be named differentlyalso: it will say "-bash: alias: `./configure': invalid alias name",just ignore the warning

  • build the kernel:
make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- LDFLAGS="" uImage
make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- LDFLAGS="" modules
make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- LDFLAGS="" INSTALL_MOD_PATH=".../bug-device/modules/" modules_install

replace arm-angstrom-linux-gnueabi- by the prefix of your toolchainname(for instance if you have arm-angstrom-linux-gnueabi-gcc the prefixwould be arm-angstrom-linux-gnueabi-)

replace uImage by zImage if you are using the redboot bootloader

  • install your kernel and copy the modules to the root filesystem of the bug device
  • reproduce the condition where there was an oops...you'll get something like that(in dmesg):
[42949536.610000] kernel BUG at arch/arm/mm/consistent.c:495!
[42949536.620000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[42949536.630000] pgd = c347c000
[42949536.630000] [00000000] *pgd=83487031, *pte=00000000, *ppte=00000000
[42949536.640000] Internal error: Oops: 817 [#1] PREEMPT
[42949536.640000] Modules linked in: rtc_isl12026 rfcomm libertas_sdio libertas hidp l2cap bluetooth g_ether ehci_hcd bugpm_apm apm_emulation bugnav bug_v4l2_capture bug_camera bug_audio arcotg_udc bmi_mdacc bmi_lcd_core bmi_vh
[42949536.640000] CPU: 0    Not tainted  (2.6.27.2 #116)
[42949536.640000] PC is at __bug+0x24/0x30
[42949536.640000] LR is at vprintk+0x330/0x398
[42949536.640000] pc : [<c0029580>]    lr : [<c0046864>]    psr: 20000013
[42949536.640000] sp : c5f4fc60  ip : c5f4fbd0  fp : c5f4fc6c
[42949536.640000] r10: c6c97400  r9 : c5c27b20  r8 : 00000000
[42949536.640000] r7 : c6daf7e0  r6 : 00000020  r5 : ffbdb000  r4 : bfbdb000
[42949536.640000] r3 : 00000000  r2 : c5f4e000  r1 : 80000013  r0 : 00000041
[42949536.640000] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[42949536.640000] Control: 00c5387f  Table: 8347c000  DAC: 00000015
[42949536.640000] Process tzap (pid: 4705, stack limit = 0xc5f4e260)
[42949536.640000] Stack: (0xc5f4fc60 to 0xc5f50000)
[42949536.640000] fc60: c5f4fc84 c5f4fc70 c002a658 c0029568 bfbdb000 c6dd2eb8 c5f4fd4c c5f4fc88 
[42949536.640000] fc80: c01fe584 c002a5ac 00000001 c007d794 72cfe72d c0433260 c5f4fd04 00000000 
[42949536.640000] fca0: c007f864 c0040e10 00000044 c7943d10 00000000 00000000 000200d2 c0433260 
[42949536.640000] fcc0: 00000001 c5f4e000 00000001 00000000 c0432d34 c0432d34 c004092c 00000001 
[42949536.640000] fce0: 000000d2 000000d2 c043325c 00000000 00000001 c3451360 c5f4fd74 c5f4fd08 
[42949536.640000] fd00: c007fac4 c007f554 00000001 00000044 00000000 00000000 c5f4fd3c c5c55cd8 
[42949536.640000] fd20: c5f4e000 c6daf7e0 c6dd2eb8 00000200 c6e3b000 00000000 c5c27b20 00000020 
[42949536.640000] fd40: c5f4fd84 c5f4fd50 c01ff34c c01fe44c c5c11a60 000000d2 c00930e8 ffffffff 
[42949536.640000] fd60: 00000000 c6e81dd0 c6e81dd0 00000001 00000001 c6e81b74 c5f4fda4 c5f4fd88 
[42949536.640000] fd80: c01d892c c01ff070 c6e81ac0 00000001 c8b93000 00000001 c5f4fdc4 c5f4fda8 
[42949536.640000] fda0: c01d7f50 c01d8910 c6e81b80 c8b93000 c6e81d58 00001100 c5f4fdd4 c5f4fdc8 
[42949536.640000] fdc0: c01d8008 c01d7e88 c5f4fdf4 c5f4fdd8 c01c7974 c01d7ffc 00000000 c8ca7000 
[42949536.640000] fde0: 00000004 c6e81b38 c5f4fe34 c5f4fdf8 c01c5474 c01c78f8 00008000 00000000 
[42949536.640000] fe00: 00000000 00000056 00000000 00000000 c5c27b20 00000002 c8ca706c c8ca7000 
[42949536.640000] fe20: c5f4fe70 be9ccb84 c5f4fe64 c5f4fe38 c01c5798 c01c50c8 00000001 00000014 
[42949536.640000] fe40: c5f4fe70 00000000 40146f2c be9ccb84 c5c27b20 00000001 c5f4ff1c c5f4fe68 
[42949536.640000] fe60: c01c3ac0 c01c5528 c031be04 c5c6e890 40050202 00000000 00000000 00000001 
[42949536.640000] fe80: 00000004 c5f4fe90 c005be44 c0411560 00000003 00000001 00000000 60000093 
[42949536.640000] fea0: 00000000 00000023 c5f4fee4 c5f4feb8 c0042edc c0040e10 00000000 c5f4fed8 
[42949536.640000] fec0: c5f4ff10 c6d96410 a0000013 00000023 c6d96400 c5f4e000 c5f4fefc c5f4fee8 
[42949536.640000] fee0: c015ef50 c0040e10 c75f0580 c75f0530 00000002 c5c27b20 40146f2c be9ccb84 
[42949536.640000] ff00: be9ccb84 c0025e68 c5f4e000 00000000 c5f4ff34 c5f4ff20 c01c4828 c01c39e0 
[42949536.640000] ff20: c01c551c c5c27b20 c5f4ff54 c5f4ff38 c00ad100 c01c4814 c5f4ff6c c5c6e890 
[42949536.640000] ff40: c5c27b20 40146f2c c5f4ff7c c5f4ff58 c00ad3cc c00ad08c 00000000 c00a0f14 
[42949536.640000] ff60: 00000004 be9ccb84 40146f2c c5c27b20 c5f4ffa4 c5f4ff80 c00ad43c c00ad128 
[42949536.640000] ff80: 00000005 00000000 00000001 00000003 00000002 00000036 00000000 c5f4ffa8 
[42949536.640000] ffa0: c0025ca0 c00ad404 00000001 00000003 00000004 40146f2c be9ccb84 00000000 
[42949536.640000] ffc0: 00000001 00000003 00000002 00000036 be9ccf4c 00000000 00000000 00000000 
[42949536.640000] ffe0: 00000000 be9ccb80 0000892c 400d696c 60000010 00000004 473a4b38 44524155 
[42949536.640000] Backtrace: 
[42949536.640000] [<c002955c>] (__bug+0x0/0x30) from [<c002a658>] (dma_cache_maint+0xb8/0x100)
[42949536.640000] [<c002a5a0>] (dma_cache_maint+0x0/0x100) from [<c01fe584>] (usb_hcd_submit_urb+0x144/0x9b4)
[42949536.640000]  r5:c6dd2eb8 r4:bfbdb000
[42949536.640000] [<c01fe440>] (usb_hcd_submit_urb+0x0/0x9b4) from [<c01ff34c>] (usb_submit_urb+0x2e8/0x320)
[42949536.640000] [<c01ff064>] (usb_submit_urb+0x0/0x320) from [<c01d892c>] (usb_urb_submit+0x28/0x7c)
[42949536.640000] [<c01d8904>] (usb_urb_submit+0x0/0x7c) from [<c01d7f50>] (dvb_usb_ctrl_feed+0xd4/0x158)
[42949536.640000]  r7:00000001 r6:c8b93000 r5:00000001 r4:c6e81ac0
[42949536.640000] [<c01d7e7c>] (dvb_usb_ctrl_feed+0x0/0x158) from [<c01d8008>] (dvb_usb_start_feed+0x18/0x1c)
[42949536.640000]  r7:00001100 r6:c6e81d58 r5:c8b93000 r4:c6e81b80
[42949536.640000] [<c01d7ff0>] (dvb_usb_start_feed+0x0/0x1c) from [<c01c7974>] (dmx_ts_feed_start_filtering+0x88/0xf8)
[42949536.640000] [<c01c78ec>] (dmx_ts_feed_start_filtering+0x0/0xf8) from [<c01c5474>] (dvb_dmxdev_filter_start+0x3b8/0x460)
[42949536.640000]  r7:c6e81b38 r6:00000004 r5:c8ca7000 r4:00000000
[42949536.640000] [<c01c50bc>] (dvb_dmxdev_filter_start+0x0/0x460) from [<c01c5798>] (dvb_demux_do_ioctl+0x27c/0x3e8)
[42949536.640000]  r8:be9ccb84 r7:c5f4fe70 r6:c8ca7000 r5:c8ca706c r4:00000002
[42949536.640000] [<c01c551c>] (dvb_demux_do_ioctl+0x0/0x3e8) from [<c01c3ac0>] (dvb_usercopy+0xec/0x174)
[42949536.640000] [<c01c39d4>] (dvb_usercopy+0x0/0x174) from [<c01c4828>] (dvb_demux_ioctl+0x20/0x2c)
[42949536.640000] [<c01c4808>] (dvb_demux_ioctl+0x0/0x2c) from [<c00ad100>] (vfs_ioctl+0x80/0x9c)
[42949536.640000] [<c00ad080>] (vfs_ioctl+0x0/0x9c) from [<c00ad3cc>] (do_vfs_ioctl+0x2b0/0x2dc)
[42949536.640000]  r6:40146f2c r5:c5c27b20 r4:c5c6e890
[42949536.640000] [<c00ad11c>] (do_vfs_ioctl+0x0/0x2dc) from [<c00ad43c>] (sys_ioctl+0x44/0x68)
[42949536.640000]  r7:c5c27b20 r6:40146f2c r5:be9ccb84 r4:00000004
[42949536.640000] [<c00ad3f8>] (sys_ioctl+0x0/0x68) from [<c0025ca0>] (ret_fast_syscall+0x0/0x2c)
[42949536.640000]  r7:00000036 r6:00000002 r5:00000003 r4:00000001
[42949536.640000] Code: e1a01000 e59f000c eb0bc188 e3a03000 (e5833000) 
[42949537.180000] ---[ end trace c07d8f49bdf2bb24 ]---

The importants informations are:

pc : [<c0029580>]

and all the lines like that:

[<c002955c>] (__bug+0x0/0x30) from [<c002a658>] (dma_cache_maint+0xb8/0x100)

note them down

  • then on each address(an address loks like that: c0029580) do that on your computer:
[OE::arm-angstrom-linux-gnueabi-angstrom-bug]:~/bug-device/linux-bug$ arm-angstrom-linux-gnueabi-addr2line -f -e vmlinux c0029580

it will then show the line(and the function) of the backtrace:__bug/home/embedded/bug-device/linux-bug/arch/arm/kernel/traps.c:669

  • then you have 2 solutions:
    • bug report the problem to buglabs(include the backtrace and the addr2line outputs)
    • solve it yourself and send the patch to buglabs(so you won'thave to do the patch again at each new kernel release for the bugdevice)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值