我正在尝试使用GDB调试Stellaris LM3S8962评估板,使用OpenOCD和GNU ARM工具链(随MacPorts安装),每当我在GDB中设置远程目标时,它总是返回“对偏移查询的错误响应,qOffsets”。什么可能出错?有什么我想念的吗?
[bcochran@narada arm]$ arm-none-eabi-gdb
GNU gdb (GDB) 7.3
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 "--host=x86_64-apple-darwin10.7.0 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) set remotebaud 115200
(gdb) set debug remote 1
(gdb) file ~/dev/eclipse_workspace/hello_world_arm/bin/main.axf
Reading symbols from /Users/bcochran/dev/eclipse_workspace/hello_world_arm/bin/main.axf...(no debugging symbols found)...done.
(gdb) target remote localhost:4444
Remote debugging using localhost:4444
Sending packet: $qSupported:qRelocInsn+#9a...putpkt: Junk: {{}~Open On
Nak
Sending packet: $qSupported:qRelocInsn+#9a...putpkt: Junk: Chip Debugger
>
Ack
Packet received: qSupported:qRelocInsn+
Packet qSupported (supported-packets) is supported
...
Packet qAttached (query-attached) is supported
Sending packet: $qOffsets#4b...Ack
Packet received: qOffsets
Malformed response to offset query, qOffsets
这是openocd输出......只要畸形响应遇到openocd就会丢弃telnet连接......
[bcochran@narada bin]$ openocd -f ../openocd/luminary.cfg -f ../openocd/stellaris.cfg
Open On-Chip Debugger 0.6.0-dev-00014-g827057f (2011-08-09-22:02)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.berlios.de/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
500 kHz
Info : clock speed 500 kHz
Info : JTAG tap: lm3s.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : lm3s.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection from 4444
Error: error during read: Connection reset by peer
Info : dropped 'telnet' connection
以下是我的arm-none-eabi- *工具链的版本输出......
[bcochran@narada tcl]$ arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/arm-none-eabi/4.6.1/lto-wrapper
Target: arm-none-eabi
Configured with: ../gcc-4.6.1/configure --prefix=/opt/local --target=arm-none-eabi --enable-languages=c,objc,c++,obj-c++ --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/arm-none-eabi-gcc --with-system-zlib --disable-nls --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --enable-stage1-checking --enable-multilib --with-newlib --enable-interwork
Thread model: single
gcc version 4.6.1 (GCC)
[bcochran@narada tcl]$ arm-none-eabi-gdb -v
GNU gdb (GDB) 7.3
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 "--host=x86_64-apple-darwin10.7.0 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
我可以使用工具链进行编译,并使用OpenOCD刷新生成的.bin文件。我只是通过搜索网络找不到“格式错误的回应”问题的解决方案。
提前感谢您的任何建议或帮助!
更新
感谢来自@ turbo-j和@ guy-sirton的答案,我能够进一步发展......到目前为止最有帮助的是我确实使用了错误的端口(4444而不是3333)但现在无论是否将-c "init" -c "halt" -c "reset halt"
添加到我的openocd命令字符串中,我都会得到以下信息:
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
Remote 'g' packet reply is too long: 0080004000000000040000220f0000002833405451332abc009600a4d2b86092c0c118c03040d6f0284dbb93204b40c2000000000c010020ffffffff550400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000001
(这是在qOffsets req / resp之后,现在已经过了)
在OpenOCD方面:
Info : accepting 'gdb' connection from 3333
Warn : acknowledgment received, but no packet pending
Info : dropped 'gdb' connection
有时在OpenOCD控制台上有一个undefined debug reason 6 - target needs reset
...不确定现在发生了什么,但它似乎更接近正常运行
更新2
似乎我没有加载文件'main.axf'或'main.o'我没有遇到Remote 'g' packet reply is too long
但我没有符号......我注意到其他网站主要处理扩展名为.elf。有什么不同?我正在使用StellarisWare的“Hello World”示例,它从make
命令生成main.axf,main.bin(flash写入并运行正常),main.d,main.o。我的Makefile有点奇怪吗?
答案 0 :(得分:4)
这是一个像@athquad所说的补丁。有关更多信息,请参阅他的回答感谢他有效地指出我在正确的位置,并确实提供补丁而不提供它是非常遗憾的。 :-P
修补程序针对openocd commit 631b80fd0835055bb385314f569f589b99d7441d
使用:(。/ configure选项取决于jtag硬件)
git clone git://git.code.sf.net/p/openocd/code openocd
cd openocd
patch -p1 < /path/to/patch/file
./bootstrap
./configure --enable-maintainer-mode --enable-ft2232_libftdi
nice make && sudo make install
答案 1 :(得分:3)
您使用了错误的端口。使用target remote localhost 3333
进行GDB到OpenOCD的连接。端口4444用于通过终端进行人工交互,并且除了GDB连接之外还可以使用。
答案 2 :(得分:1)
我刚刚遇到了同样的“'g'数据包回复太长”的错误,并将其追溯到其原因。
似乎很长一段时间GNU ARM工具都使用了带有9个过时浮点寄存器的ARM模型。 OpenOCD对此很明智,并且响应GDB的寄存器请求提供虚拟值。但是,最近的包括GDB在内的eabi工具链已经发布,因此您的GDB不再需要这些寄存器 - 因此就是消息。
在OpenOCD源代码中,我修改了armv7m.c中的armv7m_get_gdb_reg_list()以使其工作,但我的补丁不够智能,无法知道正在使用哪个GDB版本 - 它只是使用#ifdef开关 - 所以它会需要更多的工作来与OpenOCD源代码集成。
任何想要的人都可以使用补丁。
答案 3 :(得分:0)
我在ARM上进行了很多远程调试,但使用了不同的处理器,操作系统和工具链:-)不过,这里有一些想法。
这个建议:
openocd -f openocd.cfg -c“init”-c“halt” -c“reset halt”
来自这里: http://michaldemin.wordpress.com/2010/02/22/part-2-debugging-with-gdb-and-openocd/
否则:
远程和gdb之间的远程gdb协议不匹配。您可以尝试使用不同版本的工具链。谷歌并找到适合他人的。
沟通问题。尝试降低波特率?确保串口参数合理。