gcc - arm-none-eabi-gdb 和 openocd : Malformed response to offset query, qOffsets?

标签 gcc gdb arm openocd

我正在尝试使用 GDB 使用 OpenOCD 和 GNU ARM 工具链(随 MacPorts 安装)调试 Stellaris LM3S8962 评估板,每当我在 GDB 中设置远程目标时,它总是返回“Malfomred 对偏移查询的响应,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 控制台上出现 未定义的调试原因 6 - 目标需要重置...不确定现在发生了什么,但似乎更接近正常运行

更新 2

如果我不加载文件 'main.axf' 或 'main.o' 我没有遇到 Remote 'g' 数据包回复太长 但我没有收到任何符号...我注意到其他网站主要处理 .elf 扩展名。有什么区别?我正在使用来自 StellarisWare 的“Hello World”示例,它通过 make 命令生成 main.axf、main.bin(闪存写入和运行良好)、main.d、main.o。我的 Makefile 有什么奇怪的地方吗?

最佳答案

这是一个类似于@athquad 提到的补丁。有关更多信息,请参阅他的答案。感谢他有效地将我指向正确的位置,并且非常遗憾地提供了补丁但没有提供它。 :-P

http://pastebin.com/rdFF2eZd

针对 openocd 提交 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

关于gcc - arm-none-eabi-gdb 和 openocd : Malformed response to offset query, qOffsets?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7053067/

相关文章:

c - GCC 预处理器不工作?带或不带注释的大文件的编译时间

c++ - gdb os x sierra 10.12.3 不工作

linux - 在 MIPS Linux 中回溯时,GDB 如何找到函数的符号?

c++ - 工作程序在 'clean machine' 上遇到非法指令错误?

c++ - 为arm编译qwt

c - 警告不是编译时常量的函数参数

c - 如何在 GCC C 中获取对齐的打包结构数组?

c++ - 升级到 Mojave 后无法使用 'hello world' 编译 C++ `#include`

arm - ARM 弱内存模型保证了哪些顺序

assembly - 如何在 ARM 中读取单字节序列?