Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dwarf-reader: Ignore zero length location expressions from DW_AT_loca…
…tion Location expressions might occasionally be of length 0. E.g. a reason for that are thread local variables that do not exactly have a location to refer to. Compilers/Linkers may choose an empty location description. E.g. see the dwarfdump output for the added testcase based on libandroid.so (from AOSP). $ dwarfdump libandroid.so|egrep -B9 "gChoreographerE$" LOCAL_SYMBOLS: < 1><0x00000022> DW_TAG_namespace DW_AT_name android < 2><0x00000027> DW_TAG_variable DW_AT_name gChoreographer DW_AT_type <0x00000b65> DW_AT_decl_file 0x00000003 .../choreographer.cpp DW_AT_decl_line 0x00000059 DW_AT_location len 0x0000: : DW_AT_linkage_name _ZN7androidL14gChoreographerE The DW_AT_location is properly read by elfutils' dwarf_location(), but is not useful for us to proceed with. Hence early exit on this. * src/abg-dwarf-reader.cc (die_location_expr): Ignore zero length location expressions. * tests/data/Makefile.am: Add new test files. * tests/data/test-read-dwarf/test-libandroid.so: New test file. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/test-read-dwarf.cc: Add new test case. Reported-by: Dan Albert <danalbert@google.com> Reviewed-by: Giuliano Procida <gprocida@google.com> Cc: Mark Wielaard <mark@klomp.org> Signed-off-by: Matthias Maennich <maennich@google.com>
- Loading branch information