我在获取调试器和gdb
使用 Linux 内核中的 FIQ 处理程序按预期工作时遇到了困难。它可以很好地触发设置 FIQ 触发条件的驱动程序代码,但不能使用 FIQ。
我正在使用来自 Olimex 的调试ARM-USB-TINY-H
器 +imx233-SJTAG
转换器(该板没有用于并行 JTAG 的引脚)来调试 i.mx233 板。
我正在gdb 7.5.1
使用 buildroot 进行编译,并且openocd 0.6.1
来自 Ubuntu 存储库。我启动 openocd:
# openocd -f olimex-arm-usb-tiny-h.cfg -f imx233.cfg
Open On-Chip Debugger 0.6.1 (2012-12-06-17:15)
....
Info : only one transport option; autoselect 'jtag'
trst_and_srst srst_pulls_trst srst_gates_jtag trst_push_pull srst_open_drain
adapter speed: 800 kHz
dcc downloads are enabled
fast memory access is enabled
Info : max TCK change to: 30000 kHz
Info : clock speed 789 kHz
Info : JTAG tap: imx23.cpu tap/device found: 0x079264f3 (mfg: 0x279, part: 0x7926, ver: 0x0)
Info : Embedded ICE version 6
Info : imx23.cpu: hardware has 2 breakpoint/watchpoint units
启动gdb
和设置断点:
# arm-buildroot-linux-uclibcgnueabi-gdb vmlinux
....
target remote :3333
Remote debugging using :3333
0x00000000 in ?? ()
(gdb) monitor halt
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x600000d3 pc: 0xc0019024
MMU: enabled, D-Cache: enabled, I-Cache: disabled
(gdb) hbreak mydriver_userland_write
Hardware assisted breakpoint 1 at 0xc02da930: file drivers/misc/mydriver.c, line 309.
(gdb) c
Continuing.
现在,当我从用户空间向驱动程序发送消息时,gdb 将愉快地触发。
Breakpoint 1, mydriver_userland_write (filp=0xc2cb81c0, buf=0x19d8600 "1\n\235\001t", count=2, f_pos=0xc2cb3f88) at drivers/misc/mydriver.c:309
309 size_t count, loff_t *f_pos) {
在处理了来自用户空间的信息后,我初始化了 FIQ 触发的条件,并返回。在gdb
中,我为 FIQ 设置断点。(第 60 行基本上是清除中断标志后的第 4 条汇编指令)
## Enable catching for FIQ vectors
(gdb) monitor arm9 vector_catch fiq
reset: don't catch
undef: don't catch
swi: don't catch
pabt: don't catch
dabt: don't catch
irq: don't catch
fiq: catch
## setup the breakpoint
(gdb) hbreak myfiq_handler.S:60
Hardware assisted breakpoint 1 at 0xc02db040: file drivers/misc/myfiq_handler.S, line 60.
(gdb) c
Continuing.
现在一切都设置好了,我触发了导致 FIQ 处理的条件,这就是发生奇怪结果的地方:
Program received signal SIGTRAP, Trace/breakpoint trap.
0xffff001c in ?? ()
在这一点上我真的无能为力:
## Try to see call trace
(gdb) bt
#0 0xffff001c in ?? ()
## Try stepping
(gdb) step
Cannot find bounds of current function
(gdb) next
Cannot find bounds of current function
monitor reg
显示像这样的寄存器状态http://paste.ubuntu.com/6113942/
如果我查看 vmlinux 映射文件,PC 会直接指出文件的最后 4 行:
ffe5095d A __crc_groups_free
fff3672c A __crc_directly_mappable_cdev_bdi
ffffe9f5 A __crc_cfg80211_wext_giwfrag
w __crc_softirq_work_list
如果我使用stepi
命令,整个执行似乎挂起。
我还在学习如何使用gdb
,所以我现在真的不知道在哪里寻找问题..欢迎任何建议!