libabigail/tests
Giuliano Procida 0bd4b93517 DWARF: track chained DIE declaration-only status
Bug 26297: Possible misinterpretation of DW_AT_declaration via DW_AT_specification

A DIE representing a definition can refer to the DIE that represents
the matching declaration by using the DW_AT_specification attribute.

A similar situation exists for a cloned entity (like a cloned variable
or function) where the DW_AT_abstract_origin points to the original
entity.

Usually, to get the union of the attributes for a given definition
DIE, we also need to gather the attributes carried by the declaration
(or original) DIE accompanying the current definition DIE.

For the "is_declaration" attribute however, we should only look at the
current (definition) DIE at hand.  Said otherwise, we should not
follow declaration/origin link when we want to know if a given entity
is declaration-only.

Thus, this commit causes the DWARF reader to only consider a DIE to be
"declaration only" if all DIEs in the chain leading to it have the
DW_AT_declaration attribute set.

It is a follow-up commit to a change making die_is_declaration_only
examine just the immediate DIE.

The responsibility of tracking the cumulative declaration-only status
of DIEs falls on build_ir_node_from_die which is the function that
makes recursive calls to itself on encountering a DW_AT_specification
or DW_AT_abstract_origin link.

Various other functions that would have previously called
die_is_declaration_only are modified so that get the cumulative value
for this flag, rather than just examing the DIE they are given.

This change eliminates a lot of spurious declaration-only types in ABI
output and may also prevent the same, particularly when anonymous,
from confusing libabigail's type equality and canonicalisation logic.

	* src/abg-dwarf-reader.cc (add_or_update_class_type): Add an
	is_declaration_only argument. Use this in favour of the
	die_is_declaration_only helper function.
	(add_or_update_union_type): Ditto.
	(function_is_suppressed): Ditto.
	(build_or_get_fn_decl_if_not_suppressed): Ditto.
	(build_enum_type): Ditto.
	(build_ir_node_from_die): To the main overload, add
	is_declaration_only argument and default this to true.
	Update this to false if the given DIE is not declaration
	only and pass this on in recusrive calls and calls to
	build_enum_type, add_or_update_union_type,
	add_or_update_class_type and
	build_or_get_fn_decl_if_not_suppressed.
	* tests/data/test-annotate/test17-pr19027.so.abi: Update
	test. This is mostly the removal of is-declaration-only
	attributes, removal of unreachable parts of the type graph and
	type id renumbering.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1-report-0.txt:
	Likewise.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.

Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-08-06 18:35:27 +02:00
..
data DWARF: track chained DIE declaration-only status 2020-08-06 18:35:27 +02:00
lib
.gitignore tests/.gitignore: ignore all files starting with runtest* 2020-05-13 11:26:28 +02:00
Makefile.am tests: Add symtab test suite 2020-05-27 11:00:51 +02:00
mockfedabipkgdiff.in
print-diff-tree.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
runtestcanonicalizetypes.sh.in
runtestdefaultsupprs.py.in
runtestdefaultsupprspy3.sh.in
runtestfedabipkgdiff.py.in
runtestfedabipkgdiffpy3.sh.in
test-abicompat.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-abidiff-exit.cc Fix corpus_diff::has_net_changes for --leaf-changes-only mode 2020-07-21 08:53:19 +02:00
test-abidiff.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-alt-dwarf-file.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-annotate.cc
test-core-diff.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-cxx-compat.cc cxx-compat: add test suite for cxx-compat 2020-05-13 11:55:12 +02:00
test-diff2.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-diff-dwarf-abixml.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-diff-dwarf.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-diff-filter.cc Fix maybe_report_data_members_replaced_by_anon_dm 2020-08-04 18:27:22 +02:00
test-diff-pkg.cc configure: add more diagnostic options when ABIGAIL_DEVEL is set 2020-05-18 10:39:36 +02:00
test-diff-suppr.cc tests: parallelize diff-suppr test 2020-04-20 15:02:39 +02:00
test-dot.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-elf-helpers.cc abg-dwarf-reader split: create abg-elf-helpers.{h,cc} and test case 2020-04-22 11:39:45 +02:00
test-ini.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-ir-walker.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-kmi-whitelist.cc Simplify generation of symbol whitelist regex. 2020-05-04 11:17:49 +02:00
test-lookup-syms.cc dwarf-reader: Fix bloom filter access in GNU_HASH section 2020-03-20 13:35:00 +01:00
test-read-dwarf.cc Bug 26261 - Fix logic for canonicalizing DW_TAG_subroutine_type DIEs 2020-08-03 11:41:08 +02:00
test-read-write.cc configure: add more diagnostic options when ABIGAIL_DEVEL is set 2020-05-18 10:39:36 +02:00
test-svg.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-symtab.cc tests: Add kernel symtab test suite 2020-05-27 11:00:51 +02:00
test-tools-utils.cc Make decl_names_equal more accurate 2020-08-04 14:51:13 +02:00
test-types-stability.cc test-types-stability: parallelize test case alternatives 2020-05-04 15:34:42 +02:00
test-utils.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-utils.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
test-valgrind-suppressions.supp
test-write-read-archive.cc Update copyright year to 2020 2020-02-21 17:05:01 +01:00
update-test-output.py