Libdwarf And Dwarfdump
From DWARF Standard Wiki
 What is libdwarf
Libdwarf is a C library intended to simplify reading (and writing) applications using DWARF2, DWARF3. It was written at SGI (Silicon Graphics, Inc.) beginning in about 1991 to simplify the task of SGI's compiler writers and debugger-writers and was made open source in the mid 1990's. It is copyrighted by SGI as LGPL version 2.1 It is used by a variety of projects to read DWARF2/3 information from ELF object files. It is also capable of writing DWARF information generated by a compiler (a capability used by at least 2 system manufacturers).
It cannot read the original AT&T DWARF1 (as it is now called) format at all: that (now nearly obsolete) format is implemented completely differently from DWARF2/3.
 What is dwarfdump
Dwarfdump is an application using libdwarf to print dwarf information in a human readable format. It is also open sourced and is copyrighted GPL by SGI. It provides an example of using libdwarf to read DWARF2/3 information as well as providing readable text output.
 Building libdwarf and dwarfdump
A build assumes standard POSIX utilities. It has worked on a wide variety of computers and operating systems.
Download the tar file. tar xzf libdwarf-<version date extension>.tar.gz cd dwarf-<version date extension> ./configure make cd ../dwarfdump ./configure make
A 'sudo make install' step in each directory is optional. The tools assumed (shell [sh ksh or bash], cc, make, ar) are used in simple ways (any 'cc' or 'gcc', any 'make' or 'ar' should work fine) and so any toolset that understands basic POSIX options should work ok. The 'untaring' step may be done as separate gunzip and tar, avoiding a direct dependence on the 'xzf' option combination.
 Other information in libdwarf
There are documents in the libdwarf release that may be of interest even for those not using libdwarf directly.
 SGI extensions
One document in the libdwarf release is called mips_extensions.pdf (named thus for historical reasons: it describes SGI extensions to DWARF as defined in the early-mid 1990's).
The dwarf.h in the libdwarf release contains all extensions in use that are known to the maintainer. (With the exception of a long list of Ada extensions used by at least one Ada compiler supplier: the current DWARF attributes appear to suffice for Ada so those extensions are not shown. In addition, the actual extension names that the Ada compiler-provider used did not quite follow the recommended naming guidelines, so actually listing them in dwarf.h would be quite confusing to little purpose.)
Since most of the 'extension' numbering allows plenty of extensions many compiler-providers prefer to avoid using the same extension numbers as other compiler providers. This is not necessary (as no one provider would use conflicting numbers) but does give a 'universal dumper' such as dwarfdump an easier time dumping DWARF information. It makes dwarf.h easier to read too.
Neither the software nor the interfaces are part of the DWARF specification. Neither the software nor the interfaces are defined or supported by the DWARF Committee.
SGI no longer maintains this software.
 How do I get it?
The software is available from the maintainer at http://www.prevanders.net/dwarf.html.
That web site also gives additional detail on the history and approach used in libdwarf.
 Do I need to use it?
No, you don't have to. Many projects generate (gcc for example) and consume (gdb for example) DWARF2/3 information without any reference-to or use-of libdwarf.