附加到进程的Eclipse CDT调试 - 不是可执行格式:无法识别文件格式

Tre*_*ent 6 eclipse gdb eclipse-cdt

我正在尝试使用Eclipse和CDT来调试64位二进制文​​件.二进制文件是在Eclipse之外构建的,运行正常.我在eclipse之外启动二进制文件,然后尝试使用'C/C++ Attach to Application'调试配置类型附加到进程.

我可以从运行调试配置时弹出的列表中选择进程,但是,我收到以下错误消息:

Error in final launch sequence
Failed to execute MI command:
attach 22014
Error message from debugger back end:
"program.x64": not in executable format: File format not recognized
Run Code Online (Sandbox Code Playgroud)

如果我为i386目标构建,一切正常.

我不太清楚在哪里使用它,我已经读过它可能与Eclipse中的二进制解析器有关:

此链接提到解析器,此链接描述了已修复的PE解析器的错误.

我在Linux x64上使用Eclipse CDT 8.0.0运行Eclipse Indigo.我在project_properties/c ++ _ build/settings下尝试了'Elf Parser'和'GNU Elf Parser',但没有运气.

档案信息:

hostmachinea:file program.x64 
programs.x64: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
Run Code Online (Sandbox Code Playgroud)

GDB和gdbinit文件是Eclipse的默认值

Emp*_*ian 4

听起来 Eclipse 使用的 GDB 似乎是为 i386 构建的,因此无法调试 64 位二进制文​​件。您可能需要安装支持 64 位的 GDB。

当前 GDB 的错误消息如下所示:

$ ./gdb --version
GNU gdb (GDB) 7.3.50.20110809-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
...
This GDB was configured as "i686-linux".
...

$ ./gdb -q /bin/date
"/bin/date": not in executable format: File format not recognized
Run Code Online (Sandbox Code Playgroud)

GDB 和 gdbinit 文件是 Eclipse 的默认文件

您安装的是 32 位还是 64 位版本的 CDT?