4
我发现file> = 5.30或gcc> = 6.3已经改变了它的行为。当我编译一个像hello-world一样的基本程序时,文件的输出表明elf-executable包含某种“debug_info”。为什么文件命令状态,该可执行文件包含“debug_info”
来源:
#include <iostream>
using namespace std;
int main(int argc, char* argv []) {
cout << "Hello world.\n";
return 0;
}
编译:
$ g++ -o hello hello.cpp # notice, no option "-g"
检查:
我不熟悉readelf。 A readelf -S你好| grep -i debug表示在没有“-g”编译时没有调试信息。如果使用选项“-g”编译,我看到这一点,这看起来对我罚款:
[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
我以为没人我GCC发布的编译过程中所隐藏的配置标志,总是包含某种的调试信息。因此,util 文件的行为可能已发生变化。 文件是什么意思与“调试信息”?
信息:
我在X86_64上运行GNU/Linux(Archlinux),包都是最新的。
友情提示:“包都是最新的。”并不意味着编译器对编译器版本是什么或提供任何提示。对于我们所知的所有情况,分发本可以停止更新GCC 3.3.4。这将是极端的,但是几个主要发行版似乎已经停止在4.8和4.9。最好运行'g ++ -v',并在需要时将版本添加到将来的问题中。 – user4581301
你说得对,但我在问题的顶部已经添加了版本信息。最后的说明应该提供背景信息。 – Peter