While chasing self-comparison changes errors, I realized that
compilation is failing when the package is configured with
--debug-self-comparison.
Fixed thus.
* src/abg-reader.cc
(reader::{maybe_check_abixml_canonical_type_stability, read_corpus}):
get_environment() doesn't returns a pointer anymore. So adapt the
code.
(maybe_map_type_with_type_id): Adjust because the environment is
const.
(load_canonical_type_ids): The xml_reader namespace doesn't exist
anymore. It's now abixml.
* tools/abidiff.cc (options::options): Initialize the
do_debug_self_comparison data member before the use_btf one, as it
should be.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When the alternate debug info referenced by the main debug info file
is missing, both abidw and abidiff fail to explain what is happening
to the user. The patch adds explicit error messages to those two
programs in that case.
* tools/abidiff.cc (handle_error): Handle cases where the
fe_iface::STATUS[_ALT]_DEBUG_INFO_NOT_FOUND bits are set. Refer to
the alternate debug info file in the error message.
* tools/abidw.cc (load_corpus_and_write_abixml): Do not clear the
reader before emitting the error message, rather clear it after.
Also, refer to the alternate debug info file in the error message.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When get_soname_of_elf_file is given an unexpected ELF file (e.g, a
DWARF file that is at the wrong place in an RPM, for instance) it hits
an assert and aborts. Ooops.
This patch removes the offending assert from get_soname_of_elf_file.
Note that to reproduce the initial issue one has to type:
$ fedabipkgdiff --self-compare -a --from fc36 julia
* src/abg-elf-helpers.cc (get_soname_of_elf_file): If the program
header we are looking at is not what we expect, just skip it; do
not abort.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The function abipkgdiff() introduced a busy loop instead of using
subprocess.communicate() because it was randomly hanging back in the
python2 days.
This patch removes the busy loop altogether as I could not reproduce
the hanging anymore.
* tools/fedabipkgdiff (abipkgdiff): Remove the busy looping and
use subprocess.communicate() instead.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch adds elapsed timing data to the debug logs emitted by the
"log_call" decorator.
* tools/fedabipkgdiff (log_call): Log the time taken by the
decorated function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This is about supporting an Ada-induced DWARF construct related to
ranged types.
To reproduce the issue this patch originated from, you can type:
$ fedabipkgdiff --self-compare -a --from fc37 gprbuild
From that gprbuild package from fc37, consider this subrange_type DIE
coming from the debuginfo file prtests/gprbuild-2020-11.fc37.aarch64:
1 [ 3c10d] subrange_type abbrev: 34
2 type (ref_addr) [ 6191e]
3 lower_bound (sdata) 2
4 upper_bound (ref_udata) [ 3c0eb]
At line 4, look at how the DW_AT_upper_bound attribute is a reference
to another DIE, instead of being a (signed) constant value, like the
DW_AT_lower_bound attribute at line 3. The referenced DIE is at
offset 0x3c0eb.
How do we get the actual value of the upper_bound of that subrange
type?
To answer that question, let's look at the DIE, at offset 0x3c0eb that
is referenced by the DW_AT_upper_bound attribute at line 4:
1 [ 3c0eb] member abbrev: 87
2 name (strp) "last"
3 decl_file (data1) a-coinve.ads (35)
4 decl_line (data2) 415
5 decl_column (data1) 24
6 type (ref_udata) [ 3c0f7]
It's a data member which type is referenced at line 6. Let's look at
that type, which offset is 0x3c0f7:
1 [ 3c0f7] subrange_type abbrev: 122
2 upper_bound (sdata) 99999999
3 name (strp) "gpr__names__name_vectors__T449bXn"
4 type (ref_addr) [ 6191e]
5 artificial (flag_present) yes
That type is a DW_TAG_subrange_type and its DW_AT_upper_bound value is
a constant. Finally.
Actually, the value of DW_AT_upper_bound of this DIE at offset 0x3c0f7
is the value of the DW_AT_upper_bound of the subrange_type DIE at
offset 0x3c10d that we were initially looking for.
The DIE at 0x3c0f7 is said to be indirectly referenced by the DIE at
0x3c10d, through its DW_AT_upper_bound attribute.
This patch supports retrieving the value of the DW_AT_upper_bound of
0x3c10d through the 0x3c0f7 DIE that it indirectly references.
The package gprbuild from fc37 now passes self comparison with this patch.
* src/abg-dwarf-reader.cc (subrange_die_indirect_bound_value)
(subrange_die_indirectly_references_subrange_die): Define new
static function.
(build_subrange_type): If the value of DW_AT_upper_bound is not a
constant, try to consider it as an indirect reference to a
DW_TAG_subrange_type DIE, whose DW_AT_upper_bound might carry the
constant value that we are looking for.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This solves a crash that happened with self-comparing the package
'aws' in Fedora by doing:
$ fedabipkgdiff --self-compare -a --from fc37 aws
When evaluating a DWARF expression with
eval_last_constant_dwarf_sub_expr, indirectly called from
die_member_offset, the DW_OP_GNU_variable_value appears not being
supported.
This patch adds the support for that.
To help with figuring that kind of issue in the future, I
have added a few asserts in the code of op_is_arith_logic.
* src/abg-dwarf-reader.cc (op_pushes_non_constant_value): Support
DW_OP_GNU_variable_value.
(op_is_arith_logic): Add a number of asserts and guards here.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Now that subranges can be standalone types, we need to teach
reader::get_scope_for_node about the fact that subranges can be at
array scope too.
* src/abg-reader.cc (reader::get_scope_for_node): A subrange
at array scope is meant to be in the scope of the array.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The recent patch "Bug rhbz#2182807 -- abipkgdiff crashes on missing debuginfo package"
inadvertently introduced user-specific filesystem information in error
messages, making tests/runtestdiffpkg be non-deterministic. Fixed
thus.
* tools/abipkgdiff.cc (get_pretty_printed_list_of_packages): Emit
base names of packages, not the absolute filesystem path.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt:
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When abipkgdiff is called with a debug info package that references an
alternate debug info file that is not found -- because debug info
package is missing from the command line -- the program aborts. This
is because the libabigail library is further invoked by the tool with
debuginfo in an inconsistent state (missing alternate debug info).
Note however that abipkgdiff only emits an explanatory message when
invoked with the --verbose option.
This patch teaches abipkgdiff to emit explanatory messages when an
alternate debug info file is not found. The message suggests that the
user adds the missing RPM package (which contains the alternate
missing debuginfo file) to the command line using the --d1/--d2
switches.
* src/abg-fe-iface.cc (status_to_diagnostic_string): Remove the
newline from the end of the returned diagnostic string.
* tools/abipkgdiff.cc (get_pretty_printed_list_of_packages)
(emit_alt_debug_info_not_found_error): Define new static
functions.
(compare, compare_to_self): Add an ostream& parameter as a
destination of diagnostic messages. If the
abigail::fe_iface::STATUS_ALT_DEBUG_INFO_NOT_FOUND bit is set in
the status code, emit the explanatory message to output stream
associated to the current comparison task. Remove the previous
handling of this case.
(compare_task::maybe_emit_pretty_error_message_to_output): Define
new member function to get the output stream associated to the
current task massage it and stick to result into the pretty output
string to be emitted to the user in the end, namely the
compare_task::pretty_output string data member.
({compares, self_compare}_task::perform): Adjust this to call the
new maybe_emit_pretty_error_message_to_output in case of error.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt:
Adjust.
* tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
After the support for Ada range types was added, it appeared that
redundancy propagation was not being correctly handled for range
types, especially when those are sub-types of a function parameter
type, like a const range.
This patch goes through the various problematic spots and addresses
the issues.
* src/abg-comparison.cc (redundancy_marking_visitor::visit_end):
Propagate redundancy category to function parameter diff nodes if
they don't carry any local non-type change.
* src/abg-default-reporter.cc
(default_reporter::report_underlying_changes_of_qualified_type):
Define new member function.
(default_reporter::report): In the qualified_type_diff overload,
use the new report_underlying_changes_of_qualified_type above.
* src/abg-ir.cc (types_have_similar_structure): If two arrays are
accessed indirectly and if they have size and dimension changes,
then the two arrays are considered having a similar structure.
Otherwise, if they are accessed directly, having size or dimension
change make them considered as having non similar structure. This
has an impact on if a change between two array types is considered
local or not.
* src/abg-leaf-reporter.cc (leaf_reporter::report): Local changes
to underlying types of a qualified type are considered local to
the qualified type. This change reflects that in the overload for
qualified type diff nodes. Otherwise, we won't report what would
otherwise be a leaf change to the a qualified type, just because
it's actually a leaf change to the underlying type of the
qualified type.
* tests/data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-{1,2}.txt:
New reference output files.
* tests/data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v0/test.ad{b,s}:
Source code for the new binary input below.
* tests/data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v0/test.o:
New binary input file.
* tests/data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v1/test.ad{b,s}:
Source code for the new binary input below.
* tests/data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v1/test.o:
New binary input file.
* tests/data/Makefile.am: Add the new test input files above to
source distribution.
* tests/test-abidiff-exit.cc (in_out_specs): Add the new input
tests above to this test harness.
* tests/data/test-diff-filter/libtest45-basic-type-change-report-1.txt:
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While running tests, I noticed that python was consuming a huge amount
of CPU. Frank Eigler located the problem and pointed
out that python was continiously polling for abipkgdiff's
completion. For small packages, the time to completion can be less
than a second but some packages can take literally hours to
analyze. Having python spinning in such a tight loop is unnecessary. I
added a small sleep to this loop with a bit of backoff. Vanessa Sochat
helped with examples of how to fix the python code.
* tools/fedabipkgdiff (abipkgdiff): add sleep while waiting for
subprocess completion. Also, update copyright year notice to 2023.
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Note that this issue can be reproduced by doing:
$ fedabipkgdiff --self-compare -a --from fc37 dx
When a binary is a symlink to another one,
create_maps_of_package_content doesn't realize it and considers the
two binaries to be different.
Later, when comes time to self compare both binaries, their abixml
files (which are the same, by virtue of symlinks) might be written at
the same time in different threads, creating a race condition, leading
to corruption of the abixml.
This patch fixes this by teaching create_maps_of_package_content to
resolve symlinks so that it can detect when two files actually point
to the same file.
* tools/abipkgdiff.cc (create_maps_of_package_content): Resolve
symlinks when mapping binaries. Don't map a binary that has
already been seen.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (anonymous_data_member_to_class_or_union): Add
a new overload.
(anonymous_data_member_exists_in_class): Declare new function.
* src/abg-dwarf-reader.cc (add_or_update_class_type): Use the new
anonymous_data_member_exists_in_class function.
* src/abg-ir.cc (anonymous_data_member_to_class_or_union): Define
new function.
* tests/data/test-read-dwarf/test-libandroid.so.abi: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This was triggered by doing:
$ fedabipkgdiff --self-compare -a --from fc37 amg4psblas-mpich
* src/abg-dwarf-reader.cc (add_or_update_class_type): Make sure
the array is big enough.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Now that we support empty symtabs test-symtab needs to be updated so
that it expects to have a corpus now, upon a binary with no exported
symbols, albeit an empty one.
* tests/test-symtab.cc (TEST_CASE("Symtab::Empty", "[symtab,
basic]")): Adjust.
(TEST_CASE("Symtab::NoDebugInfo", "[symtab, basic]")): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Some binaries can have a symbol table in which no symbol is actually
defined and exported. That binary would thus have an empty ABI
corpus.
Interestingly, Libabigail's DWARF reader is emits an error when
it encounters such binaries.
This patch adds the support for those binaries.
* src/abg-dwarf-reader.cc (reader::read_debug_info_into_corpus):
Get out early also upon having an empty symbol table.
* src/abg-elf-reader.cc (reader::read_corpus): Error out only if
there is no symbol table for the binary. If an empty symbol table
is found however, that is not an error.
* tests/data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0:
New binary test input.
* tests/data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0.abi:
New expected abixml file.
* tests/data/Makefile.am: Add the new input test files to source
distribution.
* tests/test-read-dwarf.cc (in_out_specs): Add the new test inputs
above to this test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Some packages like foo-utils.rpm can be associated with two debuginfo
RPMs: One foo-utils-debuginfo.rpm and foo-debuginfo.rpm. This is
because the foo-debuginfo.rpm contains debug info that has been
factorized out of all the sub-packages of foo, foo-utils being one of
those sub-packages. In those cases, fedabipkgdiff needs to provide
foo-debuginfo.rpm and foo-utils-debuginfo.rpm to abipkgdiff so that it
can find all the necessary debuginfo.
This patch fixes fedabipkgdiff accordingly and adds some more logging
to abipkgdiff to make it emit an explicit message for cases like this.
* tools/abipkgdiff.cc (compare_to_self): Emit an error message
when in verbose mode, for cases where we fail to find the
alternate debug info.
* tools/fedabipkgdiff (generate_comparison_halves): Always provide
all associated debuginfo packages to abipkgdiff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When an ELF symbol alias designates two different functions,
Libabigail can be confused as to which function to consider.
This confusion indirectly leads to showing spurious changes in the
return type of some functions when an ELF symbol designates more than
one function.
In other words, when an ELF symbol designates two (or more) functions,
the comparison engine needs a way to tell the two functions apart. It
needs an other way to identify the functions.
This patch fixes the confusion by using the pretty representation of
the functions in those cases.
Please note that to replicate the issue reported in this bug, here is
the command I used:
$ fedabipkgdiff --debug --self-compare -a --from fc37 smesh
* include/abg-corpus.h (corpus::lookup_functions): Return a set of
functions rather than a vector of functions where a function can
be present more than once. This allows to determine if a symbol
designates more than one function.
(corpus::exported_decls_builder::priv_): Make this public so that
some outside code can access it.
(corpus::exported_decls_builder::fn_id_maps_to_several_fns):
Declare new function.
(corpus::exported_decls_builder::maybe_add_fn_to_exported_fns):
Remove useless const here.
* include/abg-fwd.h (get_function_id_or_pretty_representation):
Declare new function.
* include/abg-ir.h
(elf_symbol::get_alias_with_default_symbol_version): Declare new
member function.
* src/abg-comparison.cc
(corpus_diff::priv::ensure_lookup_tables_populated): Use the new
get_function_id_or_pretty_representation rather than
function_decl::get_id() to identify a function.
* src/abg-corpus-priv.h (str_fn_ptr_set_map_type): Define this new
typedef of unordered_map<string, std::unordered_set<function_decl*> >.
(corpus::exported_decls_builder::priv::id_fns_map_): Change the
type of this to the new str_fn_ptr_set_map_type.
(corpus::exported_decls_builder::priv::{id_fns_map, fn_id_is_in_id_fns_map,
fn_is_in_fns, fn_is_in_id_fns_map}): Adjust to using a set of
functions rather than a vector.
(corpus::exported_decls_builder::fn_is_in_fns_by_repr): Define new
static function.
(corpus::exported_decls_builder::add_fn_to_exported): Remove
useless const.
* src/abg-corpus.cc
(corpus::exported_decls_builder::fn_id_maps_to_several_fns):
Define new function.
(corpus::exported_decls_builder::maybe_add_fn_to_exported_fns):
Remove useless const.
(corpus::lookup_functions): Return a set of functions rather than
a vector of functions where a function can be present more than
once. This allows to determine if a symbol designates more than
one function.
* src/abg-dwarf-reader.cc
(reader::symbol_already_belongs_to_a_function): Adjust.
* src/abg-fe-iface.cc (fe_iface::maybe_add_fn_to_exported_decls):
Adjust.
* src/abg-ir.cc (get_function_id_or_pretty_representation): Define
new function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When looking at something else, I configured the package with
--enable-debug-type-canonicalization and surprise, there were some
compilation errors. Fixed thus.
* src/abg-dwarf-reader.cc (reader::initialize): Use env(). rather
than environment->.
* tools/abidiff.cc (options::options): Initialize
do_debug_type_canonicalization() before use_btf.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When canceling canonical DIE propagation, we wrongly assume that the
pair of DIEs being compared yield a COMPARE_RESULT_UNKNOWN result.
The reality is that it can also yield a COMPARE_RESULT_DIFFERENT
result, especially when we are looking at the first sub-type that
compares different and that triggered the canonical DIE propagation
canceling to begin with.
This can be reproduced by the command:
$ fedabipkgdiff --self-compare -a --from fc37 xorg-x11-server-Xvfb
Fixed thus.
* src/abg-dwarf-reader.cc
(offset_pairs_stack_type::cancel_canonical_propagated_type): The
result of comparing the canonical-propagated types being canceled
is either COMPARISON_RESULT_UNKNOWN or
COMPARISON_RESULT_DIFFERENT. Also, do not forget to update the
cached value for the comparison of the depend types too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It seems the commit below (in libabigail 2.1) broke the cycle
detection during union types comparison.
commit 4bc513a8ae
Author: Dodji Seketeli <dodji@redhat.com>
Date: Thu Sep 8 19:09:33 2022 +0200
Fix IR comparison result caching and canonical type propagation tracking
This patch fixes that.
* src/abg-ir.cc (CACHE_COMPARISON_RESULT_AND_RETURN): Define new
macro.
(equals): In the overload for unions, detect cycles right
away. Also, do not use mark_types_as_being_compared and
return_comparison_result as that would indirectly call
environment::priv::unmark_as_being_compared one too many, thus
breaking the cycle detection machinery. Rather, just cache the
result of comparing the type as a class_or_union and return, using
CACHE_COMPARISON_RESULT_AND_RETURN.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When abipkgdiff is invoked on a `kernel' package,
compare_prepared_linux_kernel_packages fails to look for the `vmlinux'
file from the debuginfo package, because of a thinko.
Then, build_corpus_group_from_kernel_dist_under, also fails to find
`vmlinux' from the debuginfo package because of another thinko.
This patch fixes the two thinkos.
* src/abg-tools-utils.cc
(get_binary_paths_from_kernel_dist): Fix a thinko and really use
the kernel_modules_root variable. Look for modules under
kernel_modules_root and look for vmlinux (if necessary) under
debug_info_root. Add comments.
(compare_prepared_linux_kernel_packages): Fix another thinko. Now
we do have the path to vmlinux, from debuginfo packages before
getting into get_binary_paths_from_kernel_dist.
Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Categorizing a diff graph with a thousands of function diff nodes takes a
lot of time. At that point, categorizing each node has
harmful/harmless is showing up in the profile, particularly because
has_var_type_cv_qual_change and to a lesser extend
class_diff_has_harmless_odr_violation_change perform some structural
comparison still, oops. This patch avoids doing that. On my machine,
the categorizing of each node goes from around 130ms to 92 ms.
* src/abg-comp-filter.cc
(class_diff_has_harmless_odr_violation_change)
(has_var_type_cv_qual_change): Avoid doing structural comparison
here.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When marking leaf nodes, if interface impact analysis is not required,
then avoid visiting the same diff node twice when walking the diff
graph. Allowing to visit the same diff node twice would be useful so
that the sub-graph of each interface diff node would be walked in full
to determine the impact of each leaf diff node on each interface. But
if such impact analysis is not required, then we can just visit each
diff graph node once and speed up things greatly in leaf node
reporting mode.
* src/abg-comparison.cc (corpus_diff::mark_leaf_diff_nodes): If
impact analysis is not required, visit each node just once.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch allows to avoid applying filters on interface diff node
sub-graphs because those filters are useful for interface impact
analysis only, which is not needed in the leaf-node report, for
instance. When using the leaf-node report, this capability speeds up
corpus_diff::apply_filters_and_suppressions_before_reporting, hence
the functions like corpus_diff::{has_incompatible_changes,
has_net_subtype_changes} are sped up too.
That patch thus adds a --no-change-categorization option to abidiff to
avoid doing that change categorization (A.K.A applying filters).
* doc/manuals/abidiff.rst: Document the new
--no-change-categorization option.
* doc/manuals/kmidiff.rst: Likewise.
* include/abg-comparison.h
(diff_context::perform_change_categorization): Declare new
accessor member functions.
* src/abg-comparison-priv.h
(diff_context::priv::perform_change_categorization_): Add new data
member.
(diff_context::priv::priv): Initialize the new data member.
* src/abg-comparison.cc
(diff_context::perform_change_categorization): Define new accessor
member functions.
(corpus_diff::priv::apply_filters_and_compute_diff_stats):
Don't apply filters on the diff node sub-graphs of interfaces when
the user requested "no change categorization".
* tools/abidiff.cc (options::perform_change_categorization): New
data member.
(options::options): Initialize the new data member.
(display_usage): Add a help string for the new
--no-change-categorization.
(parse_command_line): Parse the new --no-change-categorization
option.
(set_diff_context_from_opts): Set the option on the diff context
here.
* tools/kmidiff.cc(options::perform_change_categorization): New
data member.
(options::options): Initialize the new data member.
(display_usage): Add a help string for the new
--no-change-categorization.
(parse_command_line): Parse the new --no-change-categorization
option.
(set_diff_context_from_opts): Set the option on the diff context
here.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When applying a filter to a corpus_diff node, visit each diff node
only once. This can have some serious performance impact when there
are a lot of diff nodes to visit.
* src/abg-comp-filter.cc (apply_filter): In the overload for
corpus_diff, visit each diff node only once.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Up until now, a kernel whitelist was expected to be a ini file with a
section having a name ending with the word "whitelist". Nowadays,
they are called "stablelist", so the name of the section ends up with
"stablelist". This patch makes
gen_suppr_spec_from_kernel_abi_whitelists support that.
* src/abg-tools-utils.cc
(gen_suppr_spec_from_kernel_abi_whitelists): Support section name
that ends with the word 'stablelist'.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else I felt the need for having
"abidiff --verbose" emit more timing information. I have thus added
a lot more logging around.
* include/abg-comparison.h ({diff, corpus_diff,
diff_context}::do_log): Declare member functions.
* include/abg-corpus.h (corpus::do_log): Likewise.
* src/abg-comparison-priv.h (diff_context::priv::do_log_): Add new
data member.
(diff_context::priv::priv): Initialize the new data member.
* src/abg-comparison.cc ({diff, corpus_diff,
diff_context}::do_log): Define member functions.
(diff_context::maybe_apply_filters): Add timing logs to applying
filters and propagating categories.
(corpus_diff::priv::apply_filters_and_compute_diff_stats): Add
timing logs to applying and propagating filters to changed
functions, variables, unreachable & leaf type changes,
suppressions application.
* src/abg-corpus-priv.h (corpus::priv::do_log): Add new data
member.
(corpus::priv::priv): Initialize it.
* src/abg-corpus.cc (corpus::do_log): Define member functions.
* src/abg-reader.cc (reader::do_log): Likewise.
(reader::read_corpus): Add timing log around the invocation of
perform_late_type_canonicalizing.
* tools/abidiff.cc (set_diff_context_from_opts): Set logging.
(main): Add timing logging for diff computing, changes analysis &
report generation.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch adds support for a new 'allow_type' suppression directive.
It suppresses all the changes that are NOT matched by the directive.
In other words, this directive determines the set of type changes that
are NOT suppressed. Any other change is suppressed. This thus called
a "negated suppression directive".
The way these negated suppression directives interact with the direct
suppression directives that already exist is the following.
The suppression evaluation pass visits every single diff node
(carrying a type change) of the diff graph. Negated suppressions are
evaluated first, in order of occurrence.
There are thus, two alternatives:
1/ At least one negated suppression matches the current diff node.
or
2/ No negated suppression matches the current diff node.
In case of 1/ then direct suppression specifications are
considered. There are two alternatives:
1.1/ At least one direct suppression matches the current diff node.
The diff node is suppressed: categorized as being in the
SUPPRESSED_CATEGORY category)
or
1.2/ No direct suppression matches the current diff node.
The diff node is not suppressed: categorized as being in the
HAS_ALLOWED_CHANGE_CATEGORY category.
In case of 2/ then direct suppression specifications are
considered. There are two alternatives:
2.1 At least one direct suppression matches the current diff node.
The diff node is categorized as being in the
SUPPRESSED_CATEGORY category, just like in 1.1.
2.2 No direct suppression matches the current diff node.
The diff node is not suppressed and not categorized.
As a result of the category propagation pass, a node which has a
parent node categorized as HAS_ALLOWED_CHANGE_CATEGORY is itself
categorized as HAS_PARENT_WITH_ALLOWED_CHANGE_CATEGORY. A node which
has a descendant categorized as HAS_ALLOWED_CHANGE_CATEGORY will
itself be categorized as HAS_DESCENDANT_WITH_ALLOWED_CHANGE_CATEGORY.
Nodes that are categorized as HAS_ALLOWED_CHANGE_CATEGORY,
HAS_DESCENDANT_WITH_ALLOWED_CHANGE_CATEGORY and
HAS_PARENT_WITH_ALLOWED_CHANGE_CATEGORY are not suppressed by the
reporting passes. This is needed for the reporting passes to emit the
impact sub-tree up to the diff node which carry the change that was
actually categorized as HAS_ALLOWED_CHANGE_CATEGORY.
* include/abg-comparison.h: Include abg-suppression.h
(diff, diff_context, diff_sptr, diff_context_sptr): Remove these
forward decls from here.
(enum diff_category::{HAS_ALLOWED_CHANGE_CATEGORY,
HAS_DESCENDANT_WITH_ALLOWED_CHANGE_CATEGORY,
HAS_PARENT_WITH_ALLOWED_CHANGE_CATEGORY}): Add new enumerators.
(enum diff_category::EVERYTHING_CATEGORY): Update enumerator.
(diff_context::{negated_suppressions, direct_suppressions}): Declare
new member functions.
(diff_context::suppressions): Add overload.
(diff::{is_filtered_out_without_looking_at_allowed_changes,
is_allowed_by_specific_negated_suppression,
has_descendant_allowed_by_specific_negated_suppression,
has_parent_allowed_by_specific_negated_suppression}): Declare new
member functions.
* include/abg-suppression.h (class negated_suppression_base, class
negated_type_suppression): Declare new classes.
(negated_suppression_sptr, negated_suppression_type): Define new
typedefs.
(is_negated_suppression): Declare new functions.
* src/abg-suppression.cc
(negated_suppression_base::{negated_suppression_base,
~negated_suppression_base}): Define member functions.
(negated_type_suppression::{negated_type_suppression,
suppresses_diff, ~negated_type_suppression}): Likewise.
(is_negated_suppression): Define functions.
(read_type_suppression): Allow parsing the "allow_type" directive
and instantiate a negated_type_suppression.
* src/abg-comparison-priv.h
(diff_context::priv::{negated_suppression_type_,
direct_suppressions}): Define new data members.
(diff::priv::is_filtered_out): A node categorized as
HAS_DESCENDANT_ALLOWED_BY_SPECIFIC_NEGATED_SUPPRESSION,
HAS_PARENT_ALLOWED_BY_SPECIFIC_NEGATED_SUPPRESSION and
HAS_ALLOWED_CHANGE_CATEGORY is not filtered out.
* src/abg-comparison.cc (diff_context::suppressions): Add a
non-const overload.
(diff_context::{negated,direct}_suppressions): Define new member
function.
(diff_context::add_suppression): Invalidate the cache data members
diff_context::priv::{negated,direct}_suppressions_.
(diff::is_filtered_out): A node categorized as
HAS_DESCENDANT_ALLOWED_BY_SPECIFIC_NEGATED_SUPPRESSION,
HAS_PARENT_ALLOWED_BY_SPECIFIC_NEGATED_SUPPRESSION and
HAS_ALLOWED_CHANGE_CATEGORY is not filtered out.
(diff::is_filtered_out_without_looking_at_allowed_changes): Define
new member function.
(diff::is_suppressed): If there is at least one negated
suppression that match the diff node, then it's not suppressed,
unless it's matched by a direct suppression.
(diff::{is_allowed_by_specific_negated_suppression,
has_descendant_allowed_by_specific_negated_suppression,
has_parent_allowed_by_specific_negated_suppression}): Define new
member functions.
(operator<<(ostream& o, diff_category c)): Serialize
HAS_{DESCENDANT_WITH,PARENT_WITH}_ALLOWED_CHANGE_CATEGORY
enumerators.
(category_propagation_visitor::visit_end): Do not propagate
HAS_ALLOWED_CHANGE_CATEGORY,
HAS_DESCENDANT_WITH_ALLOWED_CHANGE_CATEGORY and
HAS_PARENT_WITH_ALLOWED_CHANGE_CATEGORY categories.
(suppression_categorization_visitor::visit_begin): Categorize a
node that is not suppressed by a direct suppression and is
suppressed by a negated one as
HAS_ALLOWED_CHANGE_CATEGORY. Propagate it to descendant nodes as
HAS_PARENT_WITH_ALLOWED_CHANGE_CATEGORY ...
(suppression_categorization_visitor::visit_end): ... and to parent
node as HAS_DESCENDANT_WITH_ALLOWED_CHANGE_CATEGORY.
* src/abg-default-reporter.cc (default::reporter): In the overload
for typedef_diff, qualified_type_diff, reference_diff,
fn_parm_diff, function_type_diff, array_diff, base_diff,
function_decl_diff, report local changes only
on node that are not filtered out wrt allowed changed.
* tests/data/test-abidiff-exit/test-allow-type-array-suppr.txt:
New test input.
* tests/data/test-abidiff-exit/test-allow-type-array-v0--v1-report-{1,2}.txt:
Likewise.
* tests/data/test-abidiff-exit/test-allow-type-array-v0--v2-report-{1,2}.txt:
Likewise.
* tests/data/test-abidiff-exit/test-allow-type-array-v0--v3-report-{1,2}.txt:
Likewise.
* tests/data/test-abidiff-exit/test-allow-type-array-v{0,1,2,3}.c:
Source code of new binary test inputs.
* tests/data/test-abidiff-exit/test-allow-type-array-v{0,1,2,3}.o:
New binary test inputs.
* tests/data/test-abidiff-exit/test-allow-type-region-suppr.txt:
New test input.
* tests/data/test-abidiff-exit/test-allow-type-region-v0--v1-report-{1,2}.txt:
* tests/data/test-abidiff-exit/test-allow-type-region-v0--v2-report-{1,2}.txt:
Likewise.
* tests/data/test-abidiff-exit/test-allow-type-region-v0--v3-report-{1,2}.txt:
Likewise.
* tests/data/test-abidiff-exit/test-allow-type-region-v0--v4-report-{1,2}.txt:
Likewise.
* tests/data/test-abidiff-exit/test-allow-type-region-v0--v5-report-{1,2}.txt:
Likewise.
* tests/data/test-abidiff-exit/test-allow-type-region-v{0,1,2,3,4,5}.c:
Source code of new binary test input.
* tests/data/test-abidiff-exit/test-allow-type-region-v{0,1,2,3,4,5}.o:
New binary test inputs.
* tests/data/test-abidiff-exit/test-allow-type-suppr{1,2}.txt: New
test inputs.
* tests/data/Makefile.am: Add the new testing files above to
source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This patch adds support for two data member offset selector
expressions for properties of the [suppress_type] directive:
offset_of_first_data_member_regexp() and offset_of_last_data_member_regexp().
These function-call expressions take a regular expression argument and
evaluate to the offset of the first (resp. last) data member matching
the regular expression argument.
An example of their use would be be:
[suppress_type]
type_kind = struct
has_data_member_inserted_between =
{
offset_of_first_data_member_regexp(^__special_padding_space),
offset_of_last_data_member_regexp(^__special_padding_space)
}
This would be useful to suppress change reports involving a struct
which has "padding" data members added on-purpose like:
struct S
{
int member0;
char member1;
unsigned __special_padding_space1;
unsigned __special_padding_space2;
unsigned __special_padding_space3;
};
* doc/manuals/libabigail-concepts.rst: Document the new
properties.
* include/abg-fwd.h: Forward declare comparison::{diff_context,
diff_context_sptr, diff_context_wptr, diff, diff_wptr} and
regex::regex_t_sptr.
(find_first_data_member_matching_regexp)
(find_last_data_member_matching_regexp): Declare new functions.
* include/abg-suppression.h: Inject std::{string, shared_ptr,
vector} and comparison::{diff, diff_context_sptr} into the suppr
namespace. Remove the "abg-comparison.h" header.
* src/abg-elf-helpers.cc: Include sstream.
* src/abg-ir.cc (find_first_data_member_matching_regexp)
(find_last_data_member_matching_regexp): Define new functions.
* src/abg-suppression.cc
(type_suppression::insertion_range::eval_boundary): Support
evaluating "offset_of_first_data_member_regexp" and
"offset_of_first_data_member_regexp".
* src/abg-ctf-reader.cc: Include sstream.
* tests/data/test-diff-suppr/test-has-data-member-inserted-between-1-report-[1-4].txt:
New test reference outputs.
* tests/data/test-diff-suppr/test-has-data-member-inserted-between-1-v[0-4].c:
Source code of new test input.
* tests/data/test-diff-suppr/test-has-data-member-inserted-between-1-v[0-4].o:
New binary test input.
* tests/data/test-diff-suppr/test-has-data-member-inserted-between-1.suppr:
New suppression specification.
* tests/data/Makefile.am: Add the new test input files to source
distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
to this test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The "has_data_member_inserted_between" and
"has_data_members_inserted_between" properties of the [suppress_type]
directive allows the suppression of type changes when a data member is
inserted in a given range. It turns out that suppressing type changes
that incur a change in the size of the type might not be what the user
wants by default, because the type size in itself might actually be an
incompatible ABI change that would then fly under the radar because of
this suppression specification.
An arguably better default behavior in this case would be to NOT
suppress the type change if the data member insertion does incur a
change in the size of the type.
But then, there would be cases where the user would really want to
suppress the type change due to data member insertion in a given range
even if it incurs a change in the type size. This is where this patch
enters into play.
The patch introduces the "has_size_change" property of the
[suppress_type] directive. In the presence of
"has_data_members_inserted_between" or
"has_data_member_inserted_between" properties, if the
"has_size_change" property is set to "yes", then the type change would
be suppressed if data members are inserted in the given range even if
the insertion incurs a type size change.
Otherwise, with this patch, in the absence of the "has_size_change"
property, the "has_data_member_inserted_between" and
"has_data_members_inserted_between" properties won't trigger the type
change suppression if the data member insertion incurs a type size
change.
* doc/manuals/libabigail-concepts.rst: Document the new
has_size_change property.
* include/abg-suppression.h
(type_suppression::{g,s}et_has_size_change): Declare new accessors.
* src/abg-suppression-priv.h
(type_suppression::priv::has_size_change_): Define new data
member.
(type_suppression::priv::priv): Initialize the new data member.
* src/abg-suppression.cc
(type_suppression::{g,s}et_has_size_change): Define new accessors.
(type_suppression::suppresses_diff): Make the
has_data_member_inserted_* clauses have effect only if the class
size hasn't changed, unless the class has as the "has_size_change"
property. Also, allow members to be deleted in the right
insertion range if the resulting size stays the same or if the
has_size_change property is present. This allows some custom
behaviours where "padding" data members would be removed while
some new data members would be added, resulting in a type which
size would not change.
(read_type_suppression): Support parsing the "has_size_change"
property.
* tests/data/test-diff-suppr/test11-add-data-member-0.1.suppr: New
test suppression specification.
* tests/data/test-diff-suppr/test11-add-data-member-1.1.suppr:
Likewise.
* tests/data/test-diff-suppr/test11-add-data-member-2.1.suppr:
Likewise.
* tests/data/test-diff-suppr/test11-add-data-member-3.1.suppr:
Likewise.
* tests/data/test-diff-suppr/test11-add-data-member-4.1.suppr:
Likewise.
* tests/data/test-diff-suppr/test11-add-data-member-report-1.1.txt:
Likewise.
* tests/data/test-diff-suppr/test12-add-data-member-0.1.suppr:
Likewise.
* tests/data/test-diff-suppr/test12-add-data-member-report-1.1.txt:
New test reference output.
* tests/data/test-diff-suppr/test13-suppr-through-pointer-0.1.suppr:
New test suppression specification.
* tests/data/test-diff-suppr/test13-suppr-through-pointer-report-1.1.txt:
New test reference output.
* tests/data/test-diff-suppr/test35-leaf-report-0.1.txt: Likewise.
* tests/data/test-diff-suppr/test35-leaf.1.suppr: New test
suppression specification.
* tests/data/Makefile.am: Add the new testing material to source
distribution.
* tests/data/test-diff-suppr/test11-add-data-member-1.suppr: Add
the has_size_change property to explicitly allow suppressing type
changes involving data member insertion even when the type size
changes.
* tests/data/test-diff-suppr/test11-add-data-member-0.suppr:
Likewise.
* tests/data/test-diff-suppr/test11-add-data-member-2.suppr:
Likewise.
* tests/data/test-diff-suppr/test11-add-data-member-3.suppr:
Likewise.
* tests/data/test-diff-suppr/test11-add-data-member-4.suppr:
Likewise.
* tests/data/test-diff-suppr/test12-add-data-member-0.suppr:
Likewise.
* tests/data/test-diff-suppr/test13-suppr-through-pointer-0.suppr:
Likewise.
* tests/data/test-diff-suppr/test35-leaf.suppr: Likewise.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
to the test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In preparation of subsequent changes, this patch factorizes a function
is_data_member_offset_in_range() out of
type_suppression::suppression(). This is useful to determine if a
data member offset is within an "offset range" expressed by the
type_suppression::insertion_range type.
This function is useful to implement the
offset_of_first_data_member_regexp and
offset_of_last_data_member_regexp properties to come in subsequent
patches.
Please note that is_data_member_offset_in_range works on data members
of unions and classes, not just on classes like what the original code
of inside type_suppression::suppresses_diff was doing.
This patch should not have any functional impact on the code.
* include/abg-fwd.h (get_last_data_member)
(get_next_data_member_offset): Declare functions.
* src/abg-ir.cc (get_next_data_member): Add an overload for
class_or_union and write the overload for class_or_union_sptr in
term of the former.
(get_last_data_member): Add overloads form class_or_union& and
class_or_union*. Write the overload for class_or_union_sptr in
terms of the one for class_or_union*.
(get_next_data_member_offset): Add an overload for
class_or_union* and write the overload for class_or_union_sptr in
terms of the former.
* include/abg-suppression.h
(type_suppression::insertion_range::eval_boundary): Take a
class_or_union* for the context, as opposed to a class_decl_sptr.
This makes this static function work for unions as well.
(is_data_member_offset_in_range): Declare new function.
* src/abg-suppression.cc (type_suppression::suppression_diff):
Factorize ...
(is_data_member_offset_in_range): ... this function out.
(type_suppression::insertion_range::eval_boundary): Adjust this to
make it take a class_or_union* rather than a class_decl_sptr.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In the [supress_type] directive, this patch adds support for two new
properties:
* has_data_data_member = {foo, bar, blah}
Suppresses change reports involving a type which has data members
with names specified by the value of this property.
* has_data_member_regexp = some-regexp
Suppresses change reports involving a type which has data members
with names specified by the regular expression given as a value of
this property.
* include/abg-fwd.h (string_set_type): Define new typedef.
* src/abg-suppression-priv.h
* include/abg-suppression.h
(type_suppression::{get,set}_potential_data_member_names[_regex_str]):
Declare new data member.
(type_suppression::priv::{potential_data_members_,
potential_data_members_regex_str_,
potential_data_members_regex_}): Define new data members.
(type_suppression::priv::{get,set}_potential_data_member_names_regex):
Define new member functions.
* src/abg-suppression.cc
(type_suppression::{get,set}_potential_data_member_names): Define new
member functions.
(type_suppression::{get,set}_potential_data_member_names_regex_str):
Likewise.
(type_suppression::suppresses_diff): Implement suppression using
the new "has_data_member" and "has_data_member_regexp" properties.
(read_type_suppression): Support parsing the new "has_data_member"
and "has_data_member_regexp" properties of the type suppression
directive.
* tests/data/test-diff-suppr/has-data-member-[1-7].suppr: New
suppression specifications for test purposes.
* tests/data/test-diff-suppr/test-has-data-member-output-{1,2}.txt:
New reference test outputs.
* tests/data/test-diff-suppr/test-has-data-member-v{0,1}.cc:
Source code of new input binary tests.
* tests/data/test-diff-suppr/test-has-data-member-v{0,1}.o: New
binary test inputs.
* tests/data/Makefile.am: Add the test inputs below to source
distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test inputs
above to this test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, I came across an issue in
read_context::read_list_property_value. This function requires
elements of a list property value (separated by a comma) to be on a
single line, for instance. This is because the code forgets to parse
white spaces after the comma.
Fixed thus.
* src/abg-ini.cc (read_context::read_list_property_value): Expect
white spaces after the comma.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Using abipkgdiff to analyze kABIs from Oracle Linux packages with CTF
debug format, abipkgdiff is not able to identify kernel packages
because the naming of OL kernel packages differs from the naming used
on other RPM-based distributions.
As abipkgdiff fails to see that it's looking at a Linux kernel
package, the binaries are analyzed as user space binaries and that is
not what we want.
This patch addresses the issue by looking for the "vmlinuz" binary
inside the package to determine that it's a kernel package. In other
words, tools_utils::file_is_kernel_package is changed to look for
"vmlinuz" inside the package, rather than look for a particular
pattern in the package name of the package.
Additionally, when the kernel package contains CTF debug information,
the `vmlinux.ctfa' file is not necessarily shipped the debuginfo
package. This patch thus adjusts the search path of that file in that
case.
* include/abg-tools-utils.h (rpm_contains_file): Declare new
function.
* src/abg-ctf-reader.cc (ctf::reader::find_ctfa_file): Use
`find_file_under_dir' utility function to locate `vmlinux.ctfa'
file.
(ctf::reader::process_ctf_archive): Adjust dictionary name
according to module name, removing characters after dot.
* src/abg-tools-utils.cc (file_has_ctf_debug_info): Use
`find_file_under_dir' utility function to locate `vmlinux.ctfa'
file.
(rpm_contains_file): Define new function.
(file_is_kernel_package): Use the new `rpm_contains_file' to look
for the `vmlinuz' file inside the RPM package. For Debian
packages however, we don't keep looking at the naming pattern as
we don't yet have a deb_contains_file function. Also, this
function now takes the full path to the RPM.
(build_corpus_group_from_kernel_dist_under): for CTF, add the
`root' directory of the extracted package to the set of
directories under which we should look for debug info.
* tools/abipkgdiff.cc (maybe_handle_kabi_whitelist_pkg)
(create_maps_of_package_content, compare_prepared_package, main):
Adjust call to file_is_kernel_package as it now takes the full
path to the package.
Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When given linux kernel packages to analyze using DWARF, the tool
expects the (uncompressed) vmlinux binary to be found in the debug
info package.
This patch emits an error message when no vmlinux binary is found in
the debug info package in that case.
* tools/abipkgdiff.cc (compare_prepared_linux_kernel_packages):
When no vmlinux binary is found in the debug info package, emit an
error message.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When invoked with --verbose, abipkgdiff emits some logs that could use
better clarity. Fixed thus.
* tools/abipkgdiff.cc (package::erase_extraction_directory): Say
explicitly what's DONE.
(extract_rpm): Add newline to log. Say explicitly what's DONE on
which package.
(extract_deb, extract_tar)
(erase_created_temporary_directories_parent, compare_to_self)
(create_maps_of_package_content): Say explicitly what's DONE on
which package.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The interface has changed in an incompatible way since the last
release as the vtable of fe_iface has changed in an incompatible, at
very least. So bump the LIBABIGAIL_SO_CURRENT version number to
reflect that.
* configure.ac: Bump LIBABIGAIL_SO_CURRENT to 2.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
A qualified type is textually represented as the following:
<qualifier> <underlying-type>
were "qualifier" is the qualifier carried by the qualified type and
"underlying-type" is the type being qualified.
In this case, the qualifier prefixes the textual representation of the
qualified type.
This is true if the underlying type of the qualified type is a
non-const, non-reference type. For instance:
const int;
But when the underlying type is a pointer, then the qualified type is
represented as:
int* const;
In that later case, the qualifier comes /after/ the textual
representation of the underlying type.
Now suppose the underlying type is itself a qualified type. In that
case, for a non-const underlying type, we'd have, e.g:
const volatile int;
where the qualifier precedes the qualified type (which is itself a
qualified type) /IF/ the ultimate underlying type (a.k.a the leaf
underlying type) is itself a non-const, non-reference type.
But if the ultimate underlying type is a pointer, a qualified type
with an underlying qualified type would be textually represented as,
e.g:
int* const volatile;
In other words, if the leaf type is a pointer, the qualifier suffixes
the textual representation the underlying qualified type.
Libabigail is failing to apply this later rule.
As the type name is used as a key to cache IR nodes of DIEs (among
other things), getting it wrong can lead to a bumpy ride down the
road.
Fixed thus.
* src/abg-dwarf-reader.cc
(die_is_pointer_array_or_reference_type): Rename
die_is_pointer_or_reference_type into this. This new name
reflects more what the function does as it tests if a DIE is for
pointer, an array or a reference.
(pointer_or_qual_die_of_anonymous_class_type): Adjust to use the
newly (and better) named die_is_pointer_array_or_reference_type.
(die_is_pointer_or_reference_type): Make this really test if a DIE
is for a pointer or a reference. Now the name matches what the
function does.
(die_peel_qualified): Define new function.
(die_qualified_type_name): When a qualified name Q has another
qualified name as its underlying type, it's important to know if
the leaf type is a pointer type or not to know how to construct
the name of Q. This change now peels the potential qualifiers
from the underlying type of the qualified type to see if the leaf
type is a pointer or not.
* src/abg-ir.cc (get_name_of_qualified_type): Likewise. Also, the
name of array types doesn't follow the same rule as for pointers
and references.
* tests/data/test-abidiff-exit/PR30048-test-report-0.txt: Add new
reference test output.
* tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt:
Likewise.
* tests/data/test-abidiff-exit/PR30048-test-v{0,1}.c: Add source
code of binary input data.
* tests/data/test-abidiff-exit/PR30048-test-2-v{0,1}.cc: Likewise.
* tests/data/test-abidiff-exit/PR30048-test-v{0,1}.o: Add binary
input data.
* tests/data/test-abidiff-exit/PR30048-test-2-v{0,1}.o: Likewise.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-abidiff-exit.cc (in_out_specs): Add the input
binaries to this test harness.
* tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It's been brought to my attention on IRC that running
abidw --linux-tree <kernel-build-tree>
would result in a corpus group that duplicates every single corpus in
the resulting abixml. Oops.
This is because both dwarf::reader::read_corpus() and
elf_based_reader::read_and_add_corpus_to_group() add the corpus to the
corpus_group, and yet, the later function calls the former. So the
corpus is added to the corpus_group twice.
This patch ensures that
elf_based_reader::read_and_add_corpus_to_group() is the only one to
add the corpus to the group. It also ensures that this happens before
the corpus is constructed from the debug info because that is useful
for sharing types among the various corpora. Otherwise, those types
are potentially duplicated in the IR of each corpus.
The patch also ensures the abixml writer enforces the fact that each
corpus is emitted only once.
* src/abg-dwarf-reader.cc (reader::read_debug_info_into_corpus):
Do not add the corpus to the group here ...
* src/abg-elf-based-reader.cc
(elf_based_reader::read_and_add_corpus_to_group): ... because it's
already added here. But then, let's add it here /before/ reading
type & symbols information into the corpus.
* src/abg-writer.cc (write_context::m_emitted_corpora_set): Add
new data member.
(write_context::{corpus_is_emitted, record_corpus_as_emitted}):
Define new member functions.
(write_corpus): Invoke the new
write_context::record_corpus_as_emitted here.
(write_corpus_group): Ensure that each corpus is emitted only
once.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>