13

GCC 4.8 supports DWARF4. I'm wondering what is the difference between DWARF4 and DWARF2 from user point of view.

Lets look at it from GDB point of view. Is there any difference for users when you switch to DWARF4?

I have found a Dwarf Home Page, but as far as i can see there is nowhere on the web information about difference from user POV.

Can you point me those differencies?

3
  • Maybe the list of issues resolved in V3 and V4 helps you, it seems to contain some C++11 things
    – PlasmaHH
    Mar 24, 2013 at 14:29
  • 1
    Older versions of GCC also support DWARF4. The only difference is that now it is the default in 4.8. I've been using DWARF4 for sometime with GCC 4.7 using the -gdwarf-4 compiler flag.
    – Cromulent
    Mar 24, 2013 at 14:46
  • @Cromulent you are right my mistake, but i feel that the question is still valid. +1 for you:)
    – CyberGuy
    Mar 24, 2013 at 15:30

3 Answers 3

6

The first version of DWARF proved to use excessive amounts of storage, DWARF-2, superseded it and added various encoding schemes to reduce data size, later on Version 4 of DWARF, which offers improved data compression, better description of optimized code, and support for new language features in C++.

Usually release notes of or anouncement summarize these differences (there would be many more)

http://dwarfstd.org/Announcement.php

http://dwarfstd.org/PressRelease.php

3

The Dwarf 4 standard page lists major enhancements, the spec lists these in more detail.

The bottom line for most users seems to be better support for optimized code, support for more languages (mostly in Dwarf 3), and support for new C++ language constructs

2
  • That's exactly what i found in those documents, now i wondering if there are any practical examples or if there is any source which describes it from user point of view. "How user will be able to see what will change when she switch from DWARF2 to DWARF4".
    – CyberGuy
    Mar 24, 2013 at 14:36
  • 4
    @CyberGuy Switching from DWARF2 to DWARF4 should produce a significantly smaller debug binary -- that's your first user-visible change right there. Mar 24, 2013 at 16:06
2

I would like to add that not all versions of gdb can properly read dwarf4. I often find myself to compile with -gdwarf-2 just to be able to see all the symbols. For instance, with gdb 7.2 I can't read all symbols in a mixed Fortran-C build if I use dwarf4, while I can with dwarf2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.