Dwarf错误:编译单元头中的版本错误(是4,应该是2) [英] Dwarf Error: wrong version in compilation unit header (is 4, should be 2)

查看:2019
本文介绍了Dwarf错误:编译单元头中的版本错误(是4,应该是2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

共享对象是在RedHat Linux上构建的,尽管所有代码都是用debug编译的,但调试器(gdb)拒绝加载这些符号,并发出如下错误:

  ... 
GNU gdb Fedora(6.8-37.el5)
...
这个GDB被配置为x86_64-redhat- linux-gnu...
Dwarf错误:编译单元头文件中的版本错误(是4,应该是2)[in module libgrokf.so]

有了这个错误,我无法获得在任何函数中触发的断点,也没有看到正确的堆栈跟踪。我重新编译了整个项目,但没有任何帮助。我知道过去有些时候在调试模块时没有问题。



是什么导致了这个问题?

解决方案

问题是您的GDB版本不支持您的二进制文件中使用的DWARF版本。



解决方案:更新GDB或使用其他调试格式编译文件(DWARF2适用于GDB 6)。

我最近在freeBSD和nasm,nasm编译时遇到了这个问题



我希望这个答案可以帮助任何有类似问题的人:P



GCC的调试选项


A shared object was built on RedHat Linux and while all the code was compiled with debug, the debugger (gdb) refused to load the symbols and issued an error as in:

...
GNU gdb   Fedora (6.8-37.el5) 
...
This GDB was configured as "x86_64-redhat-linux-gnu"...
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module libgrokf.so]

With this error, I could not get break points to trigger in any function nor see proper stack trace. I recompiled the entire project but nothing helped. I do know that some time in the past there was no problem in debugging that module.

What is causing this problem?

解决方案

The problem is that your version of GDB doesn't support the DWARF version used in one of your binaries.

The solution: Update GDB or compile your files using another debug format (DWARF2 works on GDB 6).

I have recently had this problem with freeBSD and nasm, nasm compiling binaries with dwarf3 and the gdb that ships with freeBSD 9.1 doesn't accept it.

I hope this answer helps anyone having a similar problem :P

Debug options for GCC

这篇关于Dwarf错误:编译单元头中的版本错误(是4,应该是2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆