尝试远程使用gdb的奇怪错误:我做错了什么?

时间:2011-10-17 10:28:12

标签: gdb remote-debugging gdbserver

我有一台64位远程计算机,一台铁砧和一台32位桌面。

我创建了一个名为hello.c的程序 在铁砧上我用

编译它
  $ gcc -ggdb -o hello hello.c

它将在铁砧上运行和调试。

但是我想从我的桌面调试它(所以我可以通过emacs使用调试器)

所以:

$gdbserver anvil:24000 hello
Process hello created; pid = 10991
Listening on port 24000

但是在桌面上,我尝试远程连接,而我得到的只是奇怪的错误 有一些连接的迹象:输入目标远程铁砧: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) 

有谁知道我做错了什么?

1 个答案:

答案 0 :(得分:1)

  

有谁知道我做错了什么?

     

gcc -ggdb -o hello hello.c

这可能产生一个64位二进制文​​件(虽然我们无法确定你到目前为止提供的内容)。 As I said before,铁砧是64位机器并不重要。重要的是你要调试的二进制文件。

file hello说什么?

  

GNU gdb (GDB) Fedora (7.2-51.fc14)
  ...
  This GDB was configured as "i686-redhat-linux-gnu".

这是一个问题:如果hello是64位二进制文​​件,那么您无法使用此版本的gdb对其进行调试。您需要构建一个新版本,配置为--host=i686-linux--target=x86_64-linux