diff options
author | Mark Wielaard <mark@klomp.org> | 2018-05-29 23:49:21 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2018-05-31 17:03:19 +0200 |
commit | 7d6fe0a39f6ae5c516ffd63558e12b24297bf982 (patch) | |
tree | 30469e6da3f107797bb69a1d0a480eafc4ba50fd /libdw/dwarf_cuoffset.c | |
parent | b37feac1a8ceebb0748cb28d219aa8387d0885dd (diff) | |
download | elfutils-7d6fe0a39f6ae5c516ffd63558e12b24297bf982.tar.gz |
libdw: Handle split Dwarf Dies in dwarf_die_addr_die.
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.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdw/dwarf_cuoffset.c')
-rw-r--r-- | libdw/dwarf_cuoffset.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libdw/dwarf_cuoffset.c b/libdw/dwarf_cuoffset.c index ba376486..f13b02fd 100644 --- a/libdw/dwarf_cuoffset.c +++ b/libdw/dwarf_cuoffset.c @@ -38,7 +38,7 @@ Dwarf_Off dwarf_cuoffset (Dwarf_Die *die) { - return (die == NULL + return ((die == NULL || die->cu == NULL) ? (Dwarf_Off) -1l : (Dwarf_Off) (die->addr - die->cu->startp)); } |