It turns out the support for reading the native libabigail XML format
is falling short since the work on (late) type canonicalizing.
The type ID -> XML node map is wrongly considered as being per corpus
data while it should be per translation unit data; type IDs are unique
only for a given translation unit.
The code to walk a XML sub-tree to perform the ID -> node mapping is
wrongly walking all the XML node *after* the sub-tree node too; that
is, it walks the entire corpus file starting from the XML sub-tree
node it's given. It should only walk the sub-tree it's given.
These two issues normally solve the crash reported here. But then
there are other related issues too.
The native XML format reader doesn't populate the set of exported
declarations for the current corpus it's building.
This patch addresses all these issues and makes tests/test-abidiff.cc
supports corpus files for a new regression test.
* src/abg-reader.cc (read_context::m_exported_decls_builder_): New
data member.
(read_context::read_context): Initialize it.
(read_context::{type_is_from_translation_unit,
get_exported_decls_builder, set_exported_decls_builder,
maybe_add_fn_to_exported_decls, maybe_add_fn_to_exported_decls,
type_id_new_in_translation_unit}): New member functions.
(read_context::clear_per_translation_unit_data): Clear id->xml
node map here ...
(read_context::clear_per_corpus_data): ... not here.
(read_context::walk_xml_node_to_map_type_ids): Only walk the
sub-tree we are asked to walk.
(read_translation_unit_from_input): Cleanup.
(read_corpus_from_input): Wire populating of exported declarations
of the current corpus.
(build_function_decl, build_var_decl): Populate exported
declarations of the current corpus here.
(build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_array_type_def, build_enum_type_decl, build_type_decl)
(build_template_tparameter): Adjust assert on ID to make sure
it's the first type it's being defined in the current translation
unit.
* tests/data/test-abidiff/test-corpus0-report0.txt: New test
reference output.
* tests/data/test-abidiff/test-corpus0-v{0,1}.so.abi: New test
input.
* tests/test-abidiff.cc (specs): Add the test inputs above to the
list of inputs over which to run the test harness.
(main): Support reading corpora too, as this test harness was
reading just translation units before.
(tests/data/Makefile.am): Add test material above to source
distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (struct changed_type_or_decl_comp, struct
changed_vars_comp): New comparison functors.
(sort_changed_type_or_decl, sort_changed_vars): New static
functions.
(scope_diff::report): Use the above to sort changed declarations,
and types in a given scope.
(corpus_diff::report): Likewise for the changed variables.
* tests/data/test-abidiff/test-struct1-report.txt: Adjust.
* tests/data/test-diff-suppr/test7-var-suppr-report-0.txt:
Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-8.txt:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (represent): When a virtual member
function has no associated elf symbol, do not emit garbage in lieu
of the linkage name. Just emit no linkage name;
* tests/data/test-abidiff/test-struct1-report.txt: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (get_member_function_is_virtual): Declare new
overload for pointers.
* src/abg-ir.cc (get_member_function_is_virtual): Define it.
(function_decl::get_pretty_representation): Print virtual-ness of
the function_decl being pretty printed.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tests/data/test-bidiff: Rename this directory to
tests/data/test-abidiff.
* tests/test-bidiff.cc: Renamed this to tests/test-abidiff.cc.
* tools/biar.cc: Renamed to tools/abiar.cc
* tools/bidiff.cc: Renamed to tools/abidiff.cc
* tools/bidw.cc: Renamed to tools/abidw.cc
* tools/bilint.cc: Renamed to tools/abilint.cc
* tools/bisym.cc: Renamed to tools/abisym.cc
* tests/test-alt-dwarf-file.cc: Renamed references to bidw* to abidw*.
* tests/test-diff-filter.cc: Renamed references to bidiff to abidiff.
* tests/test-lookup-syms.cc: Renamed references to bisym to abisym.
* tools/Makefile.am: Adjust.
* tests/Makefile.am: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>