It turned out that for some applications using the library, being able
to share the variables returned by
libabigail::ir::corpus::lookup_variable is useful. This patch changes
the API to use shared pointer for variables exported from the ABI
corpus. For the sake of consistency, we should do the same for
function decls, but given the churn, I thought I'd do it for variables
first and see the impact. If it's OK then I'll do it for function
decls too.
* include/abg-comparison.h (string_var_ptr_map): Use a
var_decl_sptr rather than a var_decl*.
* include/abg-corpus.h (corpus::{variable, variables_set}):
Likewise.
(corpus::lookup_variable): Return a var_decl_sptr not a var_decl*.
(corpus::exported_decls_builder::maybe_add_var_to_exported_vars):
Take a var_decl_sptr, not a var_decl*.
* include/abg-fe-iface.h
(fe_iface::add_var_to_exported_or_undefined_decls): Likewise.
* include/abg-ir.h (istring_var_decl_ptr_map_type): Use a
var_decl_sptr rather than a var_decl*.
* src/abg-btf-reader.cc (reader::build_ir_node_from_btf_type):
Adjust call to add_var_to_exported_or_undefined_decls.
* src/abg-comparison-priv.h (var_comp::operator()()): Add a new
overload for var_decl_sptr.
(corpus_diff::priv::{deleted_variable_is_suppressed,
deleted_variable_is_suppressed}): Take a var_decl_sptr not a
var_decl*.
(sort_string_var_ptr_map): Take ...
* src/abg-comparison.cc (sort_string_var_ptr_map): ... a
vector<var_decl_sptr> rather than a vector<var_decl*>.
(corpus_diff::priv::ensure_lookup_tables_populated): Adjust.
(variable_is_suppressed): Likewise.
(corpus_diff::priv::{deleted_variable_is_suppressed,
added_variable_is_suppressed}): Likewise.
* src/abg-corpus-priv.h (str_var_ptr_map_type)
(istr_var_ptr_map_type): Use a var_decl_sptr rather than a
var_decl*.
(corpus::exported_decls_builder::priv::{add_var_to_map,
keep_wrt_id_of_vars_to_keep, keep_wrt_regex_of_vars_to_suppress,
keep_wrt_regex_of_vars_to_keep}): Likewise.
(corpus::exported_decls_builder::priv::vars): Likewise.
* src/abg-corpus.cc
(corpus::exported_decls_builder::maybe_add_var_to_exported_vars):
Likewise.
(var_comp::operator()()): Add an overload for var_decl_sptr.
(corpus::lookup_variable): Return var_decl_sptr rather than
var_decl*.
* src/abg-ctf-reader.cc (reader::process_ctf_archive): Adjust.
* src/abg-dwarf-reader.cc (build_ir_node_from_die): Adjust.
* src/abg-fe-iface.cc
(fe_iface::add_var_to_exported_or_undefined_decls): Take a
var_decl_sptr rather than a var_decl*.
* src/abg-reader.cc (build_class_decl, handle_var_decl): Adjust.
* src/abg-writer.cc (write_translation_unit): Likewise.
* tools/abicompat.cc (var_change::decl, var_change::var_change):
Likewise.
(compare_expected_against_provided_variables): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
If the 'big-tests' sub-directory (or a symbolic link to it) is present
then this patch configures it.
By default, the patch defines a new git sub-module into the
'big-tests' sub-directory. That git sub-module is the repository
git://sourceware.org/git/libabigail-tests. Users can now add the
--recurse-submodules option to git clone when they clone
git://sourceware.org/git/libabigail, so that it clones git big-tests
submodule as well.
The patch adds a new 'big-tests' target (to the top-most Makefile.am)
which runs "make check" in the big-tests sub-directory.
The patch also adds a new 'full-check' target that runs targets check,
check-self-compare and big-tests.
* Makefile.am: Add big-tests,clean-big-tests and full-check
targets.
* configure.ac: Add an --enable-big-tests option. For now, this
option is mandatory to handle the optional 'big-tests' support.
If the --enable-big-tests option is provided and if the
'big-tests' sub-directory is present, configure the big-tests/
sub-package.
* .gitmodules: New sub-module configuration to get
git://sourceware.org/git/libabigail-tests and stick into ...
* big-tests: ... this directory as a sub-module.
* CONTRIBUTING: Update this to explain how to get the Big Tests
going.
* tests/Makefile.am: Update the test summary for the
check-self-compare target.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It turned out abidw --abidiff (self-comparison) doesn't work when
analyzing a Linux Kernel tree. In other words, abidw cannot
self-compare a Linux Kernel tree. Embarrassing. Fixed thus.
* include/abg-corpus.h (is_corpus_group): Declare ...
* src/abg-corpus.cc (is_corpus_group): ... new function.
* src/abg-ctf-reader.cc (create_reader): Support --debug-abidiff
when the package is configured with --enable-debug-self-comparison.
* tools/abidw.cc (load_corpus_and_write_abixml): Factorize self
comparison code out into ...
(perform_self_comparison): ... this.
(load_kernel_corpus_group_and_write_abixml): Use the new
perform_self_comparison to perform self comparison when the
--abidiff option is provided. Also, support --debug-abidiff when
the package is configured with --enable-debug-self-comparison.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It appears that the comparison engine does not take changes in the
underlying types of sub-ranges into account when looking for sub-range
changes.
This patch fixes that issue.
Then the patch amends the diff model of array_diff to make it take
into account sub-range diffs as children diff nodes. Then it updates
redundancy propagation to make sure changes to sub-ranges are always
reported even when they are redundant. The patch filters out harmless
name changes to integral types, by default.
* include/abg-comparison.h (array_diff::array_diff): Take a vector
of sub-range diffs as children diff nodes.
(array_diff::{subrange_diffs, any_subrange_diff_to_be_reported}):
Declare new methods.
(is_anonymous_subrange_diff): Declare new function.
* src/abg-comp-filter.cc (integral_type_has_harmless_name_change):
Define new function.
(has_harmless_name_change): Use the new
integral_type_has_harmless_name_change.
* src/abg-comparison-priv.h (array_diff::priv::subrange_diffs_):
Define new data member.
* src/abg-comparison.cc (is_anonymous_class_or_union_diff): Fix
comment.
(is_anonymous_subrange_diff): Define new function.
(array_diff::chain_into_hierarchy): Append sub-range diffs as
children nodes of the array_diff node.
(array_diff::array_diff): Take a vector of sub-range diffs as
children diff nodes.
(array_diff::{subrange_diffs, any_subrange_diff_to_be_reported}):
Define new methods.
(array_diff::has_changes): Take sub-range diffs into account.
(compute_diff): In the overload for array_type_def, compute diffs
for sub-ranges as part of the diff for array_type_defs.
(leaf_diff_node_marker_visitor::visit_begin): Do not consider an
anonymous sub-range diff node as being a leaf diff node to report
about.
(redundancy_marking_visitor::visit_end): Report all sub-range diff
nodes changes; do not propagate their (potential) redundancy to
their array_diff node parent.
* src/abg-default-reporter.cc (default_reporter::report): In the
overload for array_diff, if there is a sub-range change to be
reported, then report it.
* src/abg-ir-priv.h (real_type::base_type): Add SIZE_BASE_TYPE,
SSIZE_BASE_TYPE, BIT_SIZE_BASE_TYPE, SBIT_SIZE_BASE_TYPE,
ARRAY_SIZE_BASE_TYPE enumerators to this enum.
* src/abg-ir.cc (parse_base_real_type): Support parsing real type
names that are __ARRAY_SIZE_TYPE__, sizetype, ssizetype,
bitsizetype and sbitsizetype.
(real_type::to_string): Support IZE_BASE_TYPE, SSIZE_BASE_TYPE,
BIT_SIZE_BASE_TYPE, SBIT_SIZE_BASE_TYPE and ARRAY_SIZE_BASE_TYPE
enumerators.
(equals): In the overload for array_type_def::subrange_type,
compare the underlying types of the sub-ranged. In the overload
for array_type_def, consider sub-range changes mismatch as a local
non-type change. This is so that changes to sub-ranges don't get
filtered out because changes to element types are redundant.
* src/abg-reporter-priv.cc (represent): In the overload for
subrange_diff, clean up reporting of change of bound values.
Also, add reports of changes from non-finite to finite size.
* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-1.txt:
Adjust.
* Tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-2.txt:
Likewise.
* tests/data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-1.txt:
Likewise.
* tests/data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-2.txt:
Likewise.
* tests/data/test-abidiff-exit/test-allow-type-array-v0--v1-report-1.txt:
Likewise.
* tests/data/test-abidiff-exit/test-allow-type-array-v0--v3-report-1.txt:
Likewise.
* tests/data/test-abidiff/test-PR27985-report.txt: Likewise.
* tests/data/test-diff-dwarf/test10-report.txt: Likewise.
* tests/data/test-diff-dwarf/test11-report.txt: Likewise.
* tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-clang-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-gcc-report-0.txt:
Likewise.
* tests/data/test-diff-filter/PR24430-fold-qualified-array-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test-PR29811-0-report-1.txt:
Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
Likewise.
* tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt:
Likewise.
* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt:
Likewise.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
Likewise.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/test-has-strict-flexible-array-data-member-conversion-report-2.txt:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It turns out what we call integral_type in the libabigail IR is
actually a real_type because it includes real types (float and
double). This patch rights that wrong.
* include/abg-fwd.h (is_real_type): Declare new function.
* src/abg-ctf-reader.cc (process_ctf_base_type): Adjust.
* src/abg-dwarf-reader.cc (die_qualified_type_name)
(build_type_decl): Adjust.
* src/abg-ir-priv.h (class real_type): Rename class integral_type
into this.
* src/abg-ir.cc (get_internal_real_type_name, operator|)
(operator&, operator~, operator|=, operator&=)
(parse_real_type_modifier, parse_base_real_type, parse_real_type)
(real_type::{real_type, get_base_type, get_modifiers,
set_modifiers, to_string, operator string()}):
s/integral_type/real_type.
(type_decl::{type_decl, get_qualified_name,
get_pretty_representation}): Adjust.
(is_real_type): Define new function.
(is_integral_type): Use the new is_real_type.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
As we are now sorting types so that they are
always compared in the same order during canonicalization,
irrespective of the front-end, I believe stripping typedefs from
function parameteres and return types during comparison is no more
necessary. And also, that removes so spurious changes reports.
* src/abg-ir.cc (equals): In the overloads from function_type and
function_decl::parameter, do not strip typedefs off of types
becore comparing them.
* tests/data/test-abidiff-exit/PR30329/PR30329-report-1.txt:
Adjust.
* tests/data/test-abidiff-exit/PR30503/libsdl/libsdl-1.2.60-1.2.64-report.txt:
Adjust.
* tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-1.txt:
Adjust.
* tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-2.txt:
Adjust.
* tests/data/test-annotate/test14-pr18893.so.abi: Adjust.
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-annotate/test17-pr19027.so.abi: Adjust.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Adjust.
* tests/data/test-diff-dwarf/test2-report.txt: Adjust.
* tests/data/test-diff-filter/test3-report.txt: Adjust.
* tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt:
Adjust.
* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Adjust.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Adjust.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Adjust.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
variadic parameter type is not added to its proper scope, leading to
issues down the road. Fixed thus.
* src/abg-ir-priv.h (type_topo_comp::operator()): Do not compare
types using their location anymore. It's unnecessary (now that
types are sorted before canonicalization) and it wreaks havoc with
the new properly constructed variadic parameter types.
* src/abg-reader.cc (build_ir_node_for_variadic_parameter_type):
Define new function. Add variadic parameter type to the global
scope of the current translation unit.
(build_function_parameter, build_type_decl): Use the new
build_ir_node_for_variadic_parameter_type.
* tests/data/test-read-write/test17.xml: Adjust.
* tests/data/test-read-write/test19.xml: Likewise.
* tests/data/test-read-write/test20.xml: Likewise.
* tests/data/test-read-write/test21.xml: Likewise.
* tests/data/test-read-write/test22.xml: Likewise.
* tests/data/test-read-write/test23.xml: Likewise.
* tests/data/test-read-write/test25.xml: Likewise.
* tests/data/test-read-write/test26.xml: Likewise.
* tests/data/test-read-write/test28-without-std-fns-ref.xml:
Likewise.
* tests/data/test-read-write/test28-without-std-vars-ref.xml:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
build_ir_node_for_void_pointer_type and build_ir_node_for_void_type
get the type IR from the environment, add it to the global scope of
the current translation unit and schedule it for type
canonicalization.
This patch change the code of these functions so that the adding to
the scope and the canonicalization are done only on the first
invocation of these functions. Subsequent invocations just return the
type IR.
Otherwise, subsequent invocations were unnecessarily trying to add the
type IR to yet another global scope and were trying to canonicalize it
again.
* src/abg-reader.cc (build_ir_node_for_void_pointer_type)
(build_ir_node_for_void_type): Add the type to its scope and
schedule it for canonicalization just once.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The ABIXML reader currently canonicalizes some (simple) types directly
and schedules canonicalization of other types for after the corpus has
been built. This dual mode of operation was used back then when
ABIXML types were not aggressively de-duplicated as they are now.
Today, type canonicalization needs to happen in the same way for all
readers.
This patch thus schedules type canonicalization for after the creation
of the corpus, in the ABIXML reader.
* src/abg-reader.cc (reader::maybe_canonicalize_type): Remove.
(reader::schedule_type_for_canonicalization): Do not schedule
nullptr types for canonicalization.
(reader::perform_type_canonicalization): Rename
perform_late_type_canonicalizing into this.
(reader::{read_corpus, build_or_get_type_decl}): Adjust call to
maybe_canonicalize_type into schedule_type_for_canonicalization.
(read_translation_unit_from_file)
(read_translation_unit_from_buffer, read_translation_unit)
(build_function_decl, build_ir_node_for_void_type)
(build_array_type_def, build_ir_node_for_void_pointer_type)
(build_class_decl, build_union_decl)
(build_class_tdecl, build_type_tparameter, build_type_composition)
(build_template_tparameter, build_type, handle_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_function_type)
(handle_array_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_class_decl, handle_union_decl):
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Reading of corpus group is broken in the ABIXML reader. Only the main
corpus is read and then, abixml::reader::read_corpus_group_from_input
fails to read subsequent corpora.
This patch fixes abixml::reader::read_corpus_group_from_input and
makes it call a new abixml::reader::initialize function, much like
what the ELF based readers are doing.
* src/abg-fe-iface.cc (fe_iface::priv::initialize): Do not clear
the corpus group upon initialization.
* src/abg-reader.cc (reader::initialize): Define new function.
Make it call fe_iface::initialize.
(reader::clear_per_corpus_data): Remove.
(reader::read_corpus): Remove call to clear_per_corpus_data.
(reader::read_corpus_group_from_input): After calling
reader::read_corpus and adding the resulting corpus to the group,
get the next sibling XML element node. If it's an "abi-corpus"
node then re-initialize the reader by invoking the new
reader::initialize and move on to read it by invoking
reader::read_corpus again.
* tests/data/test-diff-suppr/test45-abi-report-1.txt: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Analyzing a single kernel binary has been broken for a long time, it
seems. For the record, I mean this:
$ abidw --ctf vmlinux > vmlinux.ctf.abi
Doesn't work.
This patch fixes ctf::reader::slurp_elf_info to make it not crash on
binaries that have no CTF sections because there is a .ctfa file in
the same directory.
Also, it fixes ctf::reader::read_corpus to support loading the CTF
archive for individual kernel binaries and not just for entire trees
(corpus groups). In the case of individual kernel binaries, the
archive can be built from the CTF sections of the binary.
* src/abg-ctf-reader.cc (reader::slurp_elf_info): Do not crash on
a kernel binary that has no CTF section because the CTF
information is in a .ctfa file in the same directory.
(reader::read_corpus): Support loading a CTF archive for a single
kernel binary. Also, support loading the CTF archive from the CTF
sections in the binary itself not necessarily from a .ctfa file in
the same directory.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The patch
https://sourceware.org/git/?p=libabigail.git;a=commit;h=666555665cc4fcfc8ae19661c489822e0df00ae3
introduced a mistake: It frees the CTF archive object during the
re-initialization of the reader between each binary (kernel or
module). The archive contains CTF type information for a kernel and
all its modules. So it should be kept around until all those binaries
are analyzed. Instead, that patch frees the CTF archive object after
handling each binary. Oops.
This patch fixes that problem by free-ing the CTF archive only when
the reader itself is freed, presumably, after analyzing all binaries.
Similarly, the type map maintained by the reader contains types for
the kernel and all its modules. So it should not be freed at
re-initialization time. Rather, what should be freed is only the
types that are to be canonicalized at the end of processing of a given
binary. So the patch makes the reader maintain types to be
canonicalized in a vector and clears that vector at each
re-initialization.
At re-initialization time, the patch also avoids resetting the corpus
group that the current reader feeds.
* src/abg-ctf-reader.cc (reader::types_to_canonicalize): Add data
member.
(reader::add_type): Add the new type to the vector of types to be
canonicalized. Update comment.
(reader::canonicalize_all_types): Now that the reader maintains
the vector of types to be canonicalized, just pass that vector to
canonicalize_types. reader::types_map contains all the types that
have been created in all the binaries processed by this reader so
far. Many of these types have already been canonicalized at the
end of the analysis of binaries that have already been processed.
Only the types created during the processing of the current binary
have not yet be canonicalized and reader::types_to_canonicalize is
where they are maintained. So reader::types_map should be left
alone by this function.
(reader::initialize): Do not close the CTF archive here. Do not
clear reader::{types_map, corpus_group} either.
(reader::read_corpus): Use nullptr, not NULL. Make sure to not
re-open an archive that has already been opened.
(reader::~reader): Mark a closed archive. This is more cosmetic
than anything else.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
All union data members should have an offset set to 0. It turns out
the CTF reader unnecessarily sets the data member offset. This patch
fixes that.
* src/abg-ctf-reader.cc (process_ctf_sou_members): Do not set any
union data member offset.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The CTF front-end produces an artificial translation unit with an
empty path for all the types in a given ABI corpus. Adding such a
translation unit to its corpus is conditioned on it having a non-empty
path. Oops. Fixed thus.
* src/abg-corpus.cc (corpus::add): Do not require that the path of
the translation unit be non-empty.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It turns out the BTF front-end won't take kernel modules into account
when analyzing a linux kernel build tree.
This is because it doesn't support split and base BTF objects.
Please note that the BTF API is not yet documented in
https://docs.kernel.org/bpf/btf.html, so my understanding of how it
works comes the source code of the bpftool program available at
https://github.com/libbpf/bpftool and https://github.com/libbpf/libbpf.
When analyzing the vmlinux binary, the btf__parse function returns a
"base BTF object" which contains the type information contained in the
.BTF section of that binary. The memory of the BTF types describing
the types of vmlinux lives in the base BTF object. So the base BTF
object must be kept around for the entire time of the analysis of the
Linux kernel tree (vmlinux + modules).
When analyzing a kernel module however, it's the btf__parse_split
function that is used. That function takes into parameter the "base
BTF object" representing the type information of the corresponding
vmlinux binary and returns a "split BTF object" which contains the
type information contained in the .BTF section of the kernel module.
Please note that the split BTF object does reference the base BTF
object as well. The memory of the BTF types describing the types the
kernel module lives in the split BTF object. Because some types and
decls might be exported by a kernel module and used by another one,
the memory of a given split BTF object might be needed to be kept
alive for the entire time of the analysis of the Linux kernel tree as
well.
It's this base/split model of BTF that is not supported by the BTF
front-end.
This patch introduces support for that model.
At any point in time, the BTF front-end now has one handle to the base
BTF object and one handle to the current split BTF object if we are
looking at kernel module. The base and split BTF objects are kept
around for the entire lifetime of the front-end.
For a given binary, each type is identified by a type ID. The
validity of a given type ID is effective only for that binary. The
same type ID in another binary might designate another type. So
rather than maintaining a map that associates a type ID with a libabigail
IR artifact, the front-end now maintains a map that associates a
*type* with libabigail IR artifact.
With this changes, abidw can now analyze and emit the ABIXML for a
linux kernel tree in 28 seconds, using BTF. It can self-compare a
kernel tree in 36 seconds.
* src/abg-btf-reader.cc (btf_type_to_abi_artifact_map_type):
Rename btf_type_id_to_abi_artifact_map_type into this. Make it
associate a btf_type* to a libabigail IR, rather than a type ID to
a libabigail IR.
(reader::{base_btf_handle_, base_btf_file_name_,
split_btf_handle_, split_btf_file_name_, split_btfs_to_free_}):
Define new data members.
(reader::{btf_handle_}): Remove.
(reader::base_btf_handle): Renamed btf_handle into this. Create
the BTF object using btf__parse. Store the name of the binary
into reader::base_btf_file_name_.
(reader::read_split_btf): Define new member function.
(reader::btf_handle): This is new code for an existing member
function name. Return the current split BTF object handle if
applicable, otherwise create the base BTF object handle.
(reader::btf_type_to_artifacts_): Renamed
btf_type_id_to_artifacts into this.
(reader::associate_artifact_to_btf_type): Renamed
associate_artifact_to_btf_type_id into this.
(reader::schedule_type_for_canonicalization): Do not schedule a
type that has already been canonicalized.
(reader::nr_btf_types): Take a BTF* parameter.
(reader::~reader): Free all the allocated split BTF objects.
(reader::read_debug_info_into_corpus): If we are looking at a
split BTF, then set the first type ID as the one right after the
last type ID of the base BTF.
(reader::build_ir_node_from_btf_type): Clean-up the logic for
building type void type.
(reader::{build_ir_node_for_void_type,
build_ir_node_for_void_pointer_type,
build_ir_node_for_variadic_parameter_type,
build_enum_underlying_type, build_array_type}): Schedule type for
canonicalization at the end of the IR construction, not right
away.
* src/abg-tools-utils.cc (create_best_elf_based_reader): Pass
show_all_types and linux_kernel_mode arguments to
btf::create_reader.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, I noticed the logic of
elf_based_reader::read_and_add_corpus_to_group wasn't clear. The
corpus should be read (thus created) first, then added to the reader.
Fixed thus.
* src/abg-elf-based-reader.cc
(elf_based_reader::read_and_add_corpus_to_group): Fix logic.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
I noticed crashes in canonicalize_types when it deals with nullptr
types. Fixed thus.
* src/abg-ir-priv.h (canonicalize_types): Avoid crashing when
de-referencing an iterator to a nullptr type.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The current code checks explicitly for musl and if so uses pkg-config to
find fts-standalone. This is suboptimal because musl may not be the only
libc to need a standalone fts implementation, and fts-standalone is an
old gentoo-specific name[1] so libabigail won't build on any other system
against musl.
Instead, use AC_SEARCH_LIBS to look for fts_open in libc then libfts. Do
this before the check for behaviour just in case someone has a standalone
and broken implementation. I assume that the standalone fts is installed
on the standard search path, which should be a fair assumption.
As we're not using pkg-config anymore the required link flags are now in
LIBS, so remove all instances of FTS_CFLAGS and FTS_LIBS.
[1] https://gitweb.gentoo.org/repo/gentoo.git/commit/sys-libs/fts-standalone?id=a403fe6c61d1aaeecd58d521f3def2f6d3513449
* configure.ac: Use AC_SEARCH_LIBS to look for fts_open in libc
and in libfts if necessary. Remove the use of FTS_LIBS which is
now unnecessary.
* src/Makefile.am: Do not use FTF_LIBS as it's now unnecessary.
* tools/Makefile.am: Likewise.
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
btf::reader::initialize forgets to reset a few data members used
during binary type information loading. This resetting is key to get
the reader ready for being re-used to load a new binary, like a kernel
module. Otherwise, the working set just keeps growing unnecessarily.
* src/abg-btf-reader.cc (btf::reader::initialize): Clear
types_to_canonicalize_, btf_type_id_to_artifacts_ and cur_tu_.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
After cleaning up re-initialization sequence of the the CTF reader ,
Claudiu Ianculescu suggested that I look into the DWARF reader's
initialization sequence as well. Lo and behold, the
dwarf::reader::read_debug_info_into_corpus calls
reader::clear_per_corpus_data while reader::initialize does not.
This patch moves the call to reader::clear_per_corpus_data into
reader::initialize. It makes the code consistent with what we are now
doing in the CTF reader.
* src/abg-dwarf-reader.cc (reader::initialize): Call
clear_per_corpus_data.
(reader::read_debug_info_into_corpus): Remove the call to
clear_per_corpus_data from here.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Profiling showed that during pre-canonicalization types sorting (which
uses type_topo_comp and decl_topo_comp sorting functors) we spend a
lot of time computing the pretty representation of types and decls
invoked from type_topo_comp::operator() and
decl_topo_comp::operator().
This patch thus uses type_base::get_cached_pretty_representation and
introduces a new similar decl_base::get_cached_pretty_representation
to cache the pretty representation of types and decls and re-use that
representation instead of computing it over and over.
Together with the previous patch of this series, the time spent to
analyze a Linux Kernel tree went from ~ 55 minutes to around 1m15s
using a non-optimized build of libabigail.
* include/abg-ir.h (decl_base::get_cached_pretty_representation):
Declare new member function.
* src/abg-ir-priv.h ({type,decl}_topo_comp::operator()): Use
{type,decl}_base::get_cached_pretty_representation instead of
get_pretty_representation.:
* src/abg-ir.cc (decl_base::priv::{internal_cached_repr_,
cached_repr}): Define new data members.
(decl_base::get_cached_pretty_representation):
Define new member function.
(type_base::get_cached_pretty_representation): Cache pretty
representation even for non-canonicalized types. Fix comments.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When analyzing a Linux Kernel tree made of vmlinux and loadable module
binaries, the same (CTF) binary reader is re-used to load every single
binaries in a loop. That can be seen, for instance, by reading the
code of load_vmlinux_corpus in abg-tools-utils.cc.
As part of that process, abigail::ctf::reader::initialize is invoked
prior to using the reader to read type information from each binary.
But then, looking at things a bit closer, I realized that
ctf::reader::initialize is failing to reset the reader::ctfa data
member. That leads to a memory leak that was making things grow
out of proportion.
Also, the resetting code fails to actually clear out the map of types
that are to be sorted and canonicalized. That leads to unnecessarily
sorting huge amounts of types.
The patch address the two points above.
Apart from the obvious gain in code integrity, this patch
significantly reduces the time taken to analyze a Linux Kernel tree.
Please note that the subsequent patch coming after this one will
reduce that time even further.
* src/abg-ctf-reader.cc (reader::reader): Initialize ctfa,
ctf_sect, symtab_sect and strtab_sect data members.
(reader::initialize): In the overload taking no argument, make
sure to free the ctfa data member before setting it to nullptr.
In the overload that takes arguments, make sure to invoke
reader::initialize() to really free the data used. Also, improve
the comments.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Log the time spent while reading the CTF archive and canonicalizing it.
* src/abg-ctf-reader.cc (do_log()): Getter of the do_log flag.
(read_corpus()): Add time logging.
Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Sorting the functions and variables is done twice. First in the
process_ctf_archive() and second in read_corpus(). However, we need
to call them only once when we do the canonicalization of all types
and functions. Thus, move canonicalization of types in read_corpus()
and perfom only once sorting the functions and types.
* abg-ctf-reader.cc (process_ctf_archive()): Move
canonicalize_all_types(), sort_functions() and sort_variables()...
(read_corpus()): ...here, just after calling process_ctf_archive().
Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-leaf-reporter.cc (leaf_reporter::report): In the
overload for corpus_diff, avoid using auto type deduction in
for-each loop.
Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When analyzing a Linux Kernel tree, the BTF reader needs to be reset
after each binary (vmlinux or module) read. It turns out the reset
was not being done properly. Fixed thus. Also, I noticed that
reader::read_debug_info_into_corpus would not return an empty corpus
when no BTF information was found in the binary. Fixed as well.
* src/abg-btf-reader.cc (reader::initialize): Free the btf handle
first thing as part of the re-initialization.
(reader::~reader): Once the BTF handle has been freed, set it to
nil to show that it's been deleted.
(reader::read_debug_info_into_corpus): If no BTF handle could be
retrieved then it means no BTF data was found on the binary.
Thus, return an empty corpus.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When building the ABI for a Linux kernel that has BTF and DWARF debug
info, the --btf option doesn't select the BTF debug info if DWARF is
also present.
Fixed thus.
* tools/abidw.cc (load_kernel_corpus_group_and_write_abixml):
Support --btf.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When 'abidw --lt /some/dir' runs with /some/dir being a linux kernel
tree built from source (as opposed to coming from a distribution),
get_binary_paths_from_kernel_dist misbehaves because it expects to
find modules somewhere under/lib/modules. This patch makes it support
linux kernel trees built from source by looking for modules all over
the place, wherever they might be.
* src/abg-tools-utils.cc (get_binary_paths_from_kernel_dist): Look
for kernel modules under the root directory by default.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When is_regular_file is given a directory, it loops endlessly. Oops.
Fixed thus.
* src/abg-tools-utils.cc (is_regular_file): Loop on symbolic links
only.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, it appeared that the process of
setting the size of the array_type_def::subrange_type is wrong for all
front-ends.
For this patch, I went back to read the DWARF 5 specification at
"5.13/ Subrange Type Entries".
Basically, the size of the subrange type as described by the
DW_TAG_subrange_type DIE is set either:
* by the size of the base type designated by the DW_AT_type
attribute.
* or by the DW_AT_byte_size or DW_AT_bit_size attribute that might
be present on the DIE.
That is different from the length property carried by the subrange
type.
The patch updates the four front-rends (DWARF, BTF, CTF and ABIXML) to
fix the setting process of the size of the subrange type and adjusts
the testsuite accordingly.
* src/abg-btf-reader.cc (reader::build_array_type): The size of
the subrange is not defined specifically. Let's set it to the
default address size of the translation unit.
* src/abg-ctf-reader.cc (build_array_ctf_range): If no basis type
was found, then set the size of the subrange type to the default
address size of the translation unit.
* src/abg-dwarf-reader.cc (build_subrange_type): Consider the
DW_AT_byte_size and DW_AT_bit_size attribute of
DW_TAG_subrange_type if present. Otherwise, if the basis type is
present, its size as the size of the subrange type. Otherwise,
use the default address size of the translation unit as the size
of the subrange type.
* src/abg-ir.cc (array_type_def::subrange_type::subrange_type): If
the underlying (basis) type is present, then use its size as the
size of the subrange type. Otherwise the size is zero.
(array_type_def::subrange_type::set_underlying_type): Update the
size of the subrange when setting a new underlying (basis) type.
* src/abg-reader.cc (build_subrange_type): Read and set the size
of the subrange.
* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-1.txt:
Adjust.
* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-2.txt:
Likewise.
* tests/data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-1.txt:
Likewise.
* tests/data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-2.txt:
Likewise.
* tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Cestmir Kalina reported that running configure with --enable-btf with
no BTF header present on the system wrongly leads to the BTF
front-end of libabigail being enabled, and later leads to
compilation/installation errors.
This patch fixes that by ensuring that the ENABLE_BTF variable set by
the --enable-btf option handling code is not reused later during
actual btf.h header file detection code.
* configure.ac: Use a new HAS_BTF_HEADERS to store the detection
status for the btf.h header. Emit a better notice message when
the BTF header file is found.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Tested-by: Cestmir Kalina <ckalina@redhat.com>
For now, the BTF nodes BTF_KIND_DECL_TAG, BTF_KIND_DATASEC, and
BTF_KIND_UNKN are ignored by libabigail, in practice. We should thus
not abort when we encounter them. Fixed thus. Many thanks to Cestmir
Kalina for reporting this.
* src/abg-btf-reader.cc (build_ir_node_from_btf_type): Ignore and
return nil for node of kind BTF_KIND_DECL_TAG, BTF_KIND_DATASEC,
and BTF_KIND_UNKN. For all other nodes, abort.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
# Veuillez saisir le message de validation pour vos
modifications. Les lignes # commençant par '#' seront ignorées, et
un message vide abandonne la validation. # # Sur la branche
master # Votre branche est à jour avec 'origin/master'. # #
Modifications qui seront validées : # modifié :
src/abg-btf-reader.cc # # Fichiers non suivis: #
doc/api/libabigail.doxy.bak # patches/ # prtests/ # #
------------------------ >8 ------------------------ # Ne touchez
pas à la ligne ci-dessus. # Tout ce qui suit sera éliminé.
diff --git a/src/abg-btf-reader.cc b/src/abg-btf-reader.cc
index f22e92bf..67206bb4 100644
--- a/src/abg-btf-reader.cc
+++ b/src/abg-btf-reader.cc
@@ -486,12 +486,16 @@ public:
#ifdef WITH_BTF_KIND_TYPE_TAG
case BTF_KIND_TYPE_TAG/* Type Tag */:
+ break;
#endif
#ifdef WITH_BTF_KIND_DECL_TAG
case BTF_KIND_DECL_TAG/* Decl Tag */:
+ break;
#endif
case BTF_KIND_DATASEC/* Section */:
+ break;
case BTF_KIND_UNKN/* Unknown */:
+ break;
default:
ABG_ASSERT_NOT_REACHED;
break;
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This fixes the temporary breakage I have introduced by committing too
soon the patch below that should have been committed after the type
hashing patch:
d26bd3d2 dwarf-reader,ir: Merge member fns of classes
Oops.
That patch introduces some instability in the ABIXML output due to the
fact that sorting of function types in particular is not deterministic
enough. I believe that because the sorting is using the internal
pretty representation of function types, it can introduce instability
in the sorting of two types that are equivalent modulo one typedef,
because the internal pretty representation strips typedefs off of
function return and parameter types. This patch fixes that by using
the type_topo_comp operator used in the IR for sorting types, instead
of having a different sorting routine in the ABIXML writer. Another
instability is due to the fact that method types where there is no
parameter beside the implicit "this" parameter and that are different
due to const-ness of the enclosing class could not be told apart. The
patch fixes that as well.
The patch also sorts types before canonicalizing them in the ABIXML
reader, so that type canonicalization happens in the same order (in
DWARF and ABIXML) to minimize changes in canonicalization results
between DWARF and ABIXML. This should hopefully help minimize
self-comparison errors.
Note that sorting types (based on their pretty representation) before
canonicalizing them might incur some (temporary) slowness that I
believe should be handled by the coming type hashing patch set. If we
see that the slowness is not bearable, we might remove that sorting at
some point. For now, let's keep it for testing purposes.
* src/abg-ctf-reader.cc (reader::canonicalize_all_types): Use a
temporary vector as input for ir::canonicalize_types because it
needs an ordered container as it now sorts types before
canonicalizing them.
* src/abg-dwarf-reader.cc (reader::types_to_canonicalize): Add a
non-const overload for this accessor.
* src/abg-ir-priv.h (compare_using_locations)
(is_ptr_ref_or_qual_type): Add a declaration for these functions
defined in abg-ir.cc.
(struct decl_topo_comp, struct type_topo_comp): Move these here,
from abg-ir.cc.
(canonicalize_types): Sort the types before canonicalizing them.
* src/abg-ir.cc (compare_using_locations): Turn this from static
to non-static, now that it's declared in abg-ir-priv.h.
(struct decl_topo_comp, struct type_topo_comp): Move these into
abg-ir-priv.h.
* src/abg-reader.cc: Include abg-ir-priv.h.
(reader::perform_late_type_canonicalizing): Use
ir::canonicalize_types, rather than canonicalizing types one by
one.
* src/abg-writer.cc: Include abg-ir-priv.h.
(struct type_topo_comp): Remove.
(write_context::sort_types): Use type_topo_comp from abg-ir-priv.h
instead of type_topo_comp that was removed.
* tests/data/test-annotate/test13-pr18894.so.abi: Adjust.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* 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-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.so.abi: 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.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
* tests/data/test-read-write/test28-without-std-fns-ref.xml:
Likewise.
* tests/data/test-read-write/test28-without-std-vars-ref.xml:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-elf-reader.cc (reader::variable_symbol_is_exported): Do
not crash when the symbol we are looking at is non-present.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
I have wrongly added a patch to the source repository. Oops. Remove it.
* patches/0001-WIP-Emit-read-undefined-interfaces-to-from-ABIXML.patch:
Remove from the repository.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The error message in test_task::run_abidw in test-read-common.cc is
wrong. Fixed thus. Also, emit the error message directly to the standard
error as the error is detected.
* tests/test-read-common.cc (test_task::run_abidw): Fix error
message and emit it to stderr directly.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When looking at something else, I realized that in DWARF, two classes
C and C' of the same name and coming from the same corpus might not
have the same member functions that are defined. This is probably
because for a given translation unit, some compilers emit debug info
only for the member functions that are used somehow.
So, depending on which of C or C' is the canonical class in the end,
we will not necessarily have the same member functions emitted in
ABIXML. That is annoying. So there was a kludge in
maybe_adjust_canonical_type to ensure that the canonical type has all
the member functions of the types belonging to same class of
equivalence.
This patch adds a pass before type canonicalization in the DWARF
reader to ensure that all classes of the same name in a given corpus
have the same member functions. The patch thus removes the now
unnecessary kludge from maybe_adjust_canonical_type and asserts the
impossibility of the member function discrepancy.
* src/abg-dwarf-reader.cc (reader::{copy_missing_member_functions,
contains_anonymous_class, merge_member_functions_of_classes,
merge_member_functions_in_classes_of_same_names}): Define new
member functions.
(reader::read_debug_info_into_corpus): Call the reader::new
merge_member_functions_in_classes_of_same_names.
* src/abg-ir.cc (maybe_adjust_canonical_type): When looking at the
canonical type C of a type T, if they both come from the same
corpus, assert that C has all the member functions of T. This
because the DWARF reader now ensures that all types have the same
name in a given corpus have the same member functions.
* tests/data/test-annotate/test14-pr18893.so.abi: Adjust.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* 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-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test16-pr18904.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.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
There is a confusion in the DWARF reader about static member functions
and non-static member functions. With recent versions of DWARF, a
member function with the DW_AT_object_pointer attribute is known to
have a this-pointer and thus designates a non-static member function.
DWARF emitted by gcc 4.4.x and previous compiler didn't emit the
DW_AT_object_pointer so we need to look at the first parameter of the
member function, make sure it's artificial and pointers to a pointer
to the same class as the class of the current member function.
This patch avoids to confuse static and non-static member functions by
telling apart types of static member functions, non-static member
function and non member functions. This fixes the representation of
several method types and function declaration signatures across the
test suite.
* include/abg-ir.h (method_type::get_is_for_static_method): Add
new method.
* src/abg-dwarf-reader.cc (fn_die_first_parameter_die)
(member_fn_die_has_this_pointer, die_peel_typedef): Define new
static functions.
(die_this_pointer_is_const): Make this support DIEs representing
const pointers.
(die_function_type_is_method_type): Use the new
member_fn_die_has_this_pointer function rather than (wrongly) open
coding its functionality. If the (member) function DIE has no
this pointer DIE and if the function is at class scope, then we
are looking a static member function.
(finish_member_function_reading): Use the new
method::get_is_for_static_method method rather than open-coding
its functionality.
* src/abg-ir.cc (method_type::get_is_for_static_method): Define
new method.
(type_topo_comp::operator()): In this comparison
operator for types, if two method types have the same string
representation then if one method type is for a static method,
then make the non-static method type come first.
(function_type::get_first_non_implicit_parm): The first parameter
of a function can only carry the "this pointer" if it's
artificial.
* tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-1.txt:
Adjust.
* tests/data/test-abidiff/test-struct1-report.txt: Likewise.
* tests/data/test-abidiff/test-struct1-v0.cc.bi: Likewise.
* tests/data/test-abidiff/test-struct1-v1.cc.bi: Likewise.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* 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/PR25409-librte_bus_dpaa.so.20.0.abi:
Likewise.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
Likewise.
* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt:
Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt:
Likewise.
* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.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.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
is_non_canonicalized_type is the function that decides which type
should be canonicalized or not. So, code that expects a type to be
canonicalized should comply with the rule of
is_non_canonicalized_type, aka The Rule. It turns out, the IR node
visitor code fails to comply with The Rule. Fixed thus. Note that
with this commit, the program build/tests/testirwalker now works fine
on itself. Many thanks to Cestmir Kalina who noticed and reported the
issue.
* src/abg-ir.cc (ir_node_visitor::{mark_type_node_as_visited,
type_node_has_been_visited}): Invoke is_non_canonicalized_type to
know if we should expect a type to have a canonical type or not.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, it occurred to me that function type
annotation in ABIXML (as emitted by abidw --annotate) is wrong,
especially when it comes to pointer to member function types. Now
that we support pointer to member function types naming, just using
ir::get_type_name in the annotate function should be enough to do the
trick. And this is what this patch does.
Also, I realized that get_function_type_name was wrongly invoking
get_pretty_representation on the return type of the function type,
instead of just emitting its type name. This patch fixes that as
well.
* src/abg-ir.cc (get_function_type_name, get_method_type_name):
Use get_type_name in lieu of get_pretty_representation.
* src/abg-writer.cc (annotate): In the overload for function_type,
use get_function_name instead of open coding function type
representations.
* tests/data/test-annotate/test-pointer-to-member-1.o.annotated.abi: Adjust.
* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* 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-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt: Likewise.
* tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt: Likewise.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt:
Likewise.
* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
'function x() { ... }' is a bashism, but /bin/sh may be another shell,
like dash. Just use an explicit /bin/bash shebang as the file relies on
a few other bashisms like 'type'.
* tests/runtestabidb[1-2].sh.in: Use bash shebang.
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The output of fedabipkgidiff doesn't clearly say when two
(sub)packages have no ABI change.
This patch fixes that. The patch also trims unnecessary white spaces
from the output of fedabipkgdiff. As a result, the patch adjusts the
expected reference output files.
* tools/fedabipkgdiff: Adjust copyright year
(abipkgdiff): Strip out trailing spaces from the stdout
string. Emit a clear message when no ABI change was found.
* tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt:
Adjust.
* tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt:
Adjust.
* tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt:
Adjust.
* tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt:
Adjust.
* tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt:
Adjust.
* tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt:
Adjust.
* tests/data/test-fedabipkgdiff/test6-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt:
Adjust.
* tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt:
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Some distributions don't have the libarchive python module packaged.
This patch makes that module optional and enables abidb to function
without it, as it's only necessary for the support of the '--archive'
command line option of the abidb program.
* configure.ac: Detect the libarchive python module as an optional
dependency for the abidb program. So far, only the git python
module remains a hard dependency.
* tools/abidb (main): Do not support the '--archive' command line
option if the libarchive python module is not present.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The apidoc is not generating any documentation for the libabigail::btf
and libabigail::ctf namespaces.
It turns out I need to add some doxygen comment to the these namespaces
in the source code. Fixed thus.
* include/abg-btf-reader.h (namespace btf): Add doxygen comment.
Just adding it to the *.cc won't cut it, I am not sure why.
* include/abg-ctf-reader.h (namespace ctf): Likewise.
* src/abg-btf-reader.cc (namespace btf): Add doxygen comment.
* src/abg-ctf-reader.cc (namespace ctf): Add doxygen commit.
(create_reader, reset_reader): Fix doxygen comments.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When doing "make doc", doxygen issues a lot of warning due to the the
configuration file using old property values.
This patch updates the doxygen configuration file for the apidoc using
doxygen -u.
* doc/api/libabigail.doxy: Update using doxygen -u.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>