readelf: Find skeleton units when inspecting split .dwo (--dwarf-skeleton).
authorMark Wielaard <mark@klomp.org>
Sun, 8 Apr 2018 22:03:43 +0000 (00:03 +0200)
committerMark Wielaard <mark@klomp.org>
Mon, 28 May 2018 15:19:41 +0000 (17:19 +0200)
commit7372ccf49a83d4eb38b39fe227345d53c8219254
tree26b01e415fa1e067ad6167bcc32a51ca83affa00
parent879f3a4f99dfc7f3678dc1c959e66784f21886bb
readelf: Find skeleton units when inspecting split .dwo (--dwarf-skeleton).

To get the right context (especially addresses) when looking at a .dwo file
we really need the skeleton file.  If we can find it (simply replace .dwo
with .o) then use that to get to the split DWARF units so that libdw sets
up all relevant information to resolve.

Also adds a --dwarf-skeleton option so the user can explicitly give a
skeleton file to use (for example when all .o files are linked and removed
already).  Unfortunately this might not work if libdw cannot get from the
skeleton file to the .dwo file (because they have been moved around).
In that case eu-readelf "cheats", it will link up the libdw datastructures
so that the skeleton and split DWARF units are setup correctly anyway.
This does introduce a problem when trying to cleanup the Dwarf handle
ownership graph. So we will deliberately leak memory by not closing the
underlying Dwfl in that case.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdw/ChangeLog
libdw/libdwP.h
libdw/libdw_find_split_unit.c
src/ChangeLog
src/readelf.c