diff options
author | Mark Wielaard <mark@klomp.org> | 2018-05-20 23:30:01 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2018-05-25 15:07:58 +0200 |
commit | 6e3d2521a2b5a3b436901f52cfb9785887a7c961 (patch) | |
tree | 649d9c157ac680e9f99b61df772e429883602bf5 /libdw/dwarf_end.c | |
parent | 184fd30d1a453dc165ffc187b22dec6d196522ad (diff) | |
download | elfutils-6e3d2521a2b5a3b436901f52cfb9785887a7c961.tar.gz |
libdw: Support DW_OP_addrx/constx and split DWARF addrx/constx support.
DW_OP_addrx/constx and GNU DebugFission DW_OP_GNU_addr/const_index take
as argument an index into the .debug_addr section for the associated CU.
This index gets resolved through dwarf_getlocation_attr. A new fake addr
CU is created per Dwarf for use with this new attribute. For split DWARF
files, the IDX_debug_addr gets replaced with the skeleton section and the
addr base is resolved immediately when constructing the split DWARF CU.
Move __libdw_cu_addr_base to libdwP.h to share with eu-readelf. Also
make it possible to resolve addrx[1234]/GNU_addr_index also as constant
indexes to (also) show when displaying these attributes in eu-readelf.
A new varlocs tests is added to test the resolving for both the DWARF4
and DWARF5 DW_OP variants. And now that addrx forms are resolved in
split DWARF files add the new DIEs with "single ranges" (those DIEs that
have a lowpc/highpc attribute pair) to run-all-dwarf-ranges.sh.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdw/dwarf_end.c')
-rw-r--r-- | libdw/dwarf_end.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c index 4702f1b1..19546741 100644 --- a/libdw/dwarf_end.c +++ b/libdw/dwarf_end.c @@ -59,7 +59,12 @@ cu_free (void *arg) /* Free split dwarf one way (from skeleton to split). */ if (p->unit_type == DW_UT_skeleton && p->split != NULL && p->split != (void *)-1) - INTUSE(dwarf_end) (p->split->dbg); + { + /* The fake_addr_cu might be shared, only release one. */ + if (p->dbg->fake_addr_cu == p->split->dbg->fake_addr_cu) + p->split->dbg->fake_addr_cu = NULL; + INTUSE(dwarf_end) (p->split->dbg); + } } @@ -108,6 +113,11 @@ dwarf_end (Dwarf *dwarf) cu_free (dwarf->fake_loc_cu); free (dwarf->fake_loc_cu); } + if (dwarf->fake_addr_cu != NULL) + { + cu_free (dwarf->fake_addr_cu); + free (dwarf->fake_addr_cu); + } /* Did we find and allocate the alt Dwarf ourselves? */ if (dwarf->alt_fd != -1) |