diff options
author | Mark Wielaard <mark@klomp.org> | 2018-01-29 15:59:05 +0100 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2018-02-21 17:04:32 +0100 |
commit | 532ab1edd81474b907c4763c417e961d813729ea (patch) | |
tree | 116528ae48620939ceeac74fcb5527f46f974642 /libdwfl | |
parent | 88f3d2daa107b09fdba376a82bce7ed534c93645 (diff) | |
download | elfutils-532ab1edd81474b907c4763c417e961d813729ea.tar.gz |
libdw: Parse new DWARF5 units and CU DIEs.
Parse DWARF5 units, add the unit_type to the Dwarf_CU and generalize some
code calculating the header length and getting at the first DIE of a unit.
Unit headers can have different sizes depending on the unit type.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdwfl')
-rw-r--r-- | libdwfl/ChangeLog | 7 | ||||
-rw-r--r-- | libdwfl/cu.c | 14 |
2 files changed, 10 insertions, 11 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 43fc1517..b2a74971 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,10 @@ +2018-01-29 Mark Wielaard <mark@klomp.org> + + * cu.c (cudie_offset): Use __libdw_first_die_off_from_cu instead of + DIE_OFFSET_FROM_CU_OFFSET. + (intern_cu): Simply use a copy of the given die CU as key instead of + trying to construct a dummy one by hand. + 2018-02-15 Mark Wielaard <mark@klomp.org> * linux-pid-attach.c: Include sys/wait.h after sys/ptrace.h. diff --git a/libdwfl/cu.c b/libdwfl/cu.c index 7aa23b50..94bfad8d 100644 --- a/libdwfl/cu.c +++ b/libdwfl/cu.c @@ -1,5 +1,5 @@ /* Keeping track of DWARF compilation units in libdwfl. - Copyright (C) 2005-2010, 2015 Red Hat, Inc. + Copyright (C) 2005-2010, 2015, 2016, 2017 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -155,12 +155,7 @@ less_lazy (Dwfl_Module *mod) static inline Dwarf_Off cudie_offset (const struct dwfl_cu *cu) { - /* These are real CUs, so there never is a type_sig8. Note - initialization of dwkey.start and offset_size in intern_cu () - to see why this calculates the same value for both key and - die.cu search items. */ - return DIE_OFFSET_FROM_CU_OFFSET (cu->die.cu->start, cu->die.cu->offset_size, - 0); + return __libdw_first_die_off_from_cu (cu->die.cu); } static int @@ -198,11 +193,8 @@ intern_cu (Dwfl_Module *mod, Dwarf_Off cuoff, struct dwfl_cu **result) if (die == NULL) return DWFL_E_LIBDW; - struct Dwarf_CU dwkey; struct dwfl_cu key; - key.die.cu = &dwkey; - dwkey.offset_size = 0; - dwkey.start = cuoff - (3 * 0 - 4 + 3); + key.die.cu = die->cu; struct dwfl_cu **found = tsearch (&key, &mod->lazy_cu_root, &compare_cukey); if (unlikely (found == NULL)) return DWFL_E_NOMEM; |