【问题标题】:Eclipse CDT debug attaching to process - not in executable format: File format not recognized附加到进程的 Eclipse CDT 调试 - 不是可执行格式:文件格式无法识别
【发布时间】:2011-11-04 04:49:09
【问题描述】:

我正在尝试使用带有 CDT 的 Eclipse 来调试 64 位二进制文​​件。该二进制文件是在 Eclipse 之外构建的,并且运行良好。我在 Eclipse 之外启动二进制文件,然后尝试使用“C/C++ 附加到应用程序”调试配置类型附加到进程。

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

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 的默认文件

【问题讨论】:

    标签: eclipse gdb eclipse-cdt


    【解决方案1】:

    听起来好像 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?

    【讨论】:

      【解决方案2】:

      在 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.
      

      键入 which gdb,然后将该路径显式放入 Eclipse 中的调试配置中,我不再收到错误消息。

      附带说明一下,如何找出默认使用的 GDB Eclipse?

      我下载了带有 CDT 的 64 位版本 Eclipse Indigo。

      【讨论】:

        猜你喜欢
        • 2014-04-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-01-09
        相关资源
        最近更新 更多