DWARFis a widely used, standardizeddebugging data format.DWARF was originally designed along withExecutable and Linkable Format(ELF), although it is independent ofobject fileformats.[1]The name is amedieval fantasycomplement to "ELF" that had no official meaning, although the name "Debugging With Arbitrary Record Formats" has since been proposed as abackronym.[1]

DWARF originated with the C compiler and sdb debugger inUnix System VRelease 4 (SVR4).[1]

History

edit

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, whenSun Microsystemsadopted ELF as part of their move toSolaris,they opted to continue usingstabs,in an embedding known as "stabs-in-elf".Linuxfollowed suit, and DWARF-2 did not become the default until the late 1990s.

The DWARF Workgroup of theFree Standards Groupreleased DWARF version 3 in January 2006,[2]adding (among other things) support forC++namespaces,Fortran 90allocatabledata and additionalcompiler optimizationtechniques.

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

edit

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 atreestructure. A DIE attribute can refer to another DIE anywhere in the tree—for instance, a DIE representing a variable would have aDW_AT_typeentry pointing to the DIE describing the variable's type.

To save space, two large tables needed by symbolic debuggers are represented asbyte-codedinstructions for simple, special-purposefinite state machines.The Line Number Table, which maps code locations to source code locations and vice versa, also specifies which instructions are part offunction prologuesand epilogues. The Call Frame Information table allows debuggers to locate frames on thecall stack.

DWARF has been divided into different sections like.debug_info,[6].debug_frame, etc.

Tools

edit

Libdwarf is a library that provides access to the DWARF debugging information in executable files and object files.[7]

Further reading

edit

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]

References

edit
  1. ^abcdMichael J. Eager (April 2012)."Introduction to the DWARF Debugging Format"(PDF).Retrieved2015-01-08.
  2. ^"DWARF Version 3 Standard Released"(Press release). Free Standards Group. January 4, 2006. Archived fromthe originalon 2011-07-25.Retrieved2007-06-25.
  3. ^"DWARF Version 4 Released".The DWARF committee. June 16, 2010. Archived fromthe originalon 2020-07-30.Retrieved2010-06-24.
  4. ^"DWARF Version 5 Standard Released".The DWARF committee. February 15, 2017.Retrieved2017-08-07.
  5. ^"DWARF 5 Standard".The DWARF committee. February 15, 2017.Retrieved2017-08-07.
  6. ^.debug_info ibm documenation
  7. ^"libdwarf: A Consumer Library Interface to DWARF".www.prevanders.net.Retrieved2023-12-06.
edit