Problem description: The following error occurs when gdb is started in gcc4.9 and gdb7.0: DwarfError: wrongversionincompilationunitheader (is4, shouldbe2) [inmoduledawnfsusers: The main cause of this error is that the debugging information generated by gcc4.9 is dawnfs4, while gdb7.0 supports dawnfs2.
Problem description: The following Error occurs when gdb is started in gcc4.9 and gdb7.0: Dwarf Error: wrong version in compilation unit header (is 4, shocould be 2) [in module/dawnfs/users/the cause of this error is that the debugging information generated by gcc4.9 is dawnfs4, while gdb7.0 supports dawnfs2.
Problem description:In gcc4.9 and gdb7.0, the following Error occurs when gdb is started: Dwarf Error: wrong version in compilation unit header (is 4, shocould be 2) [in module/dawnfs/users/the cause of this error is that the debugging information generated by gcc4.9 is dawnfs4, while gdb7.0 supports dawnfs2.
Solution:This problem is actually a problem with the compiling environment. You can change the gcc and gdb versions, and you need to find the appropriate version. Of course, you can also add compilation parameters for gcc to generate dawnfs2 debugging information, the main parameter is-gdwarf-2-gstrict-dwarf, the approach is as follows:
Add alias gcc = 'gcc-gdwarf-2-gstrict-dwarf' to. bashrc and restart the terminal to make it take effect.
In this way, gdb can be used without the above errors.
Refer to gcc documentation: https://gcc.gnu.org/gcc-4.5/changes.html