我正在尝试使用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
如果我为i386目标构建,一切正常。
我不太确定该怎么做,我读过它可能与Eclipse中的二进制解析器有关:
This link提到了解析器,this link描述了修复后的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
GDB和gdbinit文件是Eclipse默认值
答案 0 :(得分:3)
听起来好像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
GDB和gdbinit文件是Eclipse默认值
您安装了32位还是64位版本的CDT?
答案 1 :(得分:1)
在shell中,我相信GDB是64位:
~:gdb --version
GNU gdb (GDB) 7.0.1
Copyright (C) 2009 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 "x86_64-unknown-linux-gnu".
装货日期:
~:gdb -q /bin/date
Reading symbols from /bin/date...(no debugging symbols found)...done.
键入哪个gdb ,并在将该路径显式放入Eclipse中的调试配置后,我不再收到错误消息。
作为一个侧面说明,您如何找出默认使用哪个GDB Eclipse?
我下载了64位版本的Eclipse Indigo,它与CDT一起使用。