| 1 |
|
| 2 |
David Anderson, September 20, 2010 |
| 3 |
Updated July 22, 2018 |
| 4 |
|
| 5 |
The dwarfgen application is intended as both a vehicle |
| 6 |
for testing dwarf-generation by libdwarf and as an example |
| 7 |
of how one uses libdwarf to generate DWARF. |
| 8 |
In addition, it should be useful as a test vehicle for |
| 9 |
evaluating future changes to the DWARF standard. |
| 10 |
|
| 11 |
It is necessary as a test-vehicle so that the libdwarf |
| 12 |
producer code can be updated to allow more recent features |
| 13 |
of DWARF to be supported while trying to guarantee current |
| 14 |
producer code users are correctly supported. |
| 15 |
|
| 16 |
By default dwarfgen produces a fake a.out. By that we mean |
| 17 |
that no relocation sections are written. Instead, relocations |
| 18 |
are processed directly by dwarfgen. |
| 19 |
Perhaps at some point a more a.out-like output will be optionally |
| 20 |
supported. |
| 21 |
|
| 22 |
In its 2018 form the code calling producer functions |
| 23 |
leaks memory as the return values usually need to be |
| 24 |
dealloc'd, but only after the code is generated. |
| 25 |
An example from -fsanitize= |
| 26 |
is |
| 27 |
Direct leak of 2688 byte(s) in 28 object(s) allocated from: |
| 28 |
#0 0x7f51fb2f9602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) |
| 29 |
#1 0x5873d9 in _dwarf_p_get_alloc /home/davea/dwarf/regressiontests/../code/libdwarf/pro_alloc.c:76 |
| 30 |
#2 0x55cdaa in dwarf_add_AT_any_value_uleb /home/davea/dwarf/regressiontests/../code/libdwarf/pro_forms.c:1277 |
| 31 |
#3 0x495d4a in AddAttrToDie(Dwarf_P_Debug_s*, IRepresentation&, IRCUdata&, Dwarf_P_Die_s*, IRDie&, IRAttr&) /home/davea/dwarf/regressiontests/../code/dwarfgen/irepattrtodbg.cc:176 |
| 32 |
|
| 33 |
|