尝试远程使用 gdb 时出现奇怪的错误:我做错了什么?
我有一台 64 位远程计算机、anvil 和一个 32 位桌面。
我制作了一个名为 hello.c 的程序 在铁砧上我用它编译它
$ gcc -ggdb -o hello hello.c
它将在铁砧上正常运行和调试。
但我想从我的桌面上调试它(这样我就可以通过 emacs 使用调试器)
所以:
$gdbserver anvil:24000 hello
Process hello created; pid = 10991
Listening on port 24000
但是然后在桌面上,我尝试远程连接,而我得到的只是奇怪的错误 有一些连接迹象:在我输入目标远程anvil:24000后,另一端打印“从主机10.17.20.149进行远程调试”,这是我的桌面地址。
这是文字记录:
jla@jaspden-desktop$ gdb hello
GNU gdb (GDB) Fedora (7.2-51.fc14)
Copyright (C) 2010 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 "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jla/myco/chip_test/hello...done.
(gdb) target remote anvil:24000
Remote debugging using anvil:24000
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x0000003ed0100a80 in ?? ()
(gdb) b main
Breakpoint 1 at 0x4004b7: file hello.c, line 6.
(gdb) run
The "remote" target does not support "run". Try "help target" or "continue".
(gdb) continue
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000000004003f6 in _start ()
(gdb)
有人知道我做错了什么吗?
I've got a 64-bit remote machine, anvil, and a 32 bit desktop.
I make a program called hello.c
and on anvil I compile it with
$ gcc -ggdb -o hello hello.c
It will run and debug fine on anvil.
But I'd like to debug it from my desktop (so I can use the debugger through emacs)
So :
$gdbserver anvil:24000 hello
Process hello created; pid = 10991
Listening on port 24000
But then on the desktop, I try to connect remotely, and all I get is strange errors
There's some sign of connectivity: after I type target remote anvil:24000 the other end prints 'Remote debugging from host 10.17.20.149', which is my desktop address.
Here's a transcript:
jla@jaspden-desktop$ gdb hello
GNU gdb (GDB) Fedora (7.2-51.fc14)
Copyright (C) 2010 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 "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jla/myco/chip_test/hello...done.
(gdb) target remote anvil:24000
Remote debugging using anvil:24000
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x0000003ed0100a80 in ?? ()
(gdb) b main
Breakpoint 1 at 0x4004b7: file hello.c, line 6.
(gdb) run
The "remote" target does not support "run". Try "help target" or "continue".
(gdb) continue
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000000004003f6 in _start ()
(gdb)
Does anyone know what I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能会生成一个 64 位二进制文件(尽管我们无法从您目前提供的内容中确定)。 正如我之前所说的,anvil是64位机器没关系。重要的是您要调试的二进制文件。
file hello
说什么?这是一个问题:如果
hello
是 64 位二进制文件,那么您无法使用此版本的gdb
。您需要构建一个新版本,并配置--host=i686-linux
和--target=x86_64-linux
。This likely produces a 64-bit binary (though we can't tell for sure from what you've provided so far). As I said before, it doesn't matter that anvil is a 64-bit machine. What matters is what binary you are trying to debug.
What does
file hello
say?That's a problem: if
hello
is a 64-bit binary, then you can't debug it with this version ofgdb
. You will need to build a new version, configured with--host=i686-linux
and--target=x86_64-linux
.