DWARF: Difference between revisions
spelling fix |
m →External links: add elfutils |
||
Line 68: | Line 68: | ||
* {{official website|http://dwarfstd.org/}} |
* {{official website|http://dwarfstd.org/}} |
||
* [http://www.prevanders.net/dwarf.html Libdwarf], a C library intended to simplify reading (and writing) applications using DWARF2, DWARF3. |
* [http://www.prevanders.net/dwarf.html Libdwarf], a C library intended to simplify reading (and writing) applications using DWARF2, DWARF3. |
||
* [http://sourceware.org/elfutils elfutils], [[GNU_Binutils#elfutils|another C library]] for ELF/DWARF file processing. |
|||
* [http://eli.thegreenplace.net/2011/02/07/how-debuggers-work-part-3-debugging-information/ How debuggers work]: Part 3 - Debugging information |
* [http://eli.thegreenplace.net/2011/02/07/how-debuggers-work-part-3-debugging-information/ How debuggers work]: Part 3 - Debugging information |
||
* [http://www.ibm.com/developerworks/library/os-debugging/ Debugging formats DWARF and STAB] |
* [http://www.ibm.com/developerworks/library/os-debugging/ Debugging formats DWARF and STAB] |
Revision as of 22:31, 26 July 2019
DWARF is a widely used, standardized debugging data format. DWARF was originally designed along with Executable and Linkable Format (ELF), although it is independent of object file formats.[1] The name is a medieval fantasy complement to "ELF" that has no official meaning, although the backronym 'Debugging With Attributed Record Formats' was later proposed.[1]
History
The first version of DWARF proved to use excessive amounts of storage, and an incompatible successor, DWARF-2, superseded it and added various encoding schemes to reduce data size. DWARF did not immediately gain universal acceptance; for instance, when Sun Microsystems adopted ELF as part of their move to Solaris, they opted to continue using stabs, in an embedding known as "stabs-in-elf". Linux followed suit, and DWARF-2 did not become the default until the late 1990s.
The DWARF Workgroup of the Free Standards Group released DWARF version 3 in January 2006,[2] adding (among other things) support for C++ namespaces, Fortran 90 allocatable data and additional compiler optimization techniques.
The DWARF committee published version 4 of DWARF, which offers "improved data compression, better description of optimized code, and support for new language features in C++", in 2010.[3]
Version 5 of the DWARF format was published in February 2017.[4][5] It "incorporates improvements in many areas: better data compression, separation of debugging data from executable files, improved description of macros and source files, faster searching for symbols, improved debugging of optimized code, as well as numerous improvements in functionality and performance."
Structure
DWARF uses a data structure called a Debugging Information Entry (DIE) to represent each variable, type, procedure, etc. A DIE has a tag (e.g., DW_TAG_variable, DW_TAG_pointer_type, DW_TAG_subprogram) and attributes (key-value pairs). A DIE can have nested (child) DIEs, forming a tree structure. A DIE attribute can refer to another DIE anywhere in the tree—for instance, a DIE representing a variable would have a DW_AT_type entry pointing to the DIE describing the variable's type.
To save space, two large tables needed by symbolic debuggers are represented as byte-coded instructions for simple, special-purpose finite state machines. The Line Number Table, which maps code locations to source code locations and vice versa, also specifies which instructions are part of function prologues and epilogues. The Call Frame Information table allows debuggers to locate frames on the call stack.
Further reading
Michael Eager, chair of the DWARF Standards Committee, has written an introduction to debugging formats and DWARF 3, Introduction to the DWARF Debugging Format.[1]
See also
- stabs - Symbol TABle Strings debugging format
References
- ^ a b c Michael J. Eager (April 2012). "Introduction to the DWARF Debugging Format" (PDF). Retrieved 2015-01-08.
- ^ "DWARF Version 3 Standard Released" (Press release). Free Standards Group. January 4, 2006. Retrieved 2007-06-25.
- ^ "DWARF Version 4 Released". The DWARF committee. June 16, 2010. Retrieved 2010-06-24.
- ^ "DWARF Version 5 Standard Released". The DWARF committee. February 15, 2017. Retrieved 2017-08-07.
- ^ "DWARF 5 Standard". The DWARF committee. February 15, 2017. Retrieved 2017-08-07.
External links
- Official website
- Libdwarf, a C library intended to simplify reading (and writing) applications using DWARF2, DWARF3.
- elfutils, another C library for ELF/DWARF file processing.
- How debuggers work: Part 3 - Debugging information
- Debugging formats DWARF and STAB