[PATCH] libdw: Handle split Dwarf Dies in dwarf_die_addr_die.
Mark Wielaard
mark@klomp.org
Tue May 29 22:11:00 GMT 2018
On Tue, 2018-05-29 at 23:57 +0200, Mark Wielaard wrote:
> dwarf_die_addr_die can be used to turn an Dwarf_Die addr back into a
> full Dwarf_Die, just given the original Dwarf debug handle. This now
> also works for Dwarf_Dies which originated from a split Dwarf. Whenever
> a split Dwarf_CU is found the Dwarf it originated from is registered
> with the Dwarf that the skeleton Dwarf_CU came from. All registered
> split Dwarfs are then searched by dwarf_die_addr_die if the addr didn't
> match the main Dwarf or the alt Dwarf.
>
> One limitation in this implementation is that only DIEs that come from
> the main .debug_info in the .dwo are supported. Theoretically there could
> also be DIEs in an .debug_type or from other/multiple (comdat) sections.
>
> New tests are added for dwarf-4, dwarf-5, split-dwarf-4, split-dwarf-5
> and version 4 and 5 dwo files.
And clearly I hadn't done a make distcheck because then I would have
known that valgrind would warn about leaking the new search tree.
Simple fix:
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index 23a50a0..29795c1 100644
--- a/libdw/dwarf_end.c
+++ b/libdw/dwarf_end.c
@@ -91,6 +91,9 @@ dwarf_end (Dwarf *dwarf)
/* Search tree for decoded .debug_lines units. */
tdestroy (dwarf->files_lines, noop_free);
+ /* And the split Dwarf. */
+ tdestroy (dwarf->split_tree, noop_free);
+
struct libdw_memblock *memp = dwarf->mem_tail;
/* The first block is allocated together with the Dwarf object. */
while (memp->prev != NULL)
More information about the Elfutils-devel
mailing list