Eclipse CDT debugging in process - not in executable format: file format not recognized

I am trying to use Eclipse with CDT to debug 64 bit binary. The binary is built outside of Eclipse and works just fine. I run the binary outside of eclipse and then try to connect to the process using the "C / C ++ Attach to Application" debugging configuration configuration.

I can select a process from the list that appears when starting the debug configuration, however I get the following error message:

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 

Everything works fine if I create an i386 target.

I'm not quite sure where to do this, I read that this may be related to binary parsing in Eclipse:

This link refers to parsers, and this link describes a bug with the PE parser, which is fixed.

I am running Eclipse Indigo with Eclipse CDT 8.0.0 on Linux x64. I tried "Elf Parser" and "GNU Elf Parser" in the project_properties / C ++ _ build / settings file with no luck.

File Information:

 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 and gdbinit files are Eclipse defaults

+6
source share
2 answers

It sounds as though GDB, which uses Eclipse, was built for i386 and therefore cannot debug 64-bit binaries. You will probably need to install 64-bit GDB.

Here is what the error message from the current GDB looks like:

 $ ./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 and gdbinit files are Eclipse defaults

Has a 32-bit or 64-bit version of CDT been installed?

+3
source

In the GDB shell, I count 64 bits:

 ~: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". 

Shipment date:

 ~:gdb -q /bin/date Reading symbols from /bin/date...(no debugging symbols found)...done. 

Enter which gdb, and after entering this path into the explicit debugging configuration in Eclipse, I no longer receive the error message.

As a quick note, how can you find out which GDB Eclipse uses by default?

I downloaded the 64-bit version of Eclipse Indigo that came with the CDT.

+1
source

Source: https://habr.com/ru/post/895935/


All Articles