Dodji Seketeli [Fri, 15 Dec 2017 15:10:34 +0000 (16:10 +0100)]
Bug 22437 - Make fedabipkgdiff use all debug info RPMs of a sub-RPM
On ppc64, at least, it can happen that a devel RPM foo-devel.rpm needs
not only the foo-devel-debuginfo.rpm but also the foo-debuginfo.rpm.
In other words, the devel sub-package needs all the debug info RPMs of
foo.rpm.
To make things general, this patch modifies fedabipkgdiff so that all
debuginfo packages are taken into account when looking at a devel
package. This is done on all architectures, not just ppc64.
* tools/fedabipkgdiff (RPM::get_all_debuginfo_rpms): Define new
member function.
(RPM::generate_comparison_halves): The ancillary debuginfo RPM of
a given RPM now has a list type; there can be more than one
debuginfo RPM associated to a given RPM, especially if the RPM is
a devel one.
(format_debug_info_pkg_options): Define new function.
(abipkgdiff): Use the new function above.
Dodji Seketeli [Mon, 11 Dec 2017 13:30:04 +0000 (14:30 +0100)]
Update & cleanup the tools manuals summary
* doc/manuals/abidw.rst: Use the same header structure as or the
other tools manual.
* doc/manuals/kmidiff.rst: Likewise.
* doc/manuals/libabigail-tools.rst: Add the new kmidiff tool to
the summary.
Dodji Seketeli [Fri, 1 Dec 2017 13:52:23 +0000 (14:52 +0100)]
Bug 22488 - Make abipkgdiff handle different binaries with same basename
Some packages might have different binaries with the same soname and
basename, but at different paths. In that case, abipkgdiff messes
things up because it only either consider the soname or the basename
of the binary.
This patch makes abipkgdiff to always consider the full path of the
binary inside the package.
* include/abg-tools-utils.h (string_suffix)
(sorted_strings_common_prefix): Declare new functions.
(dir_name): Take a new keep_separator_at_end parameter at the end.
* src/abg-tools-utils.cc (dir_name): Take a new
keep_separator_at_end parameter at the end. Add a comment for it
and update.
(string_suffix, sorted_strings_common_prefix): Define new
functions.
(common_prefix): Define new static function.
* tools/abipkgdiff.cc (get_interesting_files_under_dir): Forward
declare this pre-existing static function.
(package::{common_paths_prefix_, elf_file_paths_}): New data
members.
(package::{common_paths_prefix, elf_file_paths,
convert_path_to_relative, convert_path_to_unique_suffix,
load_elf_file_paths}): New member functions.
(create_maps_of_package_content): Use the new
package::{load_elf_file_paths, convert_path_to_unique_suffix}
functions.
(compare_prepared_userspace_packages): Show relative paths of
package elements in reported.
* tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64--dbus-glib-0.104-3.fc23.armv7hl-report-0.txt:
Update test ouptut.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt:
Likewise.
Dodji Seketeli [Fri, 1 Dec 2017 13:49:11 +0000 (14:49 +0100)]
Fully report diagnostic about alternate debug info file not found
While looking at something else, it occured to me that we forget to
emit textual diagnostic for when a required alternate debug info file
was not found. The facility in question is mainly used by the
abipkgdiff tool for now.
* src/abg-dwarf-reader.cc (status_to_diagnostic_string): Report
textual diagnostic for the STATUS_ALT_DEBUG_INFO_NOT_FOUND case
too.
Dodji Seketeli [Mon, 27 Nov 2017 14:45:47 +0000 (15:45 +0100)]
Bug 22436 - make abipkgdiff accept several debuginfo packages
Sometimes, the debug information for one given package P can have been
split into several packages. In that case, we need abipkgdiff to
consider several debug info packages for a given input binary package.
This patch makes abipkgdiff to accept several --d{1,2} <debug-info-package>
option, for a given input package.
* doc/manuals/abipkgdiff.rst: Document the fact that --d{1,2} can
be provided several times on the command line.
* tools/abipkgdiff.cc (options::debug_packages{1,2}): Rename the
debug_package{1,2} data members into this, and make them be vector
of strings, rather than just strings.
(package::debug_info_packages_): Renamed
package::debug_info_package_ into this and make it be a vector of
package_sptr, rather than just a package_sptr.
(package::debug_info_packages): Renamed the method
package::debug_info_package into this and -- for the getter
overload -- make it return a vector of package_sptr, rather than
just a package_sptr. Likewise for the setter overload. Add a
non-const getter overload.
(package::erase_extraction_directories)
(extract_package_and_map_its_content): Adjust.
(extract_rpm, extract_deb): Do not erase the content of the
extraction directory (if it was pre-existing) prior to extracting
the RPM/deb into it.
(pkg_extraction::pkgs): Renamed pkg_extraction::pkg into this and
make it be a vector of packages, rather than just a package.
(pkg_extraction::pkg_extraction): Adjust to take a package_sptr
rather than just a package. Add an overload to take a vector of
packages_sptr.
(pkg_extraction::perform): Extract the vector of package that the
task is not responsible for, not just one random package.
(extract_package_and_map_its_content): Adjust.
(prepare_packages): Take smart pointers to package rather than
just packages. Adjust accordingly.
(compare_prepared_package): Make the overload that takes two
packages to take two smart pointers of packages.
(compare): Make the overload that takes two package take two
package_sptr.
(parse_command_line): Parse having --d{1,2} several times for a
given input package.
(main): Take several debug info packages for one input file.
* include/abg-tools-utils.h (split_string): Declare ...
* src/abg-tools-utils.cc (split_string): ... new function.
* tests/data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm:
Add a new RPM test input file.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt:
new reference output file.
* tests/data/Makefile.am: Add the new test input files above to source
distribution.
* tests/test-diff-pkg.cc (in_out_spec): Add new test entry to
specify two debug info packages for one input package.
(test_task::perform): Support having several debug info package
paths in the IntOutSpec::{first,second}_in_debug_package_path data
member. The debug info packages paths are separated by either a
white space or commas.
Dodji Seketeli [Wed, 22 Nov 2017 16:27:02 +0000 (17:27 +0100)]
Bug 22076 - Disable fedabipkgdiff for old koji clients
On some platforms, the koji client is so old that the koji object
doesn't have the .read_config method that we need.
Unfortunately, the koji client library module doesn't come with a
__version__ variable that carries its version number. So we cannot
use the version of the library. This patch thus tries to invoke the
koji.read_config method and see if it works. If it does, the koji
client is deemed recent enough. Otherwise the fedabipkgdiff feature
is disabled.
* configure.ac: Try to invoke the koji.read_config method. If it
fails then disable the fedabipkgdiff feature.
Dodji Seketeli [Tue, 21 Nov 2017 10:09:00 +0000 (11:09 +0100)]
Bug 22438 - Emit a clear message when debug info is not found
The alternate debug info file referred to a binary can be missing,
even though the rest of the debug info is not. In that case,
libabigail starts loading the debug info and then it crashes when
trying to get DIEs that are part of the missing alternate debug info.
This patch detects when the alternate debug info is missing, so that
abidiff and abipkgdiff can gracefully bail out, yielding a meaningful
error message.
* include/abg-dwarf-reader.h (enum abigail::dwarf_reader::status):
Add a new STATUS_ALT_DEBUG_INFO_NOT_FOUND enumerator there.
(refers_to_alt_debug_info): Declare new function.
* src/abg-dwarf-reader.cc (read_corpus_from_elf): Detect when the
referred-to alternate debug info file is not found and flip the
STATUS_ALT_DEBUG_INFO_NOT_FOUND bit of the status accordingly. If
the debug info was found but not the alternate debug info, then do
not try to read the debug info at all.
(refers_to_alt_debug_info): Define new function.
* tools/abidiff.cc (handle_error): Define new static function.
(main): Use it, rather than handling errors preventing libabigail
from reading the corpus on a case by case basis.
tools/abipkgdiff.cc (compare): Handle the case where no alternate
debug info was found.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt:
New test output reference.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm:
New test input RPM.
* tests/data/test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm:
Likewise.
* tests/data/Makefile.am: Add the new test files above to source
distribution.
* tests/test-diff-pkg.cc (in_out_specs): Add a new test case from
the new input files above.
Dodji Seketeli [Mon, 13 Nov 2017 11:52:07 +0000 (12:52 +0100)]
Support systems where fts.h can't be used with _FILE_OFFSET_BITS set
On some 32 systems (older glibc) the fts.h file cannot be included
"as-is" if the _FILE_OFFSET_BITS macro is set to 64.
This patch handles that case gently by including fts.h with
_FILE_OFFSET_BITS unset, but then by making sure fts.h can still
handle 64 bits file offset files.
* configure.ac: Detect if we are on a system where fts.h cannot be
included with _FILE_OFFSET_BITS defined. If that is the case,
then define the BAD_FTS macro.
* src/abg-tools-utils.cc: If BAD_FTS is defined then include fts.h
with _FILE_OFFSET_BITS not defined (that is, before config.h) but
then make sure that open and fopen are 64 bits aware.
* tools/abipkgdiff.cc: Likewise.
Dodji Seketeli [Wed, 8 Nov 2017 14:23:10 +0000 (15:23 +0100)]
Don't make system headers depend on config.h
While building on an 32 bit intel platform, compilation of
abipkgdiff.cc failed because fts.h wouldn't compile with
the macro _FILE_OFFSET_BITS set to 64. That macro is set by config.h!
The idea of this patch is to make config.h have an effect only on
libabigail's own header files, not on system header files.
* tools/abipkgdiff.cc: Include config.h after system headers and
before libabigail's headers.
Dodji Seketeli [Thu, 2 Nov 2017 11:46:32 +0000 (12:46 +0100)]
Wire the --no-show-locs option to abidw
Up until now, the --no-show-locs option only had effect when abidiff
was used with the --abidiff option. It had no effect on the ABIXML
output of abidw.
This patch changes that to make it so that --no-show-locs avoids
emitting source location to the ABIXML output.
* doc/manuals/abidw.rst: Update the documentation.
* tests/test-annotate.cc: Now that --no-show-locs has an effect on
the ABIXML output, let's not use it here, because it changes the
output and we don't want that.
* tools/abidw.cc (display_usage): Fix a typo in the help string.
(load_corpus_and_write_abixml): Set the "show-locs" option to the
write_context object that we use.
Dodji Seketeli [Thu, 2 Nov 2017 08:52:58 +0000 (09:52 +0100)]
Allow setting options to instances of xml_writer::write_context
Up to know, it wasn't possible to set options to instances of
xml_writer::write_context. So it wasn't possible to, say, make abidw
stop emitting source locations in the abixml.
This patch does the work necessary to set two options: annotate and
show locations. Note that the patch doesn't yet enable abidw to stop
emitting source locations. That will be done in a subsequent patch.
* include/abg-writer.h (create_write_context, set_show_locs)
(set_annotate): Declare new functions.
(write_corpus, write_corpus_group): Remove the output stream and
the annotate parameters as these can be retrieved from the
context.
* src/abg-writer.cc (write_context::m_show_locs): New data member.
(write_context::write_context): Initialize it.
(write_context::{get_show_locs, set_show_locs}): Add new member
functions.
(write_location): Take a write_context, rather than an output
stream. From the context, we detect if the user did set the "show
loc" option and act accordingly. Write the second overload in
terms of the first one.
(create_write_context, set_show_locs, set_annotate): Define new
functions.
(write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_array_type_def, write_enum_type_decl, write_typedef_decl)
(write_var_decl, write_function_decl)
(write_class_decl_opening_tag, write_union_decl_opening_tag)
(write_type_tparameter, write_non_type_tparameter)
(write_function_tdecl, write_class_tdecl): Adjust the invocation
of write_location.
(write_corpus, write_corpus_group): Remove the output stream and
the annotate parameters as these can be retrieved from the
context. Adjust.
* tools/abidw.c: (load_corpus_and_write_abixml): Create a
write_context object, set the 'annotate' option to it and use that
object to actually write out the corpus.
Dodji Seketeli [Mon, 16 Oct 2017 12:07:55 +0000 (14:07 +0200)]
Add a --suppressions option to fedabipkgdiff
This patch adds a --suppressions option to fedabipkgdiff so that a
suppression specification can be applied to the comparisons performed.
* tools/fedabipkgdiff (abipkgdiff): If a suppression file was
provided, pass it to the underlying abipkgdiff tool.
(build_commandline_args_parser): Parse the new --suppressions
option.
* docs/manuals/fedabipkgdiff.rst: Add documentation for the new
--suppressions option.
Dodji Seketeli [Wed, 11 Oct 2017 13:13:46 +0000 (15:13 +0200)]
Cleanup a switch-case logic to avoid a GCC 7.2.1 warning
* src/abg-dwarf-reader.cc (die_qualified_type_name): Cleanup a
switch case to make the form support more what we meant, and shut
down a GCC 7.2.1 warning.
Mark Wielaard [Mon, 9 Oct 2017 07:30:37 +0000 (09:30 +0200)]
Fix -Wmisleading-indentation warning in abg-leaf-reporter.cc.
abg-leaf-reporter.cc: In member function ‘virtual void abigail::comparison::leaf_reporter::report(const abigail::comparison::qualified_type_diff&, std::ostream&, const string&) const’:
abg-leaf-reporter.cc:158:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (!diff_to_be_reported(&d))
^~
abg-leaf-reporter.cc:161:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
report_local_qualified_type_changes(d, out, indent);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dodji Seketeli [Fri, 6 Oct 2017 09:25:48 +0000 (11:25 +0200)]
Add --impacted-changes option to kmidiff
kmidiff displays leaf changes by default and and it does so by *not*
showing impacted interfaces.
This patch add a --impacted-changes option to kmidiff so that it shows
the interfaces that are impacted by each leaf change. Thus, by
default, no impacted interface is shown.
* doc/manuals/kmidiff.rst: Document the new --impacted-changes
option.
* tools/kmidif.cc (options::show_impacted_interfaces): Add new
data member.
(options::options): Initialize the new data member to false.
(display_usage): Add a description string for the new
--impacted-changes option.
(parse_command_line): Parse the new --impacted-changes option.
(set_diff_context): Update the 'show-impacted-interface' property
accordingly.
Dodji Seketeli [Wed, 4 Oct 2017 08:33:53 +0000 (10:33 +0200)]
Add --full-impact option to kmidiff
This patch changes the default report emitted by kmidiff. Now, it
emits a leaf changes report by default. And if the user wants the
classical kind of report then she can use the --full-impact option.
* doc/manuals/kmidiff.rst: Add documentation for the new
--full-impact|-f option.
* tools/kmidiff.cc (options::leaf_changes_only): Add new data
member.
(option::option): Initialize the new data member.
(display_usage): Add a documentation string for the new
--full-impact|-f option.
(parse_command_line): Parse the new --full-impact|-f option.
(set_diff_context): Set the diff context appropriately.
This patch adds the --leaf-changes-only option to abipkgdiff, just
like what we have for abidiff. The patch also emit leaf changes
report by default when comparing two Linux Kernel packages.
The patch also adds the --impacted-interfaces and --full-impact
options.
* doc/manuals/abipkgdiff.rst: Add documentation for the new
--leaf-change-only, --impacted-interfaces and --full-impact
options.
* tools/abipkgdiff.cc (options::{leaf_changes_only,
show_impacted_interfaces, show_full_impact_report): Add new data
members.
(options::options): Initialize them.
(display_usage): Add help strings for the new --leaf-change-only,
--impacted-interfaces and --full-impact|-f options.
(set_diff_context_from_opts): Set the diff context for the
'leaf-changes-only' and 'show-impacted-interfaces' flags.
(parse_command_line): Parse the --leaf-change-only,
--impacted-interfaces and --full-impact options. Handle the case
where the --linux-kernel-abi-whitelist|-w option is given a
whitelist *package*.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
New test output reference.
* tests/test-diff-pkg.cc (in_out_spec): Compare
data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64.rpm and
data/test-diff-pkg/spice-server-0.12.8-1.el7.x86_64.rpm with the
new --leaf-changes-only and --impacted-interfaces options, using
the new output reference above.
* tests/data/Makefile.am: Add the new test material to source
distribution.
Dodji Seketeli [Wed, 2 Aug 2017 16:00:23 +0000 (18:00 +0200)]
Initial implementation of a --leaf-changes-only option to abidiff
This patch allows abidiff to take the --leaf-changes-only option and
then to display only the changes that are local to any given type.
That means the reporting agent won't follow pointers when displaying
changes. That gives less context to the ABI change reports but then
they are less cluttered.
To do this, the patch introduces a new reporting agent to libabigail:
abigail::comparison::leaf_reporter. When given a graph of diff nodes,
this agent only reports about the leaf (local) changes. That is, it
will *NOT* follow pointers, references, underlying types of qualified
and typedef types and things like that. It will just report about
changes that are local to a given type.
This reporting agent is then used (in lieu of the default
abigail::comparison::default_reporter agent) when the
--leaf-changes-only option is provided by the user on the command line
of abidiff.
Note that abidiff also takes the --impacted-interfaces option to so
that the leaf reporter shows the set of interfaces impacted
by each leaf change.
* doc/manuals/abidiff.rst: Add documentation the new
--leaf-changes-only and --impacted-interfaces options.
* src/abg-leaf-reporter.cc: New file.
* src/Makefile.am: Add the new src/abg-leaf-reporter.cc file to
source distribution.
* include/abg-fwd.h (get_var_size_in_bits)
(function_decl_is_less_than): Declare new functions.
(get_name): Add new overload for type_or_decl_base*.
* include/abg-ir.h (struct type_or_decl_hash, type_or_decl_equal)
(type_or_decl_base_comp): Define new types.
(artifact_sptr_set_type, artifact_ptr_set_type): Define new
typedefs.
* include/abg-comp-filter.h: Update copyright year.
(has_basic_type_name_change): Add new function declaration.
* src/abg-comp-filter.cc (decl_name_changed): Take a
type_or_decl_base rather than just a decl. Add an overload for
diff*.
(has_basic_type_name_change): Define new function.
* include/abg-comparison.h: Update copyright year.
(string_diff_ptr_map): Define this new typedef.
(class diff_maps): Define this new class.
(diff_context::{set_corpora}): Remove this member function.
(diff_context::{set_corpus_diff, get_corpus_diff,
show_leaf_changes_only, show_impacted_interfaces,
forbid_visiting_a_node_twice_per_interface}): Declare these new
member functions.
(diff_node_visitor::priv_): Add a new pimpl data member.
(diff_node_visitor::{diff_node_visitor, get_visiting_kind,
set_visiting_kind}): Turn these into out-of-line member functions.
(diff_node_visitor::{set,get}_current_topmost_iface_diff): Add new
member functions.
(class {scope_diff, function_type_diff, corpus_diff}): Add class
leaf_reporter as a friend.
(corpus_diff::mark_leaf_diff_nodes, get_leaf_diffs): Declare new
member functions.
(diff::{visiting_a_node_twice_is_forbidden_per_interface,
parent_interface_node}): Define new member functions.
(is_diff_of_basic_type): Return a type_decl_diff* rather than just
a bool.
(is_enum_diff, is_array_diff, is_function_type, is_typedef_diff)
(is_corpus_diff): Declare new functions.
(corpus_diff::diff_stats::{num_leaf_changes,
num_leaf_changes_filtered_out, net_num_leaf_changes}): Add new
member functions.
(is_distinct_diff): Declare new function.
* include/abg-reporter.h: Forward-declare "class diff_maps".
(reporter_base::diff_to_be_reported): Declare a new virtual member
function.
(reporter_base::{report_local_typedef_changes,
report_local_reference_type_changes,
report_local_function_type_changes}): Declare new member
functions.
(class leaf_reporter): Define new type.
* src/abg-comparison-priv.h (struct diff_hash, diff_equal): Define
new types.
(diff_artifact_set_map_type): Define new typedef.
(diff_context::priv::{first_corpus_, second_corpus_}): Remove
these data members.
(diff_context::priv::{corpus_diff_, leaf_changes_only_,
reset_visited_diffs_for_each_interface_,
show_impacted_interfaces_}): Add new data members.
(diff_context::priv::priv): Adjust.
(corpus_diff::priv::{leaf_diffs_, parent_interface_}): Add new
data member.
(corpus_diff::diff_stats::priv::{num_leaf_changes,
num_leaf_changes_filtered_out}): Add new data members.
(corpus_diff::priv::count_leaf_changes): Define new member
function.
(sort_artifacts_set, get_fn_decl_or_var_decl_diff_ancestor)
(is_diff_of_global_decls): Declare new functions.
(function_comp::operator()): Factorize this out into the new
function abigail::ir::function_decl_is_less_than.
* src/abg-ir.cc (get_var_size_in_bits)
(function_decl_is_less_than): Define new functions.
(get_name): Define new overload for type_or_decl_base*.
* src/abg-comparison.cc (is_enum_diff, is_typedef_diff)
(is_array_diff, is_function_type_diff, is_corpus_diff)
(is_distinct_diff, sort_artifacts_set, is_diff_of_global_decls):
Define new functions.
(is_union_diff): Fix comment.
(diff_context::forbid_visiting_a_node_twice_per_interface): Define
new member functions.
(diff_context::set_corpus_diff, get_corpus_diff)
(diff_context::show_leaf_changes_only)
(diff_context::visiting_a_node_twice_is_forbidden_per_interface)
(diff_context::show_impacted_interfaces): Define new member
functions.
(diff_context::get_reporter): Create the reporter that matches
what diff_context::show_leaf_changes_only says.
(diff_node_visitor::priv): Define a new type.
(diff_node_visitor::{diff_node_visitor, get_visiting_kind,
set_visiting_kind, or_visiting_kind,
set_current_topmost_iface_diff, get_current_topmost_iface_diff}):
Define new out-of-line member functions.
(struct diff_maps::priv): Define new type.
(diff_maps::{diff_maps, get_type_decl_diff_map,
get_type_decl_diff_map, get_enum_diff_map, get_class_diff_map,
get_union_diff_map, get_typedef_diff_map, get_array_diff_map,
get_function_type_diff_map, get_function_decl_diff_map,
get_var_decl_diff_map, get_reference_diff_map,
get_fn_parm_diff_map, get_distinct_diff_map, insert_diff_node,
lookup_impacted_interfaces}): Define member functions.
(corpus_diff::{mark_leaf_diff_nodes, get_leaf_diffs}): Define new
member functions.
(struct leaf_diff_node_marker_visitor): Define new type.
(corpus_diff::apply_filters_and_suppressions_before_reporting):
Mark diff nodes in here.
(corpus_diff::traverse): Appropriately set the current topmost
interface into the visitor before visiting a diff node.
(compute_diff): In the overload for corpus_sptr, adjust to reflect
that we are now storing the corpus_diff in the diff context.
(is_diff_of_basic_type): Return a type_decl_diff*, not just a
bool.
(corpus_diff::priv::count_leaf_changes): Define a new member
function.
(corpus_diff::diff_stats::{num_leaf_changes,
num_leaf_changes_filtered_out, net_num_leaf_changes}): Define new
member functions.
(corpus_diff::priv::apply_filters_and_compute_diff_stats): Use the
new corpus_diff::priv::count_leaf_changes to compute the number of
leaf changes.
(corpus_diff::priv::emit_diff_stats): Emit the report about leaf
type changes when necessary.
* src/abg-reporter-priv.h (report_mem_header): Declare new
overload.
(maybe_show_relative_offset_change,): Pass the var_diff_sptr
parameter by const reference.
(represent): Pass the var_diff_sptr parameter by const reference
and take a new "local-only" flag.
(maybe_show_relative_size_change)
(maybe_report_interfaces_impacted_by_diff): Declare new functions.
* src/abg-default-reporter.cc: Adjust copyright year.
(default_reporter::{report_local_typedef_changes,
report_local_qualified_type_changes,
report_local_reference_type_changes,
report_local_function_type_changes}): Define new member functions.
(default_reporter::report): Adjust. Add an overload for
function_type_diff&. In the overload for qualified_type_diff, if
the name of the underlying type changed, do not detail the changes
any further. In the overload for function_decl_diff, Adjust to
use the new diff_context::get_{first, second}_corpus member
function. In the overload for enum_diff, call the new
maybe_report_interfaces_impacted_by_diff that is advertised below.
* src/abg-reporter-priv.cc (represent): Adjust the overload for
var_diff_sptr.
(report_mem_header): Define new overload.
(maybe_show_relative_size_change)
(maybe_report_interfaces_impacted_by_diff): Define new functions.
(reporter_base::diff_to_be_reported): Define new member function.
(maybe_show_relative_offset_change): Pass the var_diff_sptr
parameter by const reference.
(represent): In the overload for var_diff_sptr, pass the
var_diff_sptr parameter by reference. Take a 'local_only' flag.
Iisplay type changes only if we are not displaying "local changes
only". Display size changes of data members too, when in
"local-only" mode.
* src/abg-suppression.cc (sonames_of_binaries_match)
(names_of_binaries_match): Adjust.
* tools/abidiff.cc (options::{leaf_changes_only,
show_impacted_interfaces}): Add new data members.
(display_usage): Emit usage string for the new --leaf-changes-only
and --impacted-interfaces options.
(parse_command_line): Parse the new --leaf-changes-only and the
--impacted-interfaces options.
(set_diff_context_from_opts): Set the 'show-leaf-changes' and the
'show-impacted-interfaces' flags.
* tests/data/test-diff-filter/libtest42-leaf-report-v{0,1}.so: New
test input.
* tests/data/test-diff-filter/test42-leaf-report-output-0.txt: New
test reference output.
* tests/data/test-diff-filter/test42-leaf-report-v{0,1}.cc: Source
code of the new test inputs.
* tests/test-diff-filter.cc (in_out_specs): Use the new test
inputs above in this harness.
* tests/data/test-diff-suppr/libtest35-leaf-v0.so: New test input.
* tests/data/test-diff-suppr/test35-leaf-report-0.txt: New test
reference output.
* tests/data/test-diff-suppr/test35-leaf-v{0,1}.cc: Source code of
the new test inputs.
* tests/data/test-diff-suppr/test35-leaf.suppr: Suppression
specification to use for the test35 test.
* tests/data/test-diff-suppr/libtest36-leaf-v0.so: New test input.
* tests/data/test-diff-suppr/libtest36-leaf-v1.so: Likewise.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: New
reference test output.
* tests/data/test-diff-suppr/test36-leaf-v0.cc: Source code of
test input above.
* tests/data/test-diff-suppr/test36-leaf-v1.cc: Likewise.
* tests/test-diff-suppr.cc (in_out_specs): Use the new test inputs
above in this harness.
* tests/data/Makefile.am: Add the new test inputs above to source
distribution.
Right now, the reporting functionnality is implemented directly in the
comparison engine. Being able to emit several kinds of reports is
really not practical with the current design.
This patch improves that situation by introducing an indirection
between the comparison engine and the code that emits the report.
A new abigail::comparison::reporter_base type is introduced. That
type several contains virtual methods that knows how to implement
reporting. Each virtual method reports about changes carried by a
kind of diff node. In other words, abigail::comparison::reporter_base
is the interface of reporter objects.
The current reporting using the current format is thus implemented by
the new abigail::comparison::default_reporter type, which implements
the abigail::comparison::reporter_base interface.
The diff::report methods now "just" get the reporter object from the
context of the diff and invoke its right reporting interface.
So whenever someone needs to implement a new reporting format, she
needs to provide a new implementation of the
abigail::comparison::reporter_base interface and set it to the
diff_context prior to invoking the
abigail::comparison::corpus_diff::report() method.
* include/Makefile.am: Add the new abg-reporter.h header file to
source distribution.
* include/abg-comparison.h: Include the new abg-reporter.h header
file.
(diff_context::{g,s}et_reporter): Declare new accessors.
({type_diff_base, decl_diff_base, corpus_diff}::priv): Make this
be a struct rather than a class.
({decl_diff_base, class_diff, scope_diff, function_type_diff,
corpus_diff}): Declare default_reporter a friend class of these.
* include/abg-reporter.h: New file.
* src/Makefile.am: Add abg-comparison-priv.h,
abg-reporter-priv.{h,cc} and abg-default-reporter.cc files to
source distribution.
* src/abg-comparison-priv.h: New file.
* src/abg-comparison.cc (sort_enumerators)
(sort_changed_enumerators, sort_data_members)
(sort_string_function_ptr_map)
(sort_string_function_decl_diff_sptr_map)
(sort_string_var_diff_sptr_map, sort_string_elf_symbol_map)
(sort_string_var_ptr_map, sort_string_data_member_diff_sptr_map)
(sort_unsigned_data_member_diff_sptr_map)
(sort_string_diff_sptr_map, sort_string_base_diff_sptr_map)
(sort_string_base_sptr_map, sort_string_fn_parm_diff_sptr_map)
(sort_string_parm_map, get_leaf_type, sort_enumerators)
(sort_changed_enumerators): Make these functions non-static and
move them at the beginning of the file. These functions are now
declared in abg-compared-priv.h so they can be shared privately
with other files in src/.
(diff_context::{g,s}et_reporter): Define new accessors.
({diff_context, diff, type_diff_base, decl_diff_base,
distinct_diff, pointer_diff, array_diff, reference_diff,
qualified_type_diff, enum_diff, class_or_union_diff, class_diff,
base_diff, scope_diff, fn_parm_diff, function_type_diff,
function_decl_diff, type_decl_diff, typedef_diff,
translation_unit_diff, corpus_diff::diff_stats,
corpus_diff}::priv)
(diff_less_than_functor, enumerator_value_comp)
(changed_enumerator_comp, base_spec_comp, base_diff_comp)
(data_member_diff_comp, diff_comp, fn_parm_diff_comp, parm_comp)
(elf_symbol_comp, function_comp, function_decl_diff_comp)
(var_diff_sptr_comp): Move these type definitions to
abg-comparison-priv.h
(report_size_and_alignment_changes, report_loc_info)
(maybe_report_diff_for_member, maybe_report_diff_for_symbol)
(represent, represent_data_member)
(maybe_show_relative_offset_change, represent)
(report_size_and_alignment_changes, report_loc_info)
(report_name_size_and_alignment_changes, report_mem_header)
(maybe_report_diff_for_member, maybe_report_diff_for_symbol)
(show_linkage_name_and_aliases): Move these definitions to
abg-reporter-priv.cc.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff,
class_or_union_diff, class_diff, base_diff, union_diff,
scope_diff, fn_parm_diff, function_type_diff, type_decl_diff,
typedef_diff, corpus_diff}::report): Use the reporter object to
report about the changes carried by the the current diff node.
* src/abg-default-reporter.cc: New file.
* src/abg-reporter-priv.h: Likewise.
Dodji Seketeli [Wed, 4 Oct 2017 12:18:55 +0000 (14:18 +0200)]
[abixml writer] Use an unordered set when appropriate
* src/abg-writer.cc (write_context::m_emitted_decl_only_set):
Renamed m_emitted_decl_only_map into this and make the type be a
set, rather than a map.
(write_context::{record_decl_only_type_as_emitted,
decl_only_type_is_emitted}): Adjust.
[abixml writer] Store pointers to emitted types rather than type-ids
To record the emitted types, the abixml writer records the emitted
type *ID*s. So to lookup an emitted type, it needs to lookup the ID
of the type first, and then lookup that type-id in the set of emitted
type IDs. We are doing twice as much work as we should and profiling
the writting of a big abixml showed that it's quite taxing.
This patch makes the write records the set of emitted types directly.
No need to go through the emitted type *ID*s anymore. So we save one
map lookup. This incurs a 16% speedup when writting an abixml file
for a big (3GB) vmlinux file.
* src/abg-writer.cc (type_ptr_set_type): Declare new typedef.
(writer_context::m_emitted_type_id_map): Remove this data member.
(writer_context::m_emitted_type_set): Add a new data member.
(writer_context::{record_type_id_as_emitted, type_id_is_emitted,
clear_emitted_types_map}): Remove these member functions.
(writer_context::{record_type_as_emitted, type_is_emitted}): Use
the new m_emitted_type_set data member above.
Until now, the canonical DIE offsets map (the map that associates a
canonical DIE offset to a given DIE offset) was implemented in the
DWARF reader by using vectors. This proves to use a lot of memory
(more than 25GB!!) for huge vmlinux binaries. So much that the thing
was too slow (hey, yeah, because it was swapping out!) on vmlinux
kernel binary of 3GB of size, just to abidw it out.
This patch changes that to use an unordered map for this. It now uses
~ 4GB of peak RAM memory, so I can actually abidw the vmlinux of 3GB
of size on my laptop. It's still taking 16 minutes (!!) to complete,
but at least it's progress, as it's completed at least, without
swapping out.
And it doesn't see to noticeably slowdown the test suite.
* src/abg-dwarf-reader.cc
(read_context::canonical_type_die_offsets_): Renamed the
canonical_type_die_vecs_ data member into this.
(read_context::canonical_decl_die_offsets_): Renamed the
canonical_decl_die_vecs_ data member into this.
(read_context::{initialize, compute_canonical_die_offset,
compute_canonical_die, get_canonical_die,
get_or_compute_canonical_die, set_canonical_die_offset,
get_canonical_die_offset}): Adjust.
Bug 22190 - crash in read_context::get_or_compute_canonical_die
When computing a canonical DIE while reading DWARF, we crash in
get_or_compute_canonical_die basically because we loop over a vector
using an iterator which gets invalidated during the walk because some
code in the loop can increase the size of the vector (by adding
elements at its end) during the loop.
This patch fixes the issue by looping over the vector without using an
iterator that can be invalidated. The code now properly expects the
vector to grow during the walk.
Renamed offset_offset_map type name into offset_offset_map_type
While looking into something else, I realized that for consistency,
the name of the offset_offset_map type should be
offset_offset_map_type. So I just did the change.
* src/abg-dwarf-reader.cc (offset_offset_map_type): Renamed
offset_offset_map into this.
(read_context::{primary_die_parent_map_,
alternate_die_parent_map_, type_section_die_parent_map_}): Adjust
the type of these data members.
(read_context::{die_parent_map, type_section_die_parent_map}):
Adjust the type of these member functions.
(read_context::{build_die_parent_relations_under,
get_parent_die}): Adjust for the type name in these functions.
Don't crash on classes that differ in their virtual member fn count
When comparing classes that differ in their number of virtual member
functions, it can happen that we crash because we should have got out
earlier.
This patch fixes that. That problem happens on the test provided in
PR libabigail/17948 -- which is too big to be included in the test
suite.
* src/abg-ir.cc (equals): In the overload for class_decl, when we
detect that the virtual member function counts are different, get
out, even when we are being asked about the kind of the change.
Avoid adding the same data member twice in the DWARF reader
When we face two equivalent highly recursive structs/classes, it can
happen that a given data member be added twice to the type. When
comparing two versions of a binary in which the data member happens to
have been removed from the second version, we thus trigger an assert
because a given data member has been "removed twice".
This happens on the example provided in PR libabigail/17948 -- which
is too big to be added to the test suite.
This patch hopefully fixes the issue by looking harder at the data
structure to make sure that we don't add the same data member twice.
* src/abg-dwarf-reader.cc (add_or_update_class_type): After a we
try to create a data member type, look *again* if the data member
wasn't added recursively by the creation of the data member type.
Mark Wielaard [Mon, 11 Sep 2017 20:50:22 +0000 (22:50 +0200)]
Bug 22075 - data_member_diff_comp forgets data members names
This patch makes the data_member_diff_comp comparison functor consider
all the properties local to the data member: that is, its offset and
its name.
It used to only take the offset into account.
This makes sure that offset change reports have a stable ordering and
thus makes the runtestdiffpkg testcase succeeds on debian-i386.
* src/abg-comparison.cc (data_member_diff_comp): Make the
comparison take the qualified name of the data member into
account. Also, if the initial offset and qualified names of the
data members of the diff nodes are equal, consider the offset and
qualified names of the new data members.
Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When computing canonical DIEs, the DWARF reader mistakenly represents
'array of const' and 'const array' the same.
This patch fixes that.
* src/abg-dwarf-reader.cc (die_is_array_type): Define new static
function.
(die_is_pointer_or_reference_type): Also test that the DIE can be
an array.
* tests/data/test-read-dwarf/PR22122-libftdc.so: New binary test input.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: New reference output.
* tests/data/Makefile.am: Add the two new test files above to
source distribution.
* tests/test-read-dwarf.cc (in_out_specs): Run this test harness
over the new test input.
Mark Wielaard [Sat, 2 Sep 2017 13:03:36 +0000 (15:03 +0200)]
readdir_r() is deprecated, use readdir().
Since glibc 2.24 readdir_r() is deprecated.
Applications are recommended to use readdir which is thread-safe when
using different directory streams (we explicitly create a new one here).
* src/abg-tools-utils.cc (dir_is_empty): Use readdir() instead
of readdir_r().
Mark Wielaard [Sat, 2 Sep 2017 13:04:57 +0000 (15:04 +0200)]
Declare eval_last_constant_dwarf_sub_expr with [u]int64_t not [s]size_t.
On 32bit platforms [s]size_t isn't the same as [u]int64_t causing:
abg-dwarf-reader.cc:358:1: warning: ‘bool abigail::dwarf_reader::eval_last_constant_dwarf_sub_expr(Dwarf_Op*, size_t, ssize_t&, bool&)’ declared ‘static’ but never defined [-Wunused-function]
* src/abg-dwarf-reader.cc (eval_last_constant_dwarf_sub_expr):
Declare expr_len as uint64_t and value as int64_t.
Dodji Seketeli [Mon, 28 Aug 2017 09:37:56 +0000 (11:37 +0200)]
Bug 22015 - Failing to return global scope of a DIE in certain cases
During DWARF reading, it can happen that we want to get the global
scope of a DIE which translation unit hasn't yet been constructed.
In that case, use the global scope of the current translation unit.
* src/abg-dwarf-reader.cc (get_scope_for_die): If the translation
unit of the parent die hasn't yet been constructed, then return
the global scope of the current translation unit.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so: New
binary test input.
* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
New reference test output.
* tests/data/Makefile.am: Add the new test materials above to
source distribution.
* tests/test-read-dwarf.cc (in_out_specs): Add the new test input
to the test suite.
Apparently we forgot to add some test input files to the source
distribution.
Fixed thus.
* tests/data/Makefile.am: Add
test-diff-dwarf/test42-PR21296-libgcc.so,
test-diff-dwarf/test42-PR21296-libclang.so,
test-diff-dwarf/test42-PR21296-clanggcc-report0.txt to the source
distribution. Also look for test-diff-filter/test39* tests inputs
in the test-diff-filter/test39/ directory.
Avoid crashing when the elf file could not be read
When for a reason the ELF file could not be read and yet the user
keeps going with the elf reader context, it can happen that we crash.
This patch fixes that.
* src/abg-dwarf-reader.cc
(read_context::elf_architecture_is_ppc64): Do not crash if the elf
handle is nil.
Bug 21730 - Make abipkgdiff compare Linux Kernel packages as expected
This is the initial patch that makes abipkgdiff recognize Linux kernel
packages passed in argument and do the right thing.
abipkgdiff gets the vmlinux binary from the debug info package,
considers the union of that vmlinux binary and the thousands of kernel
modules that we shall name "the Kernel". It then compares ABI
(actually Kernel/Module Interface, a.k.a KMI) of the Kernel of the
first package against the KMI of the Kernel of the second package.
* include/abg-tools-utils.h (get_vmlinux_path_from_kernel_dist):
Declare new function.
(get_binary_paths_from_kernel_dist): Re-organize order of
parameters.
(file_is_kernel_package, file_is_kernel_debuginfo_package): Make
the file_path parameter be const.
(build_corpus_group_from_kernel_dist_under): Take an additional
debug_info_root parameter.
* src/abg-tools-utils.cc (file_is_kernel_package)
(file_is_kernel_debuginfo_package): Const-ify the file_name
parameter.
(find_vmlinux_path): Define new static function.
(get_binary_paths_from_kernel_dist): Re-organize the order of
parameters. The debug_info_root_path parameter is now an input
parameter.
(get_vmlinux_path_from_kernel_dist): Define new function.
(get_binary_paths_from_kernel_dist): Adjust invocation of
get_binary_paths_from_kernel_dist.
(build_corpus_group_from_kernel_dist_under): Take an additional
debug_info_root parameter.
* tools/abidw.cc (load_kernel_corpus_group_and_write_abixml):
Adjust invocation to build_corpus_group_from_kernel_dist_under.
* tools/abipkgdiff.cc (create_maps_of_package_content): Don't map
the content of a Linux Kernel package.
(compare_prepared_userspace_packages)
(compare_prepared_linux_kernel_packages, compare_prepared): Define
new functions.
(compare): Use the new functions above here.
* tools/kmidiff.cc (print_kernel_dist_binary_paths_under): Adjust
the invocation of get_binary_paths_from_kernel_dist.
(main): Adjust the invocation of
build_corpus_group_from_kernel_dist_under. Make sure that a
kernel package is accompanied by a debug info package.
The user should be able to specify one white list package per kernel
package on the command line. That means the user should be able to
say:
--wp whitelist-pkg1 --wp whitelist-pkg2
on the command line.
This patch adds support for that.
* doc/manuals/abipkgdiff.rst: Update the documentation to say that
--wp can be provided twice, but not more than that.
* tools/abipkgdiff.cc (options::kabi_whitelist_packages): Rename
kabi_whitelist_package to this, and make be of vector<string>
type.
(package::erase_extraction_directories): Erase the white list
package extracted data.
(maybe_handle_kabi_whitelist_pkg, parse_command_line): Adjust.
(main): Make sure there is no more than 2 --wp on the command
line. Associate a white list package to each kernel package on
the command line.
When a class type lookup fails in a the type map of a corpus, the code
goes look the class up in the type maps of a every single translation
unit.
This design dates back from the time where there could be only one
type of a given name present in in the type map of a corpus. When
several types with the same were found, then each type would be
present in the type map of its translation unit, but then no type with
that name would be present in the type map of the corpus.
As a result, when a type was not found in the type map of the corpus,
we were looking for it in the type maps of the translation units.
Now that the type map of the corpus can carry several types with the
same name, we don't need to look in the translation unit anymore.
This patch implements that adjustment.
* src/abg-ir.cc (lookup_class_type): In the overload that looks
for a class name denoted by an interned_string in the corpus, do
not look for the class in the translation units when the type
wasn't found in the type map of the corpus.
(maybe_update_types_lookup_map): Remove the
erase_if_exists_already parameter and the code that uses it.
(lookup_class_type_through_translation_units): Remove this
function that is now useless.
Bug 21644 - abipkgdiff does not emit diagnostics about comparison errors
When abipkgdiff compares binaries of a package, it doesn't report
errors like debug info or symbol not found.
This patch fixes that.
* include/abg-dwarf-reader.h (status_to_diagnostic_string):
Declare new function.
* src/abg-dwarf-reader.cc (status_to_diagnostic_string): Define
new function.
* tools/abipkgdiff.cc (compare): Take a new detailed_error_status
parameter.
(compare_task::perform): Get the details of the error, in case the
status of the comparison is ABIDIFF_ERROR.
When a type has a noop qualifier and that noop qualifier disapears in
a subsequent version of that type, the two versions of the type have
different internal pretty representations. And that leads to the type
canonicalization code ending up with two different canonical types for
the two versions, even if they should be considered equivalent.
This patch makes a noop-qualified type have the same internal pretty
representation as its non-qualified variant.
* src/abg-ir.cc (get_name_of_qualified_type): A noop-qualified
type has an empty string as reprsentation for its qualifier.
* src/abg-dwarf-reader.cc (die_qualified_type_name): Adjust to
comply with what is done in get_name_of_qualified_type. Adjust
comment too.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Adjust.
* tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt:
New reference test output.
* tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64.rpm: New
test binary input.
* tests/data/test-diff-pkg/libcdio-0.94-2.fc26.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/libcdio-debuginfo-0.94-1.fc26.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/libcdio-debuginfo-0.94-2.fc26.x86_64.rpm Likewise.
* tests/data/Makefile.am: Add the new test inputs to source distribution.
* tests/test-diff-pkg.cc (in_out_specs): Make this test harness run on
the new test inputs above.
Fix a typo when reporting size change wrt a decl-only class
When a class is compared to its decl-only counterpart, if the user
doesn't want to see decl-only class related change, then do not report
any size change that might result from it.
This was already meant to be implemented but there was a typo. Fixed
thus.
Better handle decl-only classes being different from their definition
Sincea little while, libabigail can now handle the presence of several
different class types definition that have the same name.
To handle that, we settled that for types originating from C, a
decl-only class would be considered different from a definition of
that class. Especially during type canonicalization.
Now it seems that it's wrong to consider this only for C types. That
is because the same class type foo, defined in a C header, can be
compile either into a C++ compilation unit, or a C one, in the same
binary. That is, in the same binary, a struct type foo can be seen
defined in a C compilation unit *and* in a C++ compilation unit.
So rigth now, the C++ struct type foo would compare equal to a
decl-only struct foo, but the C struct type foo would compare
different to a decl-only struct foo. This leads to spurious change
reports, especiall in the nmap and mariadb package from Fedora 25,
when we run selfcheck.py on fc25 critpath packages.
This patch makes libabigail always consider -- during type
canonicalization -- that a decl-only class is different from a
definition of that class. Not only for C.
* src/abg-comparison.cc (function_decl_diff::report): Don't report
possible vtable changes between a decl-only class and its
definition.
* src/abg-ir.cc (type_base::get_canonical_type_for): Consider that
a decl-only class is different from its definition when comparing
types for the purpose of type canonicalization.
(equals): In the class_or_union overload, only consider the global
decl_only_class_equals_definition() property to know when to
consider that a decl-only class is different from its definition
when comparing two classes.
* src/abg-reader.cc (build_class_decl): Read the size property of
a class, even if it's a decl-only class.
* src/abg-writer.cc (write_class_decl_opening_tag): Write size
property of types even if the types are decl-only classes.
* 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-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
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/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.
Dodji Seketeli [Wed, 28 Jun 2017 13:01:50 +0000 (15:01 +0200)]
Don't add empty translation unit to corpus
In debug info, some translation units are known to be empty because
they don't carry any DIE. It's thus useless to add those translation
units to the ABI corpus.
Note that in some packages like gcc and glibc (in Fedora 25) the same
empty translation unit can be present in the debug info more than
once. This violates a Libabigail invariant that asserts that a given
translation unit (designated by its path) shall be present only once
in the debug info.
* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir):
A translation unit DIE that has no child DIE shall not be added to
the current ABI corpus.
Dodji Seketeli [Mon, 26 Jun 2017 12:06:48 +0000 (14:06 +0200)]
Bug 21630 - A this pointer DIE can be const
From what I have usually seen emitted by GCC, a "this pointer" is
represented by a DW_TAG_pointer_type. If the "this pointer" is for a
const method, then it points to a const class type DIE.
But in, in this problem report, I am seeing a "this pointer"
represented by a DW_TAG_const_type that points to a
DW_TAG_pointer_type, which is itself points to a class type DIE.
The code of die_this_pointer_is_const needs to be adjusted so that it
doesn't expect only a DW_TAG_pointer_type.
This is what this patch does.
* src/abg-dwarf-reader.cc (die_this_pointer_is_const): If the DIE
is not a DW_TAG_pointer_type then don't crash.
Dodji Seketeli [Fri, 23 Jun 2017 11:18:40 +0000 (13:18 +0200)]
Bug 21629 - equivalent DIEs must be of the same DIE source
A prerequisite to represent the relationship "DIE 'D' has canonical
DIE C", is that D and C come from the same DIE source. A DIE source
being either the main debug info file, the alternate debug info file
(both having DIEs in their .debug_info section), or a .debug_type
section.
This prerequisite is a result of the design of the current
libabigail's DWARF reader.
Unfortunately the code that compares DIEs and that updates the
canonical DIEs of the compared DIEs (in case the two DIEs are
equivalent) sometimes fails to honour that prerequisite, causing other
troubles down the road.
This patch fixes that by ensuring that equivalent DIEs must be of the
same DIE source.
The patch doesn't embed a regression test as this problem was
discovered using the
https://pagure.io/libabigail-selfcheck/blob/master/f/selfcheck.py
testing framework
* src/abg-dwarf-reader.cc (compare_dies): Don't propagate
a canonical DIE to a DIE that comes from a different source.
Dodji Seketeli [Thu, 22 Jun 2017 10:16:42 +0000 (12:16 +0200)]
Bug 21627 - Libabigail doesn't consider translation unit compile dir
The path of a translation unit is relative to the directory where that
translation unit was compiled.
So there can be several different translation units (in the same
binary) that have the same (relative) paths. To tell them apart, one
needs to consider the compile directory of those translation units.
But then Libabigail ignores the compilation directory of translation
units. It just considers their (relative) path. That leads to
different translation units having the same path.
Furthermore, there can be a translation unit with full path (one that
takes into account the file name and its compile directory) named "P"
that contains function definitions f1 and f2, as described by the
debug info. Further down the road, there can be *another* translation
unit which also has "P" as its full path, and that cotnains function
definitions f3 and f4. A way to understand is to consider that the
translation unit of full path "P" contains f1, f2, f3 and f4.
This patch introduces the concept of the compile dir of a given
translation unit, and the concept of the absolute path of the
translation unit which would then be a concatenation of the compile
dir and relative paths of the translation unit.
The patch also tries to reuse a translation unit with a given path,
*if* that translation unit has already been seen in the current
binary, instead of creating a new one altogether.
This patch doesn't carry a regression test as the problem was found
while running the
https://pagure.io/libabigail-selfcheck/blob/master/f/selfcheck.py
script over the Fedora 25 critpath packages.
The patch does however update existing reference outputs of existings
tests where appropriate.
* include/abg-ir.h (translation_unit::{get_compilation_dir_path,
set_compilation_dir_path, get_absolute_path}):
* src/abg-corpus.cc (corpus::add): Use the new
translation_unit::get_absolute_path() as the key for the tu path
-> tu map.
* src/abg-dwarf-reader.cc
(read_context::resolve_declaration_only_classes): Use the new
translation_unit::get_absolute_path().
(build_translation_unit_and_add_to_ir): Set the compilation
directory of the translation unit.
* src/abg-ir-priv.h (translation_unit::priv::{comp_dir_path_,
abs_path_}):
* src/abg-ir.cc (translation_unit::set_path): Update comment.
(translation_unit::{get_compilation_dir_path,
set_compilation_dir_path, get_absolute_path}): Define new member
functions.
* src/abg-reader.cc (read_translation_unit): Take the new
'comp-dir-path' attribute into account.
* src/abg-writer.cc (write_translation_unit): Emit the new
'comp-dir-path' attribute.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Adjust.
* tests/data/test-annotate/libtest24-drop-fns.so.abi: Adjust.
* tests/data/test-annotate/test0.abi: Adjust.
* tests/data/test-annotate/test1.abi: Adjust.
* tests/data/test-annotate/test13-pr18894.so.abi: 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/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust.
* tests/data/test-annotate/test2.so.abi: Adjust.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust.
* tests/data/test-annotate/test21-pr19092.so.abi: Adjust.
* tests/data/test-annotate/test3.so.abi: Adjust.
* tests/data/test-annotate/test4.so.abi: Adjust.
* tests/data/test-annotate/test5.o.abi: Adjust.
* tests/data/test-annotate/test6.so.abi: Adjust.
* tests/data/test-annotate/test7.so.abi: Adjust.
* tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Adjust.
* tests/data/test-read-dwarf/libtest23.so.abi: Adjust.
* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Adjust.
* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Adjust.
* tests/data/test-read-dwarf/test0.abi: Adjust.
* tests/data/test-read-dwarf/test1.abi: Adjust.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.
* tests/data/test-read-dwarf/test13-pr18894.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/test16-pr18904.so.abi: Adjust.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust.
* tests/data/test-read-dwarf/test2.so.abi: Adjust.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust.
* tests/data/test-read-dwarf/test3.so.abi: Adjust.
* tests/data/test-read-dwarf/test4.so.abi: Adjust.
* tests/data/test-read-dwarf/test5.o.abi: Adjust.
* tests/data/test-read-dwarf/test6.so.abi: Adjust.
* tests/data/test-read-dwarf/test7.so.abi: Adjust.
* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Adjust.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust.
Dodji Seketeli [Mon, 12 Jun 2017 17:10:20 +0000 (19:10 +0200)]
Symbols with the same zero value are not aliases
When looking at ELF file of the ET_REL kind (i.e, relocatable object
files), several kinds of symbols (for instance weak symbols) can have
the symbol value zero. Although they have the same value, the fact
that that value is zero prevents us from considering those symbols as
being aliases.
Libabigail was wrongly considering those symbols with value zero as
being aliases. So, in practice, it was considering all WEAK symbols
as being aliases, because the value of a weak symbols is zero.
When comparing two binaries originating from the same source code, one
compiled with g++ and the other one compiled with clang++, abidiff was
thus reporting spurious function aliases changes due to this issue.
Note that the two binaries in question come from the bug PR21486.
Comparing them using abidiff exhibits several other issues that were
fixed in previous commits, such as
- Reporting changes about top cv qualifier changes on function
parameter types.
- Not supporting ELF symbol visibility
* src/abg-dwarf-reader.cc (load_symbol_maps_from_symtab_section):
Do not consider symbols with zero value as being aliases.
* tests/data/test-diff-filter/test20-inline-report-0.txt: Adjust.
* tests/data/test-diff-filter/test20-inline-report-1.txt:
Likewise.
* test-diff-filter/test41-PR21486-abg-writer.gcc.o: New test
binary input.
* tests/data/test-diff-filter/test41-PR21486-abg-writer.llvm.o:
Likewise.
* tests/data/Makefile.am: Add the new test material to source
distribution.
* tests/test-diff-filter.cc (in_out_specs): Run the test harness
on the new test input above.
* tests/data/test-diff-dwarf/test5-report.txt: Adjust.
* tests/data/test-diff-filter/test9-report.txt: Adjust.
* tests/data/test-diff-filter/test20-inline-report-0.txt: Adjust.
* tests/data/test-diff-filter/test20-inline-report-1.txt: Adjust.
Dodji Seketeli [Mon, 12 Jun 2017 09:24:20 +0000 (11:24 +0200)]
Support ELF symbol visibility property
This patch models the ELF symbol visibility property and support
ignoring function and variable symbols that are HIDDEN and INTERNAL,
even if they have default binding.
Dodji Seketeli [Fri, 9 Jun 2017 08:37:59 +0000 (10:37 +0200)]
Filter top cv qualifier changes on function parameter types
When the type of a function parameter sees its top CV qualifier
change, that should never negatively affect ABI compliance.
So this patch filters out top cv qualifier changes on function
parameter types, by default.
* include/abg-comparison.h (enum diff_category): Add a new
FN_PARM_TYPE_TOP_CV_CHANGE_CATEGORY enumerator. "Or" the
enumerator to the EVERYTHING_CATEGORY enumerator.
* src/abg-comp-filter.cc (has_fn_parm_type_cv_qual_change): Define
new static function.
(categorize_harmless_diff_node): Categorize changes to top cv
qualifiers on function parameter types into the new
FN_PARM_TYPE_TOP_CV_CHANGE_CATEGORY.
* src/abg-comparison.cc (get_default_harmless_categories_bitmap):
Add the new FN_PARM_TYPE_TOP_CV_CHANGE_CATEGORY category to the
set of harmless categories.
(operator<<(ostream&, diff_category)): Adjust to serialize
the new FN_PARM_TYPE_TOP_CV_CHANGE_CATEGORY.
* tests/data/test-diff-filter/libtest40-v0.so: New test input binary.
* tests/data/test-diff-filter/libtest40-v1.so: Likewise.
* tests/data/test-diff-filter/test40-report-0.txt: New test
reference output.
* tests/data/test-diff-filter/test40-v0.cc: Source code of the
test binary above.
* tests/data/test-diff-filter/test40-v1.cc: Likewise.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-diff-filter.cc (in_out_specs): Add new binaries to
compare.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
Adjust.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.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.
Dodji Seketeli [Sun, 28 May 2017 17:40:51 +0000 (19:40 +0200)]
Do not report about voffset when it's not set in debug info
Sometimes some virtual member functions don't have any virtual offset
set in the debug info. This happens for virtual destructors
sometimes. In that case, the ABI change report should not refer to
that unset virtual offset as being '0'. Rather, it shouldn't refer to
it at all.
This is what this patch does.
* include/abg-ir.h (mem_fn_context_rel::mem_fn_context_rel):
Initialize the virtual offset to -1.
* src/abg-comparison.cc (represent): In the overload to represent
a method_decl, do not represent the vofffset if it's not set.
* src/abg-writer.cc (write_voffset): The virtual offset is signed
because if it's -1, it means no offset is set.
* tests/data/test-annotate/test14-pr18893.so.abi: Adjust.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Adjust.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Adjust.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Adjust.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
Adjust.
* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Adjust.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Adjust.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Adjust.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Adjust.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Adjust.
Dodji Seketeli [Wed, 17 May 2017 08:19:30 +0000 (10:19 +0200)]
Allow selective resolution of class declaration
When a class is forward-declared, resolving it to a definition that
appears later in the same translation unit or in another translation
is an interesting problem.
Until now, the declaration would be resolved to the definition of that
class found in the binary. The problem is that there can be different
such definitions, especially in C where there is no "One Definition
Rule". In that case, the definition chosen is random.
This patch resolves that randomness.
For a given class declaration, if there is just one possible
definition in the binary, then the declaration is resolved to that
definition. If there is one definition for that declaration in the
same translation unit, then the declaration is resolved to that
definition. If there are more than one definitions in translation
units that are not the one of the declaration, then the declaration is
left unresolved. This is what I call "selective class declaration resolution".
Note that an unresolved class declaration now compares different to a
definition of a class of the same name. This is so that we can have
an unresolved class be present in the resulting .abi file, alongside
an (incompatible) definition of the same class. The change from a class
declaration to its definition is filtered out by default, though.
* include/abg-fwd.h (type_base_wptrs_type)
(istring_type_base_wptrs_map_type): Define new typedefs.
(lookup_class_types): Declare new functions.
* include/abg-ir.h
(environment::decl_only_class_equals_definition): Declare new
accessor.
(type_maps::{*_types}): Make these accessors return
istring_type_base_wptrs_map_type& instead of
istring_type_base_wptr_map_type&.
* src/abg-dwarf-reader.cc
(read_context::resolve_declaration_only_classes): Implement the
new selective declaration resolution scheme.
* src/abg-ir.cc (type_maps::priv::{*_types_}): Change the type of
these data members from istring_type_base_wptr_map_type to
istring_type_base_wptrs_map_type.
(type_maps::{*_types}): Make these accessors definitions return
istring_type_base_wptrs_map_type& instead of
istring_type_base_wptr_map_type&.
(translation_unit::bind_function_type_life_time): Adjust.
(environment::priv::decl_only_class_equals_definition_): New data
member.
(environment::priv::priv): Initialize it. By default, a decl-only
class is now considered different from its definition.
(environment::decl_only_class_equals_definition): Define new
accessor.
(lookup_types_in_map, lookup_class_types): Define new functions.
(lookup_type_in_map, lookup_union_type_per_location)
(lookup_basic_type, lookup_basic_type_per_location)
(lookup_class_type, lookup_class_type_per_location)
(lookup_union_type, lookup_enum_type)
(lookup_enum_type_per_location, lookup_typedef_type)
(lookup_typedef_type_per_location, lookup_qualified_type)
(lookup_pointer_type, lookup_reference_type, lookup_array_type)
(lookup_function_type, maybe_update_types_lookup_map)
(maybe_update_types_lookup_map<class_decl>)
(maybe_update_types_lookup_map<function_type>): Adjust.
(type_base::get_canonical_type_for): When doing type comparison
here, we can now consider that an unresolved class declaration
compares different to an incompatible class definition of the same
name. So no need to look through decl-only classes in that case.
(equals): In the overload for class_or_union, if
environment::decl_only_class_equals_definition() is false, then an
unresolved class declaration of name "N" compares different to a
class definition named "N".
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt:
Adjust.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt:
Adjust.
* tests/data/test-diff-filter/test38/Makefile: New test material.
* tests/data/test-diff-filter/test38/test38-a.c: Likewise.
* tests/data/test-diff-filter/test38/test38-b.c: Likewise.
* tests/data/test-diff-filter/test38/test38-c.c: Likewise.
* tests/data/test-diff-filter/test38/test38-report-0.txt: Likewise.
* tests/data/test-diff-filter/test38/test38-v0: Likewise.
* tests/data/test-diff-filter/test38/test38-v1: Likewise.
* tests/data/test-diff-filter/test38/test38.h: Likewise.
* tests/data/test-diff-filter/test39/Makefile: Likewise.
* tests/data/test-diff-filter/test39/test39-a-v0.c: Likewise.
* tests/data/test-diff-filter/test39/test39-a-v1.c: Likewise.
* tests/data/test-diff-filter/test39/test39-b-v0.c: Likewise.
* tests/data/test-diff-filter/test39/test39-b-v1.c: Likewise.
* tests/data/test-diff-filter/test39/test39-c-v0.c: Likewise.
* tests/data/test-diff-filter/test39/test39-c-v1.c: Likewise.
* tests/data/test-diff-filter/test39/test39-main.c: Likewise.
* tests/data/test-diff-filter/test39/test39-report-0.txt: Likewise.
* tests/data/test-diff-filter/test39/test39-v0: Likewise.
* tests/data/test-diff-filter/test39/test39-v1: Likewise.
* tests/data/test-diff-filter/test39/test39.h: Likewise.
* tests/data/Makefile.am: Add the new test material above to the
source distribution.
* tests/test-diff-filter.cc (in_out_specs): Add the new test
inputs above to the test harness.
Dodji Seketeli [Wed, 31 May 2017 08:30:23 +0000 (10:30 +0200)]
Allow re-using the ELF/DWARF read_context when loading a corpus group
Right now, when loading each corpus of a group, a new read_context is
created and destroyed. That makes thousands of corpora that are
created and destroyed. Profiling seems to argue that we'd gain in
performance by re-using the first read_context that was created
instead, and re-set it before loading a new corpus.
This is what this patch does.
* include/abg-dwarf-reader.h (reset_read_context): Declare new
function.
* src/abg-dwarf-reader.cc (read_context::elf_paths_): Make this to
be non const.
(read_context::initialize): New function to initialize all data
members.
(read_context::read_context): Use the new read_context::initialize
function, rather than initializing data members 'inline' here.
(reset_read_context): Define a new function to reset a
read_context so that it can be re-used to load a new corpus.
Dodji Seketeli [Wed, 31 May 2017 07:47:26 +0000 (09:47 +0200)]
Add --vmlinux{1,2} option to abidw and kmidiff
When using abidw to generate an abixml for a Linux Kernel build tree,
usually, people have to copy the vmlinux binary into the directory
where modules are, so that the tool can find it. This --vmlinux
option helps to avoid doing that copy.
Simarly, when comparing two Linux Kernel build trees, --vmlinux1 and
--vmlinux2 are there to make the tool find the vmlinux binaries to
compare, independantly from the directories under which the modules
are to be found.
* include/abg-tools-utils.h
(build_corpus_group_from_kernel_dist_under): Add a new
vmlinux_path parameter.
* src/abg-tools-utils.cc (find_vmlinux_and_module_paths): Do not
try to find a vmlinux binary if we already have the path to one.
(build_corpus_group_from_kernel_dist_under): Add a new
vmlinux_path parameter.
* tools/abidw.cc (options::vmlinux): New data member.
(display_usage): Add a usage string for --vmlinux
(parse_command_line): Parse the new --vmlinux option.
(load_kernel_corpus_group_and_write_abixml): Fix some return code
when the function fails. Verify the presence of the vmlinux
binary that was given. Adjust.
* tools/kmidiff.cc (options::{vmlinux1, vmlinux2}): New data
members.
(display_usage): Add a usage string for --vmlinux1 and --vmlinux2.
(parse_command_line): Parse the --vmlinux1 and --vmlinux2
options.
(main): Adjust.
Dodji Seketeli [Thu, 18 May 2017 12:45:32 +0000 (14:45 +0200)]
Cache function type name computation results
get_type_name can be called over and over again on function types.
This patch caches the result of the computation of function type names
in those cases.
This is a speed optimization.
* src/abg-ir.cc (get_type_name): Cache function type names.
Dodji Seketeli [Mon, 29 May 2017 08:26:37 +0000 (10:26 +0200)]
Fix innacurate test condition when reading an enum type from abixml
* src/abg-reader.cc (build_enum_type_decl): Do not check for
errno which might have been set earlier by something else.
Rather, check the returned value for overflow or underflow.
Dodji Seketeli [Sun, 28 May 2017 17:40:51 +0000 (19:40 +0200)]
Do not report about voffset when it's not set in debug info
Sometimes some virtual member functions don't have any virtual offset
set in the debug info. This happens for virtual destructors
sometimes. In that case, the ABI change report should not refer to
that unset virtual offset as being '0'. Rather, it shouldn't refer to
it at all.
This is what this patch does.
* include/abg-ir.h (mem_fn_context_rel::mem_fn_context_rel):
Initialize the virtual offset to -1.
* src/abg-comparison.cc (represent): In the overload to represent
a method_decl, do not represent the vofffset if it's not set.
* src/abg-writer.cc (write_voffset): The virtual offset is signed
because if it's -1, it means no offset is set.
* tests/data/test-annotate/test14-pr18893.so.abi: Adjust.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Adjust.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Adjust.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Adjust.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
Adjust.
* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Adjust.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Adjust.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Adjust.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Adjust.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Adjust.
Dodji Seketeli [Thu, 18 May 2017 12:38:51 +0000 (14:38 +0200)]
Speedup DIE representation computing esp function signature in C
For DIE originating from C, we now compute canonical DIEs. We then
use that to compare DIEs to see if they are equal or not. So string
representation of DIEs are now used only to reduce the number of DIEs
comparisons that is performed during DIE canonicalization.
We can thus just use function names (rather than a full
die_function_signature) as a way to reduce the number of structural
comparisons of DIEs during canonicalization.
This patch does just that.
Note that in the future when we perform DIEs canonicalization and comparison for
C++, we can avoid computing full function DIE signatures for C++ too.
* src/abg-dwarf-reader.cc (die_function_signature): For C DIEs,
just return the (linkage) name of the function.
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-annotate/test21-pr19092.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust.
Dodji Seketeli [Wed, 17 May 2017 08:19:30 +0000 (10:19 +0200)]
Allow selective resolution of class declaration
When a class is forward-declared, resolving it to a definition that
appears later in the same translation unit or in another translation
is an interesting problem.
Until now, the declaration would be resolved to the definition of that
class found in the binary. The problem is that there can be different
such definitions, especially in C where there is no "One Definition
Rule". In that case, the definition chosen is random.
This patch resolves that randomness.
For a given class declaration, if there is just one possible
definition in the binary, then the declaration is resolved to that
definition. If there is one definition for that declaration in the
same translation unit, then the declaration is resolved to that
definition. If there are more than one definitions in translation
units that are not the one of the declaration, then the declaration is
left unresolved. This is what I call "selective class declaration resolution".
Note that an unresolved class declaration now compares different to a
definition of a class of the same name. This is so that we can have
an unresolved class be present in the resulting .abi file, alongside
an (incompatible) definition of the same class. The change from a class
declaration to its definition is filtered out by default, though.
* include/abg-fwd.h (type_base_wptrs_type)
(istring_type_base_wptrs_map_type): Define new typedefs.
(lookup_class_types): Declare new functions.
* include/abg-ir.h
(environment::decl_only_class_equals_definition): Declare new
accessor.
(type_maps::{*_types}): Make these accessors return
istring_type_base_wptrs_map_type& instead of
istring_type_base_wptr_map_type&.
* src/abg-dwarf-reader.cc
(read_context::resolve_declaration_only_classes): Implement the
new selective declaration resolution scheme.
* src/abg-ir.cc (type_maps::priv::{*_types_}): Change the type of
these data members from istring_type_base_wptr_map_type to
istring_type_base_wptrs_map_type.
(type_maps::{*_types}): Make these accessors definitions return
istring_type_base_wptrs_map_type& instead of
istring_type_base_wptr_map_type&.
(translation_unit::bind_function_type_life_time): Adjust.
(environment::priv::decl_only_class_equals_definition_): New data
member.
(environment::priv::priv): Initialize it. By default, a decl-only
class is now considered different from its definition.
(environment::decl_only_class_equals_definition): Define new
accessor.
(lookup_types_in_map, lookup_class_types): Define new functions.
(lookup_type_in_map, lookup_union_type_per_location)
(lookup_basic_type, lookup_basic_type_per_location)
(lookup_class_type, lookup_class_type_per_location)
(lookup_union_type, lookup_enum_type)
(lookup_enum_type_per_location, lookup_typedef_type)
(lookup_typedef_type_per_location, lookup_qualified_type)
(lookup_pointer_type, lookup_reference_type, lookup_array_type)
(lookup_function_type, maybe_update_types_lookup_map)
(maybe_update_types_lookup_map<class_decl>)
(maybe_update_types_lookup_map<function_type>): Adjust.
(type_base::get_canonical_type_for): When doing type comparison
here, we can now consider that an unresolved class declaration
compares different to an incompatible class definition of the same
name. So no need to look through decl-only classes in that case.
(equals): In the overload for class_or_union, if
environment::decl_only_class_equals_definition() is false, then an
unresolved class declaration of name "N" compares different to a
class definition named "N".
* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt:
Adjust.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt:
Adjust.
* tests/data/test-diff-filter/test38/Makefile: New test material.
* tests/data/test-diff-filter/test38/test38-a.c: Likewise.
* tests/data/test-diff-filter/test38/test38-b.c: Likewise.
* tests/data/test-diff-filter/test38/test38-c.c: Likewise.
* tests/data/test-diff-filter/test38/test38-report-0.txt: Likewise.
* tests/data/test-diff-filter/test38/test38-v0: Likewise.
* tests/data/test-diff-filter/test38/test38-v1: Likewise.
* tests/data/test-diff-filter/test38/test38.h: Likewise.
* tests/data/test-diff-filter/test39/Makefile: Likewise.
* tests/data/test-diff-filter/test39/test39-a-v0.c: Likewise.
* tests/data/test-diff-filter/test39/test39-a-v1.c: Likewise.
* tests/data/test-diff-filter/test39/test39-b-v0.c: Likewise.
* tests/data/test-diff-filter/test39/test39-b-v1.c: Likewise.
* tests/data/test-diff-filter/test39/test39-c-v0.c: Likewise.
* tests/data/test-diff-filter/test39/test39-c-v1.c: Likewise.
* tests/data/test-diff-filter/test39/test39-main.c: Likewise.
* tests/data/test-diff-filter/test39/test39-report-0.txt: Likewise.
* tests/data/test-diff-filter/test39/test39-v0: Likewise.
* tests/data/test-diff-filter/test39/test39-v1: Likewise.
* tests/data/test-diff-filter/test39/test39.h: Likewise.
* tests/data/Makefile.am: Add the new test material above to the
source distribution.
* tests/test-diff-filter.cc (in_out_specs): Add the new test
inputs above to the test harness.
Dodji Seketeli [Thu, 4 May 2017 08:20:18 +0000 (10:20 +0200)]
Avoid de-duplicating different C types that have identical name
This patch introduces the concept of canonical DIEs.
To date, when two C types have the same string representation [1] and
are defined at the same location, they are considered to be the same,
just as in C++.
[1]: String representation of a type: For a type named
"Foo" that is a structure, the representation is "struct Foo"
This patch introduces more finesse in determining if two types are
different.
It implements comparing the DIEs of the types, directly from the DWARF
representation. When comparing pointers, typedefs and qualified
types, the underlying type is compared recursively.
The type de-duplication scheme is now centered around two data
structures.
1/ A map that associates the string representation of a type with
a vector of the offsets of the type DIEs that have the same
representation. Members of this vector denotes DIEs of types that
are *different* even if they all have the same representation.
Each DIE in a given vector is the canonical DIE of its class of
equivalence. This map is the map of all canonical DIEs organized
by the representation of those canonical DIEs.
2/ A map that associates the offset of the canonical type DIE with
the resulting internal representation of the type. Here, the
internal representation is an instance of the
abigail::ir::type_base type. This map is the map of the types
associated to the canonical type DIEs.
There is also a vector that associates a DIE 'D' to its canonical DIE
'C'. The index of the vector is the offset of 'D' and the value of
the element at that index is 'C'.
Thus, each time we are about to create (or get) an internal
representation for a type DIE denoted 'D', we first get the canonical
DIE of 'D', denoted C. If C doesn't exist, we create it. That is, we
add a new entry in the map 1/. Then we look in map 2/ to see if the C
(and thus D) has a associated type.
If C has an associated type, we return it.
If C has no associated type, we create a type for it (and thus for D)
and we associate the new type to the offsets of both D and C.
The rest of the patch is mostly boiler plate and adjustment to
accomodate this new de-duplication scheme.
* src/abg-dwarf-reader.cc (die_decl_map_type, die_type_map_type):
Remove these typedefs.
(die_artefact_map_type, istring_dwarf_offsets_map_type): New
typedefs.
(die_is_at_class_scope, die_qualified_type_name)
(die_qualified_decl_name, die_qualified_type_name_empty)
(die_return_and_parm_names_from_fn_type_die)
(die_function_type_is_method_type):
Const-ify the read_context& parameter.
(read_context::die_source_dependant_container_set::get_container):
Likewise.
(read_context::{name_artefacts_map_, per_tu_name_artefacts_map_,
die_decl_map_, alternate_die_decl_map_, type_unit_die_decl_map_,
die_type_map_, alternate_die_type_map_, type_unit_die_type_map_}):
Remove data members.
(read_context::{die_decl_map, alternate_die_decl_map,
associate_die_to_decl_primary, associate_die_to_decl_alternate,
associate_die_to_decl_from_type_unit,
lookup_decl_from_die_offset_primary,
lookup_decl_from_die_offset_alternate,
lookup_decl_from_type_unit_die_offset,
lookup_type_artifact_from_die_per_tu,
lookup_artifact_from_per_tu_die_representation,
associate_die_to_artifact_by_repr,
associate_die_to_artifact_by_repr_internal, clear_die_type_maps}):
Remove member functions.
(read_context::{decl_die_repr_die_offsets_maps_,
type_die_repr_die_offsets_maps_, decl_die_artefact_maps_,
type_die_artefact_maps_, dwarf_expr_eval_context_}): Add new data
members.
(read_context::clear_per_translation_unit_data): Don't clear
read_context::per_tu_name_artefacts_map_ data member as it's
removed.
(read_context::clear_per_corpus_data): Don't clear
read_context::name_artefacts_map_ and all the other relevant data
members that got removed.
(read_context::{dwarf_per_die_source,
decl_die_repr_die_offsets_maps, type_die_repr_die_offsets_maps,
get_canonical_die, get_die_from_offset, decl_die_artefact_maps,
type_die_artefact_maps, dwarf_expr_eval_ctxt}): Add new member
functions.
(compare_dies, compare_as_decl_dies)
(compare_as_type_dies, maybe_finish_function_decl_reading)
(die_is_anonymous): Define new functions.
(read_context::associate_die_to_decl): Remove the
do_associate_by_repr_per_tu parameter. Use the new
read_context::{decl_die_artefact_maps_, get_canonical_die} member
functions.
(read_context::lookup_decl_from_die_offset): Use Dwarf_Off rather
than size_t for the type of the die_offset parameter. Use the
lookup_artifact_from_die_offset member function.
(read_context::lookup_type_artifact_from_die): Const-ify. In one
overload, take a new 'die_as_type' parameter. Use the new
get_canonical_die, type_die_artefact_maps and
decl_die_artefact_maps member functions. In the second overload,
use the first overload.
(read_context::odr_is_relevant): Add an overload that takes a DIE.
(read_context::associate_die_to_type): Remove the
do_associate_by_repr and do_associate_per_tu parameters. Use the
new get_canonical_die and type_die_artefact_maps member functions.
(read_context::lookup_type_from_die): Use the new
lookup_artifact_from_die member function.
(read_context::lookup_type_from_die_offset): Use the new
type_die_artefact_maps member function. When the found artifact
is a function_decl, return its type.
(read_context::schedule_type_for_late_canonicalization): Use the
new get_canonical_die and type_die_artefact_maps member functions.
(die_function_signature): Const-ify. Get the scope name right
even for scopes that are not types.
(die_member_offset): Make eval_last_constant_dwarf_sub_expr use
the new cached DWARF expression evalution context.
(get_parent_die): Support where_offset equals to zero. This means
we are looking at a C binary, basically.
(build_enum_type) : Use the new overload of
read_context::odr_is_relevant that takes a DIE. Adjust.
(add_or_update_union_type, add_or_update_class_type): Don't lookup
classes/unions per location anymore. Now that we can compare DIEs
in a fined grain manner, the approximation of the location is not
useful anymore.
(build_pointer_type)
(build_function_type): Associate DIE to type if we reuse an
existing type.
(build_or_get_fn_decl_if_not_suppressed): When re-using a
function decl internal representation from an equivalent DIE that
we've seen before, it can happen that we want to augment that
function decl internal representation with new properties coming
from the DIE we are currently looking at; do that here.
(is_function_for_die_a_member_of_class): Remove the "where_offset"
parameter.
(add_or_update_member_function): Adjust.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/test13-pr18894.so.abi: 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/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust.
* tests/data/test-annotate/test21-pr19092.so.abi: Adjust.
* 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: Adjust.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt: Adjust.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-1.txt: Adjust.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Adjust.
* tests/data/test-read-dwarf/libtest23.so.abi: Adjust.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.
* tests/data/test-read-dwarf/test13-pr18894.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/test16-pr18904.so.abi: Adjust.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust.
Speedup access to unreferenced symbols when loading corpus_group
This patch speeds up the invocation of
corpus_group::get_unreferenced_function_symbols and
corpus_group::get_unreferenced_variable_symbols. It does so by
caching the result of constructing the map of of unreferenced symbol
at the time where each corpus is added to the group.
* src/abg-corpus.cc (corpus_group::unrefed_{fun, var}_symbol_map):
New data members.
(corpus_group::priv::priv): Adjust.
(corpus_group::priv::add_unref_{fun,var}_symbols): Define new
member functions.
(corpus_group::add_corpus): Update the map of unreferenced
symbols.
(corpus_group::get_unreferenced_{function,variable}_symbols)
Adjust logic.
Initial support of de-serializing the KMI of a Linux Kernel Tree
With this patch, kmidiff knows how to compare a serialized
corpus_group that represents a Kernel Module Interface (a .kmi file)
against either another serialized .kmi file, or against a kernel tree.
The patch extends the abixml reader to make it parse an
'abi-corpus-group' element. To do that, the patch modifies
read_corpus_from_input to make it be capable of parsing several
'abi-corpus' in a row. That modified function is then used by a new
read_corpus_group_from_input, which is itself used by the new public
entry points read_corpus_group_from_native_xml_file and
read_corpus_group_from_native_xml.
With that read_corpus_group_from_native_xml_file building block
function, the kmidiff program is modified so that it can take either
two directory trees, two .kmi files or one directory tree and one .kmi
file.
* include/abg-libxml-utils.h (advance_to_next_sibling_element):
Declare new function.
* src/abg-libxml-utils.cc (go_to_next_sibling_element_or_stay)
(advance_to_next_sibling_element): Define new functions.
* include/abg-reader.h (read_corpus_group_from_input)
(read_corpus_group_from_native_xml)
(read_corpus_group_from_native_xml_file): Declare new functions.
* src/abg-reader.cc (read_context::m_corpus_group): New data
member.
(read_context::{get_corpus_group, set_corpus_group}): Define new
member functions.
(read_translation_unit_from_input): Cleanup logic.
(read_corpus_from_input): Don't assume that the document is
starting with an 'abi-corpus' element. Support the mode where a
caller called the xmlTextReaderExpand function (and so we are
given an expanded xmlNodePtr) and the mode where we need to use
the xmlTextReader API to walk through the 'abi-corpus' element.
Also, if we are building a corpus group, do not clear what used to
be 'per-corpus' data. That data must be shared by all the corpora
of a given abi-corpus-group.
(read_corpus_group_from_input, read_corpus_group_from_native_xml)
(read_corpus_group_from_native_xml_file): Define new functions.
* include/abg-tools-utils.h (FILE_TYPE_XML_CORPUS_GROUP): New
enumerator of the file_type enum.
* src/abg-tools-utils.cc (operator<<): In the overload for
file_type, add a case for the new FILE_TYPE_XML_CORPUS_GROUP.
(guess_file_type): Dectect abi-corpus-group xml element.
* tools/abidiff.cc (adjust_diff_context_for_kmidiff): Define new
static function.
(main): Adjust to handle the new FILE_TYPE_XML_CORPUS_GROUP. That
is, compare two FILE_TYPE_XML_CORPUS_GROUP if they are present.
* tools/abilint.cc (main): Likewise.
* tools/kmidiff.cc (main): Detect that one of two .kmi files are
passed. In that case, load the .kmi file(s), build a corpus_group
of it and use it in the comparison.
Initial support of the serialization of the KMI of a Linux Kernel Tree
We have the kmidiff program that takes two Linux Kernel trees
containing the vmlinux binary and its modules and compare their Kernel
Module Interface, aka KMI.
We need to be able to serialize (save in a file) a representation of
that KMI. We need to load that KMI back, and compare two serialized
KMIs.
This patch implements the serialization of the KMI of a Linux Kernel
tree. It actually serializes an instance of abigail::ir::corpus_group
that is a collection of instances of abigail::ir::corpus. The KMI of
each individual binary (vmlinux or kernel module) is represented by
one abigail::ir::corpus. All the corpora share the same definitions
of types and decls, whenever that makes sense.
The patch thus factorizes the routines used to walk a Linux kernel out
of the kmidiff program. These routines are then re-used in the abidw
program to make it walk a Linux kernel tree (when the --linux-tree
option is provided), load the vmlinux and module binaries as an
instance of abigail::corpus_group and serialize it out into an output
stream.
* include/abg-tools-utils.h (check_dir)
(get_binary_paths_from_kernel_dist)
(build_corpus_group_from_kernel_dist_under): Declare new
functions. The last two functions are being moved from
tools/kmidiff.cc so that they can be re-used.
* include/abg-writer.h (write_corpus): Declare one overload that
takes a write_context parameter.
(write_corpus_group): Declare three overloads of this new function.
* src/abg-tools-utils.cc (check_dir): Define new function.
(load_generate_apply_suppressions, is_vmlinux, is_kernel_module)
(find_vmlinux_and_module_paths)
(get_binary_paths_from_kernel_dist)
(build_corpus_group_from_kernel_dist_under): Define new functions.
* src/abg-writer.cc (write_context::set_annotate): Define new
member function.
(write_corpus): Add an overload that takes a write_context. Adapt
the existing overload to make it use this new one.
(write_corpus_group): Define this new function and two additional
overloads for it.
* tools/kmidiff.cc (set_suppressions, is_vmlinux)
(is_kernel_module, find_vmlinux_and_module_paths)
(get_binary_paths_from_kernel_dist)
(build_corpus_group_from_kernel_dist_under): Remove.
(main): Adjust the call to
build_corpus_group_from_kernel_dist_under as its arguments are now
adapted since it's been factorized out into abg-tools-utils.h.
* tools/abidw.cc (options::corpus_group_for_linux): Define new
data member.
(options::options): Adjust.
(display_usage): Add help strings for the new --linux-tree option.
(load_corpus_and_write_abixml): Factorize this function out of the
main function.
(load_kernel_corpus_group_and_write_abixml): Define new function.
(main): Use the factorized load_corpus_and_write_abixml and the
new load_corpus_and_write_abixml functions.
* tests/test-read-write.cc: Adjust.
* doc/manuals/abidw.rst: Add documentation for the new
--linux-tree option.
Adjust test reference outputs after changes in abg-writer.cc
After the latest commits to avoid emitting empty translation units and
dupicated decls, and also to fix some indention issues in the abixml
output, this patch updates the reference outputs of the abixml
regression tests.
This patch avoids emitting the same decl twice in the same ABI corpus
or corpus_group. For the purpose of this duplication detection, a
decl is designated by its pretty representation.
The patch helps to reduce the size of the abixml files drastically by
cutting some of them, especially those representing the KMI of the
linux kernel in more than half.
* src/abg-writer.cc (write_context::m_emitted_decls_map): New data
member.
(write_context::{decl_name_is_emitted, record_decl_as_emitted}):
Define new memeber functions.
(write_translation_unit): Do not emit a decl that has already been
emitted.
(write_var_decl, write_function): Record the decl as emitted.
Dodji Seketeli [Mon, 12 Jun 2017 13:19:01 +0000 (15:19 +0200)]
Introduce the --kmi-whitelist option to abidiff
abidiff had an --linux-kernel-abi-whitelist option. Rename it
--kmi-whitelist.
* doc/manuals/abidiff.rst: Add documentation for the
--kmi-whitelist option.
* tools/abidiff.cc (display_usage): Emit help string for the
--kmi-whitelist option
(parse_command_line): Parse the new --kmi-whitelist option, of the
-w shortcut.
When writting out the ABI of a Linux kernel binary we must be able to
restrict it to the set of functions and global variables which ELF
symbols have names defined in a white list.
This patch adds that support, using the --kmi-whitelist
option.
* tools/abidw.cc (options::{kabi_whitelist_paths,
kabi_whitelist_supprs}): New data members.
(display_usage): Add a help string for the new --kmi-whitelist
option.
(parse_command_line): Parse the new --kmi-whitelist option.
(maybe_check_suppression_files): Check the presence of the linux
kernel abi white list passed by the option --kmi-whitelist.
(main): Ignore loading the symbol table if the kernel abi white
list is provided.
* doc/manuals/abidw.rst: Add documentation for the new option.
This patch makes abipkgdiff compare two kernel packages. At the
moment the comparison is done by comparing each binary from the first
package to its counterpart in the second package. No optimization is
done do represent a vmlinux binary and its modules as one single
entity. So this is different from what kmidiff does.
* include/abg-suppression.h
(variable_suppression::variable_suppression): Add default arguments
to the parameters.
* include/abg-tools-utils.h (dir_exists, dir_is_empty)
(string_begins_with, get_rpm_name, get_rpm_arch, get_deb_name)
(file_is_kernel_package, file_is_kernel_debuginfo_package):
Declare new functions.
* src/abg-tools-utils.cc (dir_exists, dir_is_empty)
(string_begins_with, get_deb_name, get_rpm_name, get_rpm_arch)
(file_is_kernel_package, file_is_kernel_debuginfo_package): Define
new functions.
(gen_suppr_spec_from_kernel_abi_whitelist): The kernel ABI
whitelist is made of ELF symbols names that ought to match
functions *and* variables that have ELF symbols with those names.
So generate variable suppression specifications as well. Not just
function suppression specifications.
* tools/abipkgdiff.cc (options::{kabi_whitelist_package,
show_symbols_not_referenced_by_debug_info, kabi_whitelist_paths,
kabi_suppressions}): New data members.
(options::options): Adjust.
(package::KIND_KABI_WHITELISTS): New enumerator in the
package::kind enum.
(package::kabi_whitelist_package_): New data member.
(package::{base_name, kabi_whitelist_package, }): New member
functions.
(display_usage): Add a help string to the new
--linux-kernel-abi-whitelist and --no-unreferenced-symbols
options.
(parse_command_line): Parse the new --no-unreferenced-symbols,
--linux-kernel-abi-whitelist and --lkaw-pkg options.
(maybe_check_suppression_files): Check the presence of kabi
whitelist files.
(set_diff_context_from_opts): Consider (not) showing symbols not
referenced by debug info.
(compare): If we are looking at linux kernel packages, take the
kernel abi whitelist into account, apply the suppressions
resulting from the kabi whitelists to the ELF read context.
(maybe_collect_kabi_whitelists)
(get_kabi_whitelists_from_arch_under_dir)
(maybe_handle_kabi_whitelist_pkg, maybe_collect_kabi_whitelists)
(get_interesting_files_under_dir): Define new functions.
(maybe_update_vector_of_package_content): Take a new
file_name_to_look_for parameter.
(create_maps_of_package_content)
(extract_package_and_map_its_content): Consider the case of the
package being a linux kernel package.
(main): Take the potential --lkaw-pkg into account.
* doc/manuals/abipkgdiff.rst: Add documentation for options
--linux-kernel-abi-whitelist, --lkaw-pkg and
--no-unreferenced-symbols.