Hosted by the courtesy of  
http://www.free.fr 
The stars ASAP english francais spanish arab
Durée du voyage intersidéral francais
Résolutions de l'ONU en HTML francais
Bussard Ramjet english francais
DWARF : dwarf2xml english
ELF : libelf examples english
Code presentation : ctoohtml english


Here is a new DWARF to XML converter

DWARF (Debug With Arbitrary Record Format) is the preferred format for storing debug information in the ELF executable format. It is part of most Unixies like system ABI. The information is used by debuggers, lets say GDB, to achieve the magic debugging at source level.

XML is a powerful general data representation method. It is able to represent tree of data of arbitrary complexity, feature it shares with a lot of representation method but have the advantage to be a text format that makes it human readable. There is also plenty of way to visualize, check, transform and edit XML. That is probably why it has been chosen by several projects aiming to show DWARF content.

The ability of XML to be transformed is used here to provide a HTML view of DWARF using XSLT transform.

This tool is not the first attempt to provide a XML conversion from DWARF. There is also a set of tools provided by the DWARF2-XML project.

Package description

DWARF to XML converter : dwarf2xml

dwarf2xml is a binary executable written in C and using libdwarf package that is included by most distributions. It has been designed to show all information contained in debug sections of ELF files as there are stored. This is not always easy with libdwarf API which is designed to meet debuggers needs. Some extra code, and probably some bugs, have been necessary to achieve a dump of all sections as there are described in DWARF specifications.

Use the option -h of dwarf2xml to see the option summary. Most of the times option 'all' will do the job:

	dwarf2xml -all <Elf file> > <out XML>

DWARF XML validation : dwarf-v4.02.dtd

I have kept the idea of having a generic tag "tag" and a generic tag "attribute" from DTD for DWARF2-XML, but only for tags and attributes that are not standard. This make possible for the validation pass to check if an element is allowed to be in another. For the special case of "generic" elements, all combinations are allowed.
The tree of tags and attributes have been obtained from a mix of DWARD3 specifications, libdwarf test suite, and tag_tree.list file from dwarfdump.

	xmllint --path "<path to dwarf-v4.02.dtd>" --valid <output of dwarf2xml> 1>/dev/null

DWARF to HTML converter : dwarf_basic.xslt

If XML have a good ability to hold data set, HTML offers a great way to visualize them. This stylesheet transforms the result of dwarf2xml into HTML with a lot of useful links that make possible to browse into DWARF elements.
I used xsltproc to build HTML examples, e.g. :

	xsltproc --novalid -o test_dwarf_enum.html ../dwarf_basic.xslt test_dwarf_enum.xml

DWARF HTML stylesheet : dwarf.css

The dwarf_basic.xslt include in the result a reference to a CSS stylesheet for HTML look and feel customization.

Status

dwarf2xml

Most of libdwarf test suite (dwarftest-20100930) items are correctly handled if dwarf2xml is build with recent version of libdwarf.
There is still a lot of situations that are not tested.

dwarf-v4.02.dtd

As every element possible content have to be explicitly listed in DTD, it may remains a lot of combinations that are not listed in this DTD.

autoconf package

As usual :

	./configure && make
In case of trouble, you may find helpfull to reconfigure :
	autoreconf -i && autoconf

I am new to autoconf and as I test it only on my config (Centos 7), you may experience some troubles using it.
To make easier the use of libdwarf version different from the system one, I have added the configure option "--with-dwarf", e.g.:

	./configure --with-dwarf=<path to libdwarf>

Downloads

dwarf2xml-v4.02.tar.gz (last)
dwarf2xml-v4.01.tar.gz (old)
dwarf2xml-v1.01.tar.gz (old)

License

Most files are under GNU v2 licence and some are under GNU lesser v2.1.

Documents and links

DWARF Standards can be found at dwarfstd.org
DWARF library project is on David A's DWARF Page
DWARF library document quick link "A Consumer Library Interface to DWARF" from David Anderson
DWARF2-XML: a markup language for DWARF2 debugging information

Screenshots

dwarf2 - Enum type example, XML
dwarf2 - Function example, XML

dwarf3 - Enum type example, XML
dwarf3 - Function example, XML

dwarf4 - Enum type example, XML
dwarf4 - Function example, XML

Examples from dwarf testsuite dwarftest-20100930

arm/armcc-test-dwarf2, XML
arm/armcc-test-dwarf3, XML
cristi3/cristibadobj, XML
enciso2/template.elf, XML
ia32/mytry.ia32, XML
ia64/hxdump.ia64, XML
ia64/mytry.ia64, XML
kartashev/combined.o, XML
kartashev2/combined.o, XML
sparc/tcombined.o, XML


web design : machinman.net all right reserved, update Wed Jun 29 00:33:41 CEST 2016

Hosted by the courtesy of  
http://www.free.fr 
The stars ASAP english francais spanish
Durée du voyage intersidéral francais
Résolutions de l'ONU en HTML francais
Bussard Ramjet english francais
DWARF : dwarf2xml english
ELF : libelf examples english
Code presentation : ctoohtml english