在32位机器上远程调试64位进程

时间:2013-01-20 12:59:22

标签: linux gcc gdb intel

我正试图在我的32位英特尔笔记本电脑的远程英特尔64位机器上调试(一个简单的Hello World应用程序,没有测试错误)。

我跑

gcc -g -o cexecute cexecute.c
gdbserver localhost:2345 cexecute

在远程机器上。

将笔记本本地端口2345转发到同一远程端口后,运行gdb并输入

target remote localhost:2345

我明白了:

GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 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-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target remote localhost:2345
Remote debugging using localhost:2345
warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration
of GDB.  Attempting to continue with the default i386:x86-64 settings.

warning: Architecture rejected target-supplied description
Remote register badly formatted: T0506:0000000000000000;07:e0dbffffff7f0000;10:c0b6ddf7ff7f0000;thread:p64bc.64bc;core:6;
here: 00000000;07:e0dbffffff7f0000;10:c0b6ddf7ff7f0000;thread:p64bc.64bc;core:6;

我很困惑因为我之前有这个工作。对于反向问题(来自64位机器的32位应用程序),有类似的问题建议执行set architectureRemote debug error with GDB

我尝试了各种各样的论点并没有成功。目标平台类型i386:x86-64似乎也是正确的。两台机器都运行ubuntu linux。自从我上次在两台机器上安装版本更新后成功运行gdb。缺陷在哪里?

1 个答案:

答案 0 :(得分:3)

  

自从我上次在两台计算机上安装版本更新后成功运行gdb。缺陷在哪里?

缺陷必须与您的记忆有关:i*86-linux-*版本的GDB无法调试x86-64进程,您必须构建gdb作为交叉调试器(正如Mats Petersson已经建议的那样),或者从某个地方获得预先构建的调试器。

类似的东西:

./configure --target=x86_64-linux-gnu --host=i686-linux-gnu \
            --build=i686-linux-gnu CC=gcc AR=ar RANLIB=ranlib

应该有用。