Home  >  Article  >  Database  >  Dwarf Error: wrong version in compilation unit header (is 4,

Dwarf Error: wrong version in compilation unit header (is 4,

WBOY
WBOYOriginal
2016-06-07 15:13:532732browse

问题描述: 在gcc4.9,gdb7.0环境下,启动gdb时出现了如下错误:Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /dawnfs/users/ 出现此错误的原因主要是gcc4.9生成的调试信息是dawnfs4,而gdb7.0支持的是 dawnfs2

问题描述:在gcc4.9,gdb7.0环境下,启动gdb时出现了如下错误:Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /dawnfs/users/  出现此错误的原因主要是gcc4.9生成的调试信息是dawnfs4,而gdb7.0支持的是dawnfs2


解决方案:这个问题其实是编译环境的问题,可以更改gcc和gdb的版本,这需要去寻找合适的版本。当然也可以给gcc增加编译参数,使其生成dawnfs2调试信息,主要参数为-gdwarf-2 -gstrict-dwarf,做法如下:

在.bashrc中加入alias gcc='gcc -gdwarf-2 -gstrict-dwarf',重启终端使其生效

这样gdb可以使用,也不会出现上面的错误。


参考gcc文档:https://gcc.gnu.org/gcc-4.5/changes.html

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn