mirror of
git://sourceware.org/git/libabigail.git
synced 2025-01-20 16:30:44 +00:00
b1bbb67b2f
In some scenarios where we declare same data types `recursively' such as: like linked list, functions that accept the same pointer to function as arguments, forward types declarations to build structures with member fields with mutual dependencies, etc., an assertion is trigger: abidw: ../../../libabigail-upstream/src/abg-ir.cc:25251: size_t abigail::ir::hash_as_canonical_type_or_constant(const abigail::ir::type_base*): Assertion `__abg_cond__' failed. It is happening because the recursively behavior of `process_ctf_type' and `process_ctf_*' used to register ctf types doesn't verify when a ctf_type was processed and registered before by their subsequence _recursive_ calls, so `type_base' object is built more than once and the second time when it is inserted in `types_maps', it refuses in a silent way, being that the key was already inserted, however `add_decl_to_scope', `bind_function_type_life_time' successfully registered the ctf type object. In this patch `process_ctf_type' delegates register types task to `process_ctf_*' functions guaranteeing a single ctf type registration, also it improves the performance looking for the type before start to build it again. * src/abg-ctf-reader.cc (process_ctf_base_type): Add new `translation_unit_sptr' parameter. Add condition to validate success 'base_type' construction and register type object. (process_ctf_typedef): Add `lookup_type' to get a `type_base' object when this was previously created, if this is not the case, register ctf type. Add condition to validate success 'base_type' construction and register type object. (process_ctf_function_type): Likewise. (process_ctf_array_type): Likewise. (process_ctf_qualified_type): Likewise. (process_ctf_pointer_type): Likewise. (process_ctf_struct_type): Add `add_decl_to_scope'. (process_ctf_union_type): Likewise. (process_ctf_type): Add `lookup_type' to get a `type_base' object when this was previously created. Delegate register type object to `process_ctf_*'. * tests/data/Makefile.am: Add tests I/O and expected files. * tests/data/test-read-ctf/test-array-of-pointers.[co]: New testcase. * tests/data/test-read-ctf/test-list-struct.[co]: Likewise. * tests/data/test-read-ctf/test-callback.[co]: Likewise. * tests/data/test-read-ctf/test-callback2.[co]: Likewise. * tests/data/test-read-ctf/test-functions-declaration.[co]: Likewise. * tests/data/test-read-ctf/test-forward-type-decl.[co]: Likewise. * tests/data/test-read-ctf/test-array-of-pointers.abi: Expected test output. * tests/data/test-read-ctf/test-callback.abi: Likewise. * tests/data/test-read-ctf/test-callback2.abi: Likewise. * tests/data/test-read-ctf/test-forward-type-decl.abi: Likewise. * tests/data/test-read-ctf/test-functions-declaration.abi: Likewise. * tests/data/test-read-ctf/test-list-struct.abi: Likewise. * tests/test-read-ctf.cc: Add testcases to CTF test harness. Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.. | ||
data | ||
lib | ||
.gitignore | ||
Makefile.am | ||
mockfedabipkgdiff.in | ||
print-diff-tree.cc | ||
runtestcanonicalizetypes.sh.in | ||
runtestdefaultsupprs.py.in | ||
runtestdefaultsupprspy3.sh.in | ||
runtestfedabipkgdiff.py.in | ||
runtestfedabipkgdiffpy3.sh.in | ||
runtestslowselfcompare.sh.in | ||
test-abicompat.cc | ||
test-abidiff-exit.cc | ||
test-abidiff.cc | ||
test-alt-dwarf-file.cc | ||
test-annotate.cc | ||
test-core-diff.cc | ||
test-cxx-compat.cc | ||
test-diff2.cc | ||
test-diff-dwarf-abixml.cc | ||
test-diff-dwarf.cc | ||
test-diff-filter.cc | ||
test-diff-pkg.cc | ||
test-diff-suppr.cc | ||
test-dot.cc | ||
test-elf-helpers.cc | ||
test-ini.cc | ||
test-ir-walker.cc | ||
test-kmi-whitelist.cc | ||
test-lookup-syms.cc | ||
test-read-common.cc | ||
test-read-common.h | ||
test-read-ctf.cc | ||
test-read-dwarf.cc | ||
test-read-write.cc | ||
test-svg.cc | ||
test-symtab-reader.cc | ||
test-symtab.cc | ||
test-tools-utils.cc | ||
test-types-stability.cc | ||
test-utils.cc | ||
test-utils.h | ||
test-valgrind-suppressions.supp | ||
update-test-output.py |