= 5.30 or gcc> = 6.3 changed its behavi...">

Why does the file-command declare that the executable contains "debug_info",

I found out that the file> = 5.30 or gcc> = 6.3 changed its behavior. When I compile a basic program such as hello-world, the output of the file indicates that the elf executable includes some kind of "debug_info".

Source:

#include <iostream>
using namespace std;

int main(int argc, char* argv []) {
        cout << "Hello world.\n";
        return 0;
}

Compile:

$ g++ -o hello hello.cpp # notice, no option "-g"

Inspect:

$ file hello # please scroll to the right hand-side, it is at the very end
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d03b68ed8618fcb97094b18157054f7cc2030f3c, not stripped, with debug_info

I am not familiar with myself. Greetings | grep -i debug indicates that there is no debugging information when compiling without "-g". If compiled with the -g option, I see this, which looks great to me:

  [27] .debug_aranges    PROGBITS         0000000000000000  0000107c
  [28] .debug_info       PROGBITS         0000000000000000  000010ac
  [29] .debug_abbrev     PROGBITS         0000000000000000  000038ce
  [30] .debug_line       PROGBITS         0000000000000000  00003e54
  [31] .debug_str        PROGBITS         0000000000000000  00004186

I suppose no one used the hidden configure flag during the build of my gcc version to always include some kind of debugging information. Therefore, probably the behavior of the util file has changed. What does the file with "debug info" mean?

Info:
GNU/Linux (Archlinux) X86_64, .

+4
1

, fixed. 1 ( "" ), 0 ( "false" ).

+6

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


All Articles