我有一个数据库服务器在一个目标上,我像这样发射gdbserver :2345 /bin/ls
。接下来,我从主机连接 gdb,并尝试发出下一个命令:
(gdb) target remote 192.168.1.2:2345
Remote debugging using 192.168.1.2:2345
warning: Architecture rejected target-supplied description
[New Thread 686]
(gdb) Remote 'g' packet reply is too long: 00000000c10ed6be0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d00dd6be0000000030fe0d40100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
(gdb) i thr
Id Target Id Frame
* 1 Thread 686 (running)
(gdb) interrupt
(gdb) interrupt 1
(gdb) interrupt 2
(gdb) i thr
Id Target Id Frame
* 1 Thread 686 (running)
(gdb) bt
Target is executing.
(gdb) c
Continuing.
Cannot execute this command while the selected thread is running.
我认为这可能是 gdb 损坏的原因是奇怪的消息,尝试谷歌。发现两个假设。这是一个男人假设gdb(尽管恕我直言,目标上正在运行数据库服务器应该发送抽象的独立于架构的命令)需要设置它正在调试的架构。但它不起作用:
(gdb) set architecture armv7-a
Undefined item: "armv7-a".
(gdb) set architecture armv7
Undefined item: "armv7".
(gdb) set architecture armv5te
Undefined item: "armv5te".
我没有找到任何可以列出支持的体系结构的命令。这第二个假设那是数据库服务器本身需要配置神话选项--with-expat
。但...configure: WARNING: unrecognized options: --with-expat
我没有更多的想法了。那么,有人知道:如何中断目标上的线程吗?(顺便说一句,断点可以设置得很好,但它根本没有帮助,因为似乎 gdb 对正在运行的线程撒谎。如果线程运行中,正在调试中ls
立刻就消失了。)
虽然可以构建“多架构”gdb,但默认的 Ubuntu GDB(称为 gdb)是为了支持单一架构(主机 PC)而构建的。尽管它确实连接到任何 gdbserver,但您无法使用它调试其他 CPU。
您需要可以调试您的目标 (ARM) 并与目标上使用的 ABI 兼容的 gdb。
您应该通过工具链获得它,但如果没有,从源代码构建并不难。看sourceware.org/gdb/wiki/BuildingCrossGDBandGDBserver以获得简要说明。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)