当前位置: 动力学知识库 > 问答 > 编程问答 >

GCC 4.8 gdwarf2 can not work

问题描述:

My gdb version is 6.6, gcc version is 4.8. I know that gcc -g by default uses dwarf-4 format, but gcc manual says that adding -gdwarf-2 option can use older dwarf format. I tried it, but it is not ok. When I use gdb, it still reports:

Dwarf Error: wrong version in compilation unit header (is 4, should be 2)

网友答案:

According to GCC 4.5 Release Notes you should use -gdwarf-2 -gstrict-dwarf options to completely disable use of DWARF4 features:

GCC now generates unwind info also for epilogues. DWARF debuginfo generated by GCC now uses more features of DWARF3 than before, and also some DWARF4 features. GDB older than 7.0 is not able to handle either of these, so to debug GCC 4.5 generated binaries or libraries GDB 7.0 or later is needed. You can disable use of DWARF4 features with the -gdwarf-3 -gstrict-dwarf options, or use -gdwarf-2 -gstrict-dwarf to restrict GCC to just DWARF2, but epilogue unwind info is emitted unconditionally whenever unwind info is emitted.

分享给朋友:
您可能感兴趣的文章:
随机阅读: