[PATCH 2/2] libdw: Skip imported compiler_units in libdw_visit_scopes walking DIE tree

2020-05-08 Thread Mark Wielaard
Some gcc -flto versions imported other top-level compile units, skip those. Otherwise we'll visit various DIE trees multiple times. Note in the testcase that with newer GCC versions function foo is fully inlined and does appear only once (as declared, but not as separate subprogram). Signed-off-b

[PATCH 1/2] libdw: Use correct CU to resolve file names in dwarf_decl_file.

2020-05-08 Thread Mark Wielaard
dwarf_decl_file uses dwarf_attr_integrate to get the DW_AT_decl_file attribute. This means the attribute might come from a different DIE in a different CU. If so, we need to use the CU associated with the attribute, not the original DIE, to resolve the file name. Also add a bit more documentation