Development History
The DWARF debugging information standard is primarily aimed at developers, guiding how to generate and consume debugging information. Specifically, compiler and linker developers need to reference the DWARF standard to generate debugging information, while debugger developers need to reference DWARF to consume debugging information. Let's first understand the development history of the DWARF debugging information standard.
DWARF v0 (1988)
The development of the DWARF debugging information standard owes much to the strong support of the DWARF Debugging Information Standards Committee. The DWARF Debugging Information Standards Committee was initially established in 1988 as the Programming Language Special Interest Group (PLSIG) of Unix International, Inc., with the original intention of promoting the development of Unix System V Release 4 (SVR4). In 1988, Bell Labs designed the DWARF debugging information format for SVR4. Later, PLSIG drafted version 1 of the DWARF standard, and the DWARF debugging information format began its true standardization journey.
DWARF v1 (1992/10)
PLSIG drafted version 1 of the DWARF standard, which was compatible with the DWARF debugging format used by AT&T's SVR4 compilers and debuggers at that time. In October 1992, DWARF v1.1.0 was released. As a newborn, this version had many issues and was difficult to be recognized and accepted.
DWARF v2 (1993/07)
In July 1993, DWARF v2.0.0 was released.
In DWARF v1, the generated debugging information occupied a large amount of storage space. DWARF v2 added multiple encoding formats to compress the data. Compared to v1, DWARF v2 had some improvements, but because DWARF v2 was not compatible with v1, industry professionals considered it to have many issues and not yet mature.
DWARF v2 still did not gain widespread acceptance immediately, partly because DWARF was still a newborn, and partly due to the dissolution of Unix International. The committee did not receive or process any industry comments, nor did it publish a final standard. Later, the committee's mailing list was hosted by OpenGroup (formerly known as XOpen).
At that time, Sun decided to adopt ELF as the file format on the Solaris platform. Although DWARF was originally designed as a debugging information format for ELF, Sun did not choose DWARF as the preferred debugging information format, but continued to use Stabs (stabs in elf). Linux followed the same approach, and this situation continued until the 1990s before changes occurred.
DWARF v3 (2005/12)
The DWARF Committee was reorganized in October 1999 and spent the next few years addressing issues in DWARF v2 and adding new features. In mid-2003, the committee became a working group of the Free Standards Group (FSG), an industry alliance established to promote open standards. After industry review and comments, DWARF v3 was released in December 2005.
This version added support for Java, C++ namespace, Fortran 90, etc., and also added some optimization techniques for compilers and linkers. For example, using the return_address_register field in Common Information Entry (CIE) to store the return address of the call stack, this field uses unsigned LEB encoding algorithm for encoding, effectively compressing the storage space occupied by small integers.
DWARF v4 (2010/06)
The DWARF Committee withdrew from FSG (Free Standards Group) in February 2007, when FSG merged with Open Source Development Labs to form the Linux Foundation, which focused more on promoting Linux. Since then, the DWARF Committee has remained independent.
The DWARF Committee's opinion is that migration from DWARF v2 or v3 to higher versions should be simple and straightforward. In DWARF v4, almost all key designs from DWARF v2 and v3 remained unchanged.
In 2010, the DWARF Committee released DWARF v4, with this version focusing on improving data compression, better describing compiler-optimized code, and adding support for describing new C++ features.
DWARF v5 (2017/02)
The DWARF Debugging Information Format Committee has always maintained an open attitude towards compiler and debugger developers who have experience with source language debugging and debugging formats, and are interested in improving or extending the DWARF debugging format.
In 2017, DWARF v5 was released, with improvements and enhancements in many aspects, including better data compression, separation of debugging information from executable programs, better description of macros and source files, faster symbol search, better description of compiler-optimized code, and other functional and performance improvements.
DWARF is also the debugging information format used by the Go language toolchain. As of go1.12.10, the current version used is DWARF v4. In C++, some compilers like gcc have already started applying some DWARF v5 features, and there are discussions about this in the Go language. If you're interested, you can follow the Go language issue: https://github.com/golang/go/issues/26379.
DWARF v6 working draft (2023/12)
Currently, DWARF v4 should be the most widely used, with some languages gradually moving towards DWARF v5. Nevertheless, the DWARF v6 standard is already on the way. Since it's currently in the draft stage, we won't introduce it here.
References
- DWARF, https://en.wikipedia.org/wiki/DWARF
- DWARFv1, https://dwarfstd.org/doc/dwarf_1_1_0.pdf
- DWARFv2, https://dwarfstd.org/doc/dwarf-2.0.0.pdf
- DWARFv3, https://dwarfstd.org/doc/Dwarf3.pdf
- DWARFv4, https://dwarfstd.org/doc/DWARF4.pdf
- DWARFv5, https://dwarfstd.org/doc/DWARF5.pdf
- DWARFv6 draft, https://dwarfstd.org/languages-v6.html
- Introduction to the DWARF Debugging Format, https://dwarfstd.org/doc/Debugging-using-DWARF-2012.pdf