【问题标题】:Strange errors trying using gdb remotely: What am I doing wrong?尝试远程使用 gdb 的奇怪错误:我做错了什么?
【发布时间】:2011-12-09 04:43:31
【问题描述】:

我有一个 64 位远程机器、砧和一个 32 位桌面。

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

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

它将在 anvil 上正常运行和调试。

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

所以:

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

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

有谁知道我做错了什么?

【问题讨论】:

标签: gdb remote-debugging gdbserver


【解决方案1】:

有谁知道我做错了什么?

gcc -ggdb -o hello hello.c

这可能会生成 64 位二进制文​​件(尽管我们无法从您目前提供的内容中确定)。 As I said before,anvil 是 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 进行配置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-06
    • 2017-12-06
    • 2011-06-13
    • 2010-10-16
    • 2020-05-31
    • 2019-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多