mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-18 23:07:00 +00:00
8cfd264224
533 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
|
8cfd264224 |
diff-utils: point: fix postfix decrement/increment operator
The postfix increment / decrement operators were implemented by calling themselves recursively. Fix that by implementing these in terms of their prefix counter parts. * include/abg-diff-utils.h: fix postfix dec/inc operator Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
87bbc09b9e |
abg-fwd.h: fix mismatched tags for ir_node_visitor
ir_node_visitor is defined as `class` in include/abg-ir.h:4429 and should therefore also be forward-declared as such. * include/abg-fwd.h: forward-declare ir_node_visitor as class Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
286cadf841 |
Bug 24430 - Fold away const for array types
In C and C++ the qualifiers of a qualified array type apply to the element type of said array. In this particular problem report, GCC and Clang emit DWARF that represent the qualifiers either on the array type, or on the element type. Quoting the test of the bug: Given the following example: struct test { const char asdf[4]; }; void func(struct test arg) {} abidiff says: 1 function with some indirect sub-type change: [C]'function void func(test)' at test.c:5:1 has some indirect sub-type changes: parameter 1 of type 'struct test' has sub-type changes: type size hasn't changed 1 data member change: type of 'const char test::asdf[4]' changed: entity changed from 'const char[4]' to 'const char[4] const' This is because GCC represents the array as const array of const signed char, whereas clang represents it as an array of const signed char. In this patch, libabigail's DWARF reader detects qualified array types and appropriately qualifies the array element type, instead of qualifying the array type. The patch accordingly adjusts the various regression tests and adds a new test which comes from the problem report. * include/abg-fwd.h (is_array_of_qualified_element): Declare 2 overloads of this function. (re_canonicalize): Declare a new function. * include/abg-ir.h (class {decl_base, type_base}): Declare re_canonicalize as a friend of these classes. * src/abg-dwarf-reader.cc (maybe_strip_qualification): Detect qualified array types and appropriately qualifies the array element type, instead of qualifying the array type itself. Re-canonicalize the resulting type if necessary. * src/abg-ir.cc (is_array_of_qualified_element): Define 2 overloads of this function. (re_canonicalize): Define new function. * tests/data/Makefile.am: The two new test binary input files PR24430-fold-qualified-array-clang and PR24430-fold-qualified-array-gcc to source distribution, as well as the expected reference output. * tests/data/test-annotate/test15-pr18892.so.abi: Adjust. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-diff-filter/PR24430-fold-qualified-array-clang: New binary test input coming from the bug report. * tests/data/test-diff-filter/PR24430-fold-qualified-array-gcc: Likewise. * tests/data/test-diff-filter/PR24430-fold-qualified-array-report-0.txt: Expected reference abi difference. * tests/data/test-diff-filter/test33-report-0.txt: Adjust. * tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.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/test19-pr19023-libtcmalloc_and_profiler.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/test-diff-filter.cc: Add the new binary test input to this test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
f85dd789c2 |
Add missing assignment operators
This was detected by compiling with GCC 9.0.1 * include/abg-interned-str.h (interned_string::operator=): Define assignment operator. * include/abg-ir.h ({location, enum_type_decl::enumerator}::operator=): Declare assignment operator. * src/abg-ir.cc (enum_type_decl::enumerator::operator=): Define assignment operator. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
782c3d8c42 |
Add ir::{lookup_data_member, get_function_parameter}
While looking at something else, I figured it's useful, for debugging purposes, to be able to lookup a given data member of a union/class by name, as well as a function parameter by index. This patch adds both. * include/abg-ir.h (lookup_data_member, get_function_parameter): Declare new functions. * src/abg-ir.cc (lookup_data_member, get_function_parameter): Define them. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
0036d0448e |
Better detection of void* to something* change
Whenever a void* pointer changes to a T* pointer, we already consider that change to be ABI-compatible. The issue though is that we don't detect the case of foo* changing into T* where foo is typedef void foo. This patch fixes that. * include/abg-ir.h (is_void_type): Add a new overload that takes type_base*. * src/abg-ir.cc (is_void_type): Define the new overload that takes type_base*. (is_void_pointer_type): Look through typedefs in the pointed-to type. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
e9c66d2d75 |
Avoid over-suppressing fns & vars when analysing the Kernel
When analyzing the Linux Kernel (with e.g abidw) and providing a symbol whitelist the DWARF reader performs a speed optimization which is that it does not read the symbol table of the kernel binary. To know if a function is to be suppressed (because it doesn't belong to the whitelist, for instance) dwarf_reader::function_is_suppressed actually tries to see if the address of the function corresponds to the address of an ELF symbol that is publicly exported, before looking at if the function was suppressed by a suppression specification. But then, when a whitelist is provided and the speed optimization of not reading the symbol table is at play, there is no information about ELF symbol addressed around. So dwarf_reader::function_is_suppressed almost always supposes that the function is suppressed. This patch fixes that by not trying to look at the address of the function/variable when the symbol table optimization is on. * include/abg-dwarf-reader.h (get_ignore_symbol_table): Take a const read_context&. * src/abg-dwarf-reader.cc (get_ignore_symbol_table): Likewise. (function_is_suppressed): When the symbol table optimization is in flight -- that is, when no symbol table has been loaded -- do not try to see if a given function symbol was exported at the ELF level or not. Just look at if the function was suppressed or not. (variable_is_suppressed): Likewise for variables. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
84ec784743 |
Bug 24157 - Wrong support of Ada ranges
In this problem report, the DWARF reader comes across an ADA subrange which lower bound is a negative signed integer. The problem is that the internal representation of libabigail expects the bounds of the subrange to be unsigned integer. This incompatibility leads to an assertion failure. Further down the road I realized that the function types_have_similar_structure doesn't support subrange types. This patch thus introduces a new array_type_def::subrange_type::bound_value class that captures the signedness of the bound value. This allows the internal representation to keep the sign information of the bound value, and yet be able to treat the bound value as either a signed or unsigned value depending on the contexts. The patch also extends the function types_have_similar_structure to make it support subrange types. * include/abg-ir.h (array_type_def::subrange_type::bound_value): Define new class. (array_type_def::subrange_type::subrange_type): Adjust to use the new bound_value type for bound values. (array_type_def::subrange_type::{get_upper_bound, get_lower_bound, set_upper_bound, set_lower_bound}): Return or take int64_t rather than size_t. (array_type_def::subrange_type::get_length): Return uint64_t rather than size_t. * src/abg-dwarf-reader.cc (die_signed_constant_attribute) (die_constant_attribute, die_attribute_has_form) (die_attribute_is_signed, die_attribute_is_unsigned) (die_attribute_has_no_signedness): Define new static functions. (get_default_array_lower_bound): Return uint64_t rather than int. (build_subrange_type): Use the new array_type_def::subrange_type::bound_value type for bound values. Use the new die_constant_attribute function, rather than die_unsigned_constant_attribute to fecth the bound values. * src/abg-ir.cc (array_type_def::subrange_type::bound_value::{bound_value, get_signedness, set_signedness, get_signed_value, get_unsigned_value, set_unsigned, set_signed}): Define new member functions. (array_type_def::subrange_type::priv::{lower_bound_, upper_bound}): Use the new class bound_value. (array_type_def::subrange_type::priv::priv): Adjust to use the new bound_value class to hold bound values. (array_type_def::subrange_type::subrange_type): Likewise. (array_type_def::subrange_type::{get_upper_bound, get_lower_bound, set_upper_bound, set_lower_bound}): Return or take int64_t rather than size_t. (array_type_def::subrange_type::get_length): Return uint64_t rather than size_t. (types_have_similar_structure): Handle array_type_def::subrange_type * src/abg-reader.cc (build_subrange_type): Use the new array_type_def::subrange_type::bound_value to hold bound values. * tests/data/test-diff-pkg/GtkAda-debuginfo-2.24.2-29.fc29.x86_64.rpm: New binary RPM as test input. * tests/data/test-diff-pkg/GtkAda-debuginfo-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-devel-2.24.2-29.fc29.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-devel-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt: New expected test output. * tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64.rpm: New binary RPM as test input. * tests/data/test-diff-pkg/GtkAda-gl-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-29.fc29.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the new input testing RPMs in here. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
3826ab5308 |
Bug 24139 - Support suppressing some enumerator changes
This patch teaches the suppression specification subsystem how to ignore changes of some enumerators in particular. The patch adds a new property to the [suppress_type] section which is: changed_enumerators = enumerator1, enumerator2, etc This property is taken into accound iff the current suppress_type does have the 'type_kind = enum' property. Changes to enum types that match the new 'changed_enumerators' property are suppressed. * doc/manuals/libabigail-concepts.rst: Document the new 'changed_enumerators' property. * include/abg-suppression.h (type_suppression::{g, s}et_changed_enumerator_names): Declare two new member functions. * src/abg-suppression-priv.h (type_suppression::priv::changed_enumerator_names_): Add a new data member. * src/abg-suppression.cc (type_suppression::{g,s}et_changed_enumerator_names): Define two new member functions. (type_suppression::suppresses_diff): Support evaluating the new 'changed_enumerators = <vector of changed enumerators>'. (read_type_suppression): Read the new list property'changed_enumerators" and store it into the type_suppression using the new type_suppression::set_changed_enumerator_names (). * tests/data/test-diff-suppr/libtest4{0,1}-enumerator-changes-v{0,1}.so: Add new test inpujts. * tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-0.suppr: Add a new suppr spec for this new test. * tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-report-0.txt: The default report. * tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-v{0,1}.cc: Add Source code of libtest4{0,1}-enumerator-changes-v{0,1}.so. * tests/data/Makefile.am: Add the test files above to source distribution. * tests/test-diff-suppr.cc: Add the test input files above to the harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
52369923ac |
Better comments in the comparison engine
* include/abg-comparison.h (enum diff_category): Add comments to describe what to update when a new enumerator is added to this enum. * src/abg-comp-filter.cc (has_fn_return_type_cv_qual_change): Fix comment thinko here. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
7d639aef70 |
Bug 20175 - Classify CV qual changes in variable type as harmless
When the type of a variable changes and that change is only a CV qual change, we want libabigail to automatically classify that change as being harmless. This patch thus introduces a new VAR_TYPE_CV_CHANGE_CATEGORY change category (enumerator of the abigail::comparison::diff_category enum) for this kind of changes and classifies that category as being harmless. The patch then detects diff nodes that carry CV qualifiers change on variable types and flags them as belonging to the new VAR_TYPE_CV_CHANGE_CATEGORY. * include/abg-comparison.h (VAR_TYPE_CV_CHANGE_CATEGORY): Add new enumerator to diff_category enum. (EVERYTHING_CATEGORY): Update this enumerator. * src/abg-comp-filter.cc (type_diff_has_cv_qual_change_only): Support array diff nodes carrying a cv qual change on the element type. (has_var_type_cv_qual_change): Define new static function. (categorize_harmless_diff_node): Use the new has_var_type_cv_qual_change to categorize variable diff node with cv qual change on its type as harmless. * src/abg-comparison.cc (get_default_harmless_categories_bitmap): Update this. (operator<<(ostream& o, diff_category c)): Likewise. * include/abg-ir.h (equals_modulo_cv_qualifier): Declare new ... * src/abg-ir.cc (equals_modulo_cv_qualifier): ... function. * 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: Update expected test output. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise. * tests/data/Makefile.am: Add the new test material below to source distribution. * tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt: New expecte test output. * tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64.rpm: New test input. * tests/data/test-diff-pkg/nss-3.24.0-1.0.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/nss-debuginfo-3.23.0-1.0.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/nss-debuginfo-3.24.0-1.0.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/nss-devel-3.23.0-1.0.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/nss-devel-3.24.0-1.0.fc23.x86_64.rpm: Likewise. * tests/test-diff-pkg.cc (in_out_specs): Add the test input above to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
2366dca947 |
Conditionalize the use of DW_LANG_C_plus_plus_03 and DW_LANG_Rust
Older elfutils (pre-0.170) don't define these constants in dwarf.h so don't use them in that case. * include/abg-ir.h (LANG_C_plus_plus_03): Add this new language enum to "enum translation_unit::language". * src/abg-dwarf-reader.cc (dwarf_language_to_tu_language): Do not use DW_LANG_Rust or DW_LANG_C_plus_plus_03 if these are not defined. (get_default_array_lower_bound): Handle the new translation_unit::LANG_C_plus_plus_03 enumerator. Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
70f7c63a76 |
Add (very) basic support for Rust
I tested this on the binaries generated from this project: https://gitlab.gnome.org/federico/abi-rust and I got this: $ tools/abidiff libone.so libtwo.so Functions changes summary: 0 Removed, 1 Changed, 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 1 function with some indirect sub-type change: [C]'function one::Foo one::foo(u32)' at lib.rs:8:1 has some indirect sub-type changes: 'function one::Foo one::foo(u32) {foo}' now becomes 'function two::Foo two::foo(u32, u32) {foo}' return type changed: type name changed from 'one::Foo' to 'two::Foo' type size changed from 32 to 64 (in bits) 1 data member insertion: 'u32 two::Foo::b', at offset 32 (in bits) no data member change (1 filtered); parameter 2 of type 'u32' was added * include/abg-ir.h (LANG_Rust): Add this new enumerator to the "enum language" enum. * src/abg-dwarf-reader.cc (dwarf_language_to_tu_language): Handle the Rust language. (get_default_array_lower_bound): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
717fd0a460 |
Separate public types of first binary from those of the second
In abidiff when the user uses --headers-dir{1,2}, she implicitly indicates the public types of the first and the second binary. That means that any type that is defined in a file that is not located under the directory tree designated by --headers-dir{1,2} is considered private and any change involving those private types will be suppressed. In practice, what happens is that libabigail constructs a suppression specification which suppress all types that are defined in files that are not under the directories located by --headers-dir{1,2}. abidiff has a problem, though. It uses the same private type suppressions (derived from --headers-dir1 and --headers-dir2) when looking at the first binary *and* the second binary. It should rather only use the private type suppression specifications derived from --headers-dir1 when looking at the first binary, and use the private type suppression specifications derived from --headers-dir2 when looking at the second binary. This problem leads to some false positives like the one reported at https://gitlab.gnome.org/GNOME/pango/issues/343#note_397761. This patch fixes this issue by using the private type suppression specifications derived from --headers-dir1 only when looking at the first binary, and using the private type suppression specifications derived from --headers-dir2 only when looking at the second binary. * include/abg-dwarf-reader.h (read_context_get_path): Declare new function. * include/abg-reader.h (read_context_get_path): Likewise. * src/abg-dwarf-reader.cc (read_context_get_path): Define new function. * src/abg-reader.cc (read_context_get_path): Likewise. * tools/abidiff.cc (set_suppressions): Set the suppression specification derived from the --headers-dir1 option only for the first binary, and similarly, from the --headers-dir2 option only for the second binary. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
ad8732316a |
Bug 23044 - Assertions with side effects
There are lots of spots in libabigail's source code where the argument of the assert() call does have side effects. This is a problem because when the code is compiled with the NDEBUG macro defined, the assert call does nothing, so the side effects of its argument are then suppressed, changing the behaviour of the program. To handle this issue, this patch introduces the ABG_ASSERT macro which is a wrapper around the assert call that enable the use of side effects in its argument. The patch now uses that ABG_ASSERT macro instead of using the assert call directly. The patch also makes it so that the configure option accepts the --disable-assert option so that the user can build libabigail with the NDEBUG macro defined. Tested by running the testsuite with and without the --disable-assert option to configure. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
047342467c |
Update copyright for 2019
* include/abg-comp-filter.h: Update copyright for 2019 * include/abg-comparison.h: Update copyright for 2019 * include/abg-config.h: Update copyright for 2019 * include/abg-corpus.h: Update copyright for 2019 * include/abg-diff-utils.h: Update copyright for 2019 * include/abg-dwarf-reader.h: Update copyright for 2019 * include/abg-fwd.h: Update copyright for 2019 * include/abg-hash.h: Update copyright for 2019 * include/abg-ini.h: Update copyright for 2019 * include/abg-interned-str.h: Update copyright for 2019 * include/abg-ir.h: Update copyright for 2019 * include/abg-libxml-utils.h: Update copyright for 2019 * include/abg-libzip-utils.h: Update copyright for 2019 * include/abg-reader.h: Update copyright for 2019 * include/abg-reporter.h: Update copyright for 2019 * include/abg-sptr-utils.h: Update copyright for 2019 * include/abg-suppression.h: Update copyright for 2019 * include/abg-tools-utils.h: Update copyright for 2019 * include/abg-traverse.h: Update copyright for 2019 * include/abg-viz-common.h: Update copyright for 2019 * include/abg-viz-dot.h: Update copyright for 2019 * include/abg-viz-svg.h: Update copyright for 2019 * include/abg-workers.h: Update copyright for 2019 * include/abg-writer.h: Update copyright for 2019 * src/abg-comp-filter.cc: Update copyright for 2019 * src/abg-comparison-priv.h: Update copyright for 2019 * src/abg-comparison.cc: Update copyright for 2019 * src/abg-config.cc: Update copyright for 2019 * src/abg-corpus-priv.h: Update copyright for 2019 * src/abg-corpus.cc: Update copyright for 2019 * src/abg-default-reporter.cc: Update copyright for 2019 * src/abg-diff-utils.cc: Update copyright for 2019 * src/abg-dwarf-reader.cc: Update copyright for 2019 * src/abg-hash.cc: Update copyright for 2019 * src/abg-ini.cc: Update copyright for 2019 * src/abg-internal.h: Update copyright for 2019 * src/abg-ir-priv.h: Update copyright for 2019 * src/abg-ir.cc: Update copyright for 2019 * src/abg-leaf-reporter.cc: Update copyright for 2019 * src/abg-libxml-utils.cc: Update copyright for 2019 * src/abg-libzip-utils.cc: Update copyright for 2019 * src/abg-reader.cc: Update copyright for 2019 * src/abg-reporter-priv.cc: Update copyright for 2019 * src/abg-reporter-priv.h: Update copyright for 2019 * src/abg-sptr-utils.cc: Update copyright for 2019 * src/abg-suppression-priv.h: Update copyright for 2019 * src/abg-suppression.cc: Update copyright for 2019 * src/abg-tools-utils.cc: Update copyright for 2019 * src/abg-traverse.cc: Update copyright for 2019 * src/abg-viz-common.cc: Update copyright for 2019 * src/abg-viz-dot.cc: Update copyright for 2019 * src/abg-viz-svg.cc: Update copyright for 2019 * src/abg-workers.cc: Update copyright for 2019 * src/abg-writer.cc: Update copyright for 2019 * tests/print-diff-tree.cc: Update copyright for 2019 * tests/test-abicompat.cc: Update copyright for 2019 * tests/test-abidiff-exit.cc: Update copyright for 2019 * tests/test-abidiff.cc: Update copyright for 2019 * tests/test-alt-dwarf-file.cc: Update copyright for 2019 * tests/test-core-diff.cc: Update copyright for 2019 * tests/test-diff-dwarf-abixml.cc: Update copyright for 2019 * tests/test-diff-dwarf.cc: Update copyright for 2019 * tests/test-diff-filter.cc: Update copyright for 2019 * tests/test-diff-pkg.cc: Update copyright for 2019 * tests/test-diff-suppr.cc: Update copyright for 2019 * tests/test-diff2.cc: Update copyright for 2019 * tests/test-ini.cc: Update copyright for 2019 * tests/test-ir-walker.cc: Update copyright for 2019 * tests/test-lookup-syms.cc: Update copyright for 2019 * tests/test-read-dwarf.cc: Update copyright for 2019 * tests/test-read-write.cc: Update copyright for 2019 * tests/test-types-stability.cc: Update copyright for 2019 * tests/test-utils.cc: Update copyright for 2019 * tests/test-utils.h: Update copyright for 2019 * tests/test-write-read-archive.cc: Update copyright for 2019 * tools/abiar.cc: Update copyright for 2019 * tools/abicompat.cc: Update copyright for 2019 * tools/abidiff.cc: Update copyright for 2019 * tools/abidw.cc: Update copyright for 2019 * tools/abilint.cc: Update copyright for 2019 * tools/abipkgdiff.cc: Update copyright for 2019 * tools/abisym.cc: Update copyright for 2019 * tools/binilint.cc: Update copyright for 2019 * tools/kmidiff.cc: Update copyright for 2019 * update-copyright.sh: Update new year to 2019 Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
3c0701d59d |
Support having several debuginfo search dirs for a binary
There are use cases where the split debuginfo file of a given binary is under a given root directory and that the split debuginfo file itself depends on an alternate debuginfo file that is under another unrelated root directory. In that case, the dwarf reader must be able to look for the debuginfo files under several unrelated root directories. The tools abidiff and abidw must thus support having several occurences of the option --debug-info-dir1 (or --debug-info-dir2) meaning that the debuginfo files for the binary must be looked for under several root directories. This is what this patch does. * doc/manuals/abidiff.rst: Adjust doc for the --debug-info-dir{1,2} that can now be provided several times. * include/abg-dwarf-reader.h ({create, reset}_read_context) (read_corpus_from_elf): Take a vector of debug info root dirs. * include/abg-tools-utils.h (trim_leading_string) (find_file_under_dir, make_path_absolute_to_be_freed) (convert_char_stars_to_char_star_stars): Declare new functions. * src/abg-dwarf-reader.cc (find_alt_debug_info_link): Renamed find_alt_debug_info_location into this. (find_alt_debug_info_path): Define new static function. (find_alt_debug_info): Take a vector of debug info root dirs. Use the new find_alt_debug_info_path to look into the debug info root dirs for the alt debug info. (read_context::debug_info_root_paths_): Define new data member. (read_context::read_context): Take a vector of debug info root dirs and initialize the new read_context::debug_info_root_paths_. (read_context::{initialize, create_default_dwfl}): Take a vector of debug info root dirs and adjust. (read_context::{add_debug_info_root_paths, add_debug_info_root_path, find_alt_debug_info}): Define new member functions. (read_context::load_debug_info): Look into the debug info roots for split debug info files. (create_read_context, read_corpus_from_elf): Take a vector of debug info root dirs and adjust. (has_alt_debug_info): Adjust. * src/abg-tools-utils.cc (trim_leading_string) (make_path_absolute_to_be_freed, find_file_under_dir) (convert_char_stars_to_char_star_stars): Define new functions. (entry_of_file_with_name): Define new static function. (build_corpus_group_from_kernel_dist_under): Adjust. * tests/print-diff-tree.cc (main): Adjust. * tests/test-diff-dwarf.cc (main): Adjust. * tests/test-ir-walker.cc (main): Adjust. * tests/test-read-dwarf.cc (main): Adjust. * tools/abicompat.cc (main): Adjust. * tools/abidiff.cc (options::di_root_paths{1,2}): Changed di_root_path{1,2} into this, change their types into vectors of allocated char*. (options::prepared_di_root_paths{1,2}): Define new data members. (options::~options): Define new destructor. (parse_command_line): Adjust. (prepare_di_root_paths): Define new static function. (handle_error): Remove arguments input_file_name, debug_info_dir{1,2}. Now just take an instance of options instead. Adjust. (main): Adjust. * tools/abidw.cc (options::dir_root_paths): Renamed dir_root_path into this and make it be a vector of allocated char*. (options::prepared_di_root_paths): Define new data member. (options::~options): Free the allocated char* in options::dir_root_paths. (parse_command_line): Support several --debug-info-dir. (load_corpus_and_write_abixml): Adjust. (prepare_di_root_paths): Define static function. (main): Adjust. * tools/abilint.cc (main): Adjust. * tools/abipkgdiff.cc (compare): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
18e4697e05 |
Better support array with unknown upper bound
It can happen that arrays are described in DWARF with an unknown upper bound. In those cases, if the array is the type of a global variable, the ELF object corresponding to that global variable should have a size. It's that ELF object size that should be taken into account when comparing versions of that global variable and its type. This patch fixes issues in the detection and representation of array subranges with unknown size so that we behave like presented above. * include/abg-comparison.h (BENIGN_INFINITE_ARRAY_CHANGE_CATEGORY): A new enumerator in the diff_category enum. (EVERYTHING_CATEGORY): Adjust. * src/abg-comparison.cc (get_default_harmless_categories_bitmap): Adjust. (operator<<(ostream& o, diff_category)): Likewise. * include/abg-ir.h (array_type_def::subrange_type::is_infinite): Declare new member function. * src/abg-ir.cc (array_type_def::subrange_type::priv::infinite_): New data member. (array_type_def::subrange_type::priv::priv): Initialize it. (array_type_def::subrange_type::get_length): Better support unknown sized subrange. (array_type_def::subrange_type::is_infinite): Define new member function. * src/abg-comp-filter.cc (has_benign_infinite_array_change): Define new static function. (categorize_harmless_diff_node): Use the new has_benign_infinite_array_change above. * src/abg-dwarf-reader.cc (build_subrange_type): Better recognize a subrange type with unknown upper bound. Represent that with the new array_type_def::subrange_type::is_infinite member property. * src/abg-reader.cc (build_subrange_type): Likewise. * tests/data/test-abidiff/test-PR18166-libtirpc.so.abi: Adjust. * tests/data/test-annotate/libtest23.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
caa100603e |
Bug 23708 - categorize void* to pointer change as harmless
Changing a void* pointer into another pointer of the same size is a change that is harmless in terms of data layout. This commit thus categorizes such a change as harmless. * include/abg-comparison.h (VOID_PTR_TO_PTR_CHANGE_CATEGORY): New enumerator in the diff_category enum. Also, adjust the EVERYTHING_CATEGORY enumerator. * include/abg-fwd.h (is_void_pointer_type): Declare new function. * src/abg-comp-filter.cc (has_void_ptr_to_ptr_change): Define new static function and ... (categorize_harmless_diff_node): ... use it here. * src/abg-comparison.cc (get_default_harmless_categories_bitmap): Add the new abigail::comparison::VOID_PTR_TO_PTR_CHANGE_CATEGORY category in here. (operator<<(ostream& o, diff_category c)): Add support for the new VOID_PTR_TO_PTR_CHANGE_CATEGORY. * src/abg-ir.cc (is_void_pointer_type): Define new function. * tests/data/Makefile.am: Add the new test material below to source distribution. * tests/data/test-diff-filter/test47-filter-void-ptr-change-report-0.txt: New test reference output. * tests/data/test-diff-filter/test47-filter-void-ptr-change-v{0,1}.c: Source code of the new binary test input below. * tests/data/test-diff-filter/test47-filter-void-ptr-change-v{0,1}.o: New binary test input. * tests/test-diff-filter.cc: Add the test input/output above to test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
a16e97596b |
Categorize CV qualifier changes on fn return types as harmless
This partially fixes PR23700. A change in the CV qualifiers of a function return value type should be categorized as harmless. And this is what this patch does. * include/abg-comparison.h (FN_RETURN_TYPE_CV_CHANGE_CATEGORY): New enumerator for diff_category. (EVERYTHING_CATEGORY): Update. * src/abg-comp-filter.cc (type_diff_has_cv_qual_change_only): Factorize this function out of ... (has_fn_parm_type_cv_qual_change): ... this one. (has_fn_return_type_cv_qual_change): Define new static function. (categorize_harmless_diff_node): Use the new has_fn_return_type_cv_qual_change. * src/abg-comparison.cc (get_default_harmless_categories_bitmap): Adjust to add the new FN_RETURN_TYPE_CV_CHANGE_CATEGORY category. (operator<<(ostream& o, diff_category c)): Support the new FN_RETURN_TYPE_CV_CHANGE_CATEGORY. * tests/data/Makefile.am: Add the new test material below to source distribution. * tests/data/test-diff-filter/test46-fn-return-qual-change-report-0.txt: New reference output for the new input test. * tests/data/test-diff-filter/test46-fn-return-qual-change-v{0,1}.c: New source code for the new binary test input. * tests/data/test-diff-filter/test46-fn-return-qual-change-v{0,1}.o: New binary test input files. * tests/test-diff-filter.cc: Add the new test input above to test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
60daf958ae |
Fix propagation of private type suppression category
This is a partial fix of PR23700. Conceptually, there are two kinds of type suppression specifications: 1/ a generic user-provided suppression specification that is meant to suppress changes on types specified by the user 2/ a private type suppression specification that is automatically generated from the path to public header files provided by the user. Technically, one difference between 1 and 2 lays in the way we propagate categories of changes matched by those suppression specifications. If a class type change of category SUPPRESSED_CATEGORY is referenced in a typedef change, then the typedef change is also considered to be of category SUPPRESSED_CATEGORY. In other words, the SUPPRESSED_CATEGORY category is propagated to the typedef change. That means that if a change to a class type is suppressed, a (changed) typedef to that class is considered to be suppressed too. But then that is not true if the class type was changed because it's private. In that, a typedef to that class can be *public*, because the said typedef is defined in a public header. In that case the typedef change should *NOT* be considered suppressed just because the class type change was suppressed. The problem we have here is that we don't make any difference between 1/ and 2/. So we need to introduce different propagation rules for 1/ and 2/. So this patch introduces a new PRIVATE_TYPE_CATEGORY category for types suppression specification that are automatically generated for private types. That new category has its own propagation rule which is basically "no propagation"; every type must be matched by the private type suppression specification to be considered as private. * include/abg-comp-filter.h (has_harmful_name_change): Declare new function overloads. * include/abg-comparison.h (PRIVATE_TYPE_CATEGORY): New enumerator for diff_category; (EVERYTHING_CATEGORY): Adjust this enumerator in diff_category; (is_suppressed): Take an output parameter to say if the suppression is a private type suppression. * include/abg-suppression.h (is_private_type_suppr_spec): Take a const reference parameter and add an overload for a shared pointer. * src/abg-comp-filter.cc (has_harmful_name_change): Define new function. * src/abg-comparison-priv.h (diff::priv::is_filtered_out): Diffs of category PRIVATE_TYPE_CATEGORY are also considered filtered out. * src/abg-comparison.cc (diff::is_filtered_out): Adjust to account for canonical diffs of category PRIVATE_TYPE_CATEGORY. (diff::is_suppressed): Add an overload that takes a is_private_type output parameter. Re-write the old overload in terms of the new one. (operator<<(ostream& o, diff_category c)): Handle PRIVATE_TYPE_CATEGORY. (category_propagation_visitor::visit_end): Do not propagate PRIVATE_TYPE_CATEGORY here. Do not propagate HARMLESS_DECL_NAME_CHANGE_CATEGORY either, when the class does have a harmful decl name change. (suppression_categorization_visitor::visit_begin): Set the new PRIVATE_TYPE_CATEGORY category but do not propagate it. (suppression_categorization_visitor::visit_end): Add some comments. * src/abg-default-reporter.cc (default_reporter::report): Avoid reporting typedef underlying types that are in the PRIVATE_TYPE_CATEGORY category. * src/abg-suppression.cc (type_suppression::suppresses_diff): Do not peel typedefs if we are a private type suppression. (is_private_type_suppr_spec): Take a const reference. * tests/data/Makefile.am: Add the new test material below to source distribution. * tests/test-diff-suppr.cc: Use new test binary input. * tests/data/test-diff-filter/test7-report.txt: Adjust. * tests/data/test-diff-suppr/test39-opaque-type-report-0.txt: New test reference output. * tests/data/test-diff-suppr/test39-opaque-type-v{0,1}.c: Source code of new test binary input. * tests/data/test-diff-suppr/test39-opaque-type-v{0,1}.o: New test binary input. * tests/data/test-diff-suppr/test39-public-headers-dir/test39-header-v{0,1}.h: Source code of new test binary input. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
90b4e7676c |
PR23641 - Type definition DIE matched by a supprspec but not its decl
Suppose we have two versions of a library which are almost identical. Suppose the difference between the two binaries is a slight difference of ordering in how the linker put together what the DWARF describes. Then, while processing the debug info of the first library, libabigail first comes across the forward declaration of a type T. Suppose that declaration is not matched by any private type suppression specification. Libabigail is going to keep the declaration of T and build an internal representation (IR) for it. It's also going to build an IR for types and decls using T like "T*" or "T* var". Now suppose that while processing the debug info of the second library, libabigail first comes across the *definition* of T -- because in this second library, that definition comes first. Suppose that the definition is matched by a private type suppression specification, unlike the declaration in the first library. In this case, T is going to be dropped, and no IR is going to be built for it. If other types or decl like 'T*' or 'T *var" refer to this *definition* of T, they will be dropped too. We'll end up with those two libraries that are identical (modulo the order in which libabigail sees type declarations and their definitions) and are considered different when a suppression specification makes us drop T: the second library appears to libabigail as if T was removed from it. This is the problem addressed by this patch. When the definition of a type T is suppressed because it's considered private then we look if there was a forward declaration for it elsewhere, that is not matched by the private type suppression specification. If we encountered such a type declaration then it means that declaration is in effect an "opaque" version of T. So rather than just dropping T altogether, we keep (and build an IR) for its opaque version only. And we drop the definition of T. This seems to fix the issue. I can't seem to reproduce the slight re-ordering of DIEs descriptions that uncover the issue so I'll rely on integration tests to catch future regressions on this issue, rather than on unit tests. Sigh. * include/abg-tools-utils.h (PRIVATE_TYPES_SUPPR_SPEC_NAME): Remove this extern constant definition. * src/abg-dwarf-reader.cc (type_is_suppressed): Add an overload that takes an additional type_is_private output parameter. (get_opaque_version_of_type): New static function. (build_ir_node_from_die): For class types, get the opaque version for suppressed private types rather than dropping them altogether. * src/abg-reader.cc (type_is_suppressed): Adjust. * src/abg-suppression-priv.h (type_is_suppressed): Add an overload that takes a type_is_private output parameter. * include/abg-suppression.h (get_private_types_suppr_spec_label) (is_private_type_suppr_spec): Declare new functions. * src/abg-suppression.cc (get_private_types_suppr_spec_label, is_private_type_suppr_spec): Define new functions. (suppression_matches_type_name_or_location): Use the new get_private_types_suppr_spec_label rather than a global extern variable. * src/abg-tools-utils.cc (handle_fts_entry): Adjust to use the new get_private_types_suppr_spec_label. (gen_suppr_spec_from_headers): Handle the case or an empty headers root dir. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
af73844b97 |
Add option to avoid walking abigail::ir nodes twice
When the ir_traversable_base::traverse() walks the IR graph, it happens that it can visit a type node that was already visited before. For instance, it visits the 'struct S' once and later, as part of its visit of struct S*, it can visit struct S again. There are use cases where we want the walker to avoid visiting a given type node again. This patch adds the option to do so. Basically the ir_node_visitor class can now be configured to tell the walker to avoid re-visiting a node. The test-ir-walker.cc example is amended to avoid re-visiting type nodes as well. * include/abg-ir.h (struct ir_node_visitor): Make this be a class. Add a private data member to it, following the 'pimpl' idiom. (ir_node_visitor::{allow_visiting_already_visited_type_node, mark_type_node_as_visited, forget_visited_type_nodes, type_node_has_been_visited}): Declare new member functions. * src/abg-ir.cc ({type_base, type_decl, scope_type_decl, qualified_type_decl, pointer_type_def, reference_type_def, array_type_def, enum_type_decl, typedef_decl, class_or_union, class_decl, union_decl}::traverse): Avoid re-visiting the type node if the visitor was configured as such. (struct ir_node_visitor::priv): Define new struct. (ir_node_visitor::{allow_visiting_already_visited_type_node, mark_type_node_as_visited, forget_visited_type_nodes, type_node_has_been_visited}): Define new member functions. * tests/test-ir-walker.cc (name_printing_visitor::name_printing_visitor): Avoid visiting a type node twice. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
99f656cf66 |
Misc style adjustements
* include/abg-suppression.h (function_suppression::ADDED_FUNCTION_CHANGE_KIND): Fix the comment of this enumerator. (suppresses_variable): Cleanup parameter name. * src/abg-comparison.cc: Remove useless horizontal space. * src/abg-suppression.cc (variable_suppression::suppresses_variable): Fix typo. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
215b7eb4fe |
Filter out changes like type to const type
For too long now changes to parameter types like "const char*" to "char*" have been reported by libabigail by default. Those are not really meaningful ABI changes, at least not in C. This patch makes filters out those changes by default. * include/abg-comparison.h (FN_PARM_TYPE_CV_CHANGE_CATEGORY): Add this new enumerator to the diff_category enum. Also, OR this to the value of the EVERYTHING_CATEGORY enumerator. * src/abg-comp-filter.cc (has_fn_parm_type_top_cv_qual_change): Rename has_fn_parm_type_cv_qual_change into this. (has_fn_parm_type_cv_qual_change): New function. (categorize_harmless_diff_node): Categorize cv qual changes as being of category FN_PARM_TYPE_CV_CHANGE_CATEGORY. * src/abg-comparison.cc (get_default_harmless_categories_bitmap): Add FN_PARM_TYPE_CV_CHANGE_CATEGORY to the default harmless categories. * 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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
ef9d20c97c |
Fix redundancy detection through fn ptr and typedef paths
When analyzing the libfreetype.so binary, it appears that libabigail's diff node redundancy marking pass is failing to detect a redundant diff node in cases were the node is recursively referencing itself through a path that involves function type and typedef diff nodes. So it is only at reporting time that we'd detect that the node is redundant so we emit messages like "this change was reported earlier". But When the earlier change in question is suppressed due to, e.g, a suppression specification resulting from the user providing abidiff with the --headers-dir{1,2} command line option, then the change report becomes confusing, at best. The right behaviour is to detect the node is redundant and mark it as such, so that the reporting pass can avoid reporting it altogether. This is what this patch does. This patch changes the output of the runtestdiffpkg regression test. To update the reference output, we need an additional patch to handle a separate (but somewhat related) issue. That is going to be done in the subsequent commit which title is: "Filter out changes like type to const type" * include/abg-comparison.h (is_function_type_diff_with_local_changes) (is_reference_or_pointer_diff_to_non_basic_distinct_types) (peel_typedef_diff): Declare new functions. * src/abg-comparison.cc (is_function_type_diff_with_local_changes) (is_reference_or_ptr_diff_to_non_basic_nor_distinct_types) (peel_typedef_diff): Define new functions. (is_reference_or_pointer_diff): Peel typedefs before operating. (redundancy_marking_visitor::visit_begin): Only sibbling parameter diff node that carry basic type changes (or distinct type changes) are *not* marked as redundant. All other kinds of sibbling parameter diff nodes are markes redundant. Also, rather than never marking function type diffs as redundant by fear of missing local changes on these, just avoid marking function type diff nodes with local changes. It's possible to be that precise now that we can detect that a diff node carries local changes. * tests/data/test-diff-suppr/test37-opaque-type-v{0,1}.o: New binary tests input. * tests/data/test-diff-suppr/test37-opaque-type-v{0,1}.c: Source code of the binary tests input above. * tests/data/test-diff-suppr/test37-opaque-type-header-dir/test37-opaque-type-header-v{0,1}.h: Headers of the binary tests input above. * tests/data/test-diff-suppr/test37-opaque-type-report-0.txt: Reference output for this new test. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test input above to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
af5e660fba |
Explicitely detect anonymous data member changes
This patch detects when a data member becomes anonymous or when an anonymous data member becomes non anonymous and emits an explicit message. * include/abg-comp-filter.h (has_anonymous_data_member_change): Add new function declaration. * include/abg-fwd.h (is_data_member, is_anonymous_data_member): declare new overloads. * src/abg-comp-filter.cc (has_anonymous_data_member_change): Define new overloads. * src/abg-ir.cc (is_data_member, is_anonymous_data_member): Define new overloads. * src/abg-reporter-priv.cc (represent): In the var_diff overload, detect when we have anonymous data member changes and emit explicit error messages then. * tests/data/test-diff-dwarf/test45-anon-dm-change-report-0.txt: New test material. * tests/data/test-diff-dwarf/test45-anon-dm-change-v0.cc: Likewise. * tests/data/test-diff-dwarf/test45-anon-dm-change-v0.o: Likewise. * tests/data/test-diff-dwarf/test45-anon-dm-change-v1.cc: Likewise. * tests/data/test-diff-dwarf/test45-anon-dm-change-v1.o: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-dwarf.cc (in_out_specs): Add the new test material above to the test harness. * 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/test30-pr18904-rvalueref-report2.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
11c2437a19 |
Better detect when diff nodes only carry local type changes
For some fine grain redundancy filtering, we need to know when a diff node carries *only* a basic type change. This is because basic type changes should not be marked as redundant; we want to see all of them -- unlike for class or union (user defined) type changes. And so to know if a diff node carries only a basic type change, we need to know if a diff node only carries a local type change. If it carries only a type change, we can safely just look at that type change and see if it's a basic type change or not. So, we then need to know what kind of local changes a diff node carries: type change or non-type change. That way, we can analyze the local changes a node carries and infer that it only carries a local type change or if it also carries a non-type change. This patch thus changes the diff::has_local_changes() pure virtual member function to make it return the enum change_kind bitmask, which describes the different kinds of local changes the diff node has. Note that two new bit values were added to that enum: LOCAL_TYPE_CHANGE_KIND and LOCAL_NON_TYPE_CHANGE_KIND. The first one says that the diff node carries a local type change, while the second one says that the diff node carries a local non-type change kind. The various implementations of that interface are thus amended to make them return the right bitmask. To do this, the patch updates the various 'equals' overloads to make them return the proper enum change_kind bitmap with the LOCAL_TYPE_CHANGE_KIND and LOCAL_NON_TYPE_CHANGE_KIND set, if need be. * include/abg-comparison.h ({diff, type_diff_base, decl_diff_base, distinct_diff, var_diff, pointer_diff, reference_diff, array_diff, qualified_type, enum_diff, class_or_union_diff, class_diff, base_diff, scope_diff, fn_parm_diff, function_type_diff, function_decl_diff, typedef_diff, translation_unit_diff}::has_local_changes): Return an enum change_kind, rather than just a bool. (is_diff_of_basic_type): Declare an overload that takes a boolean flag. (is_qualified_type_diff, peel_pointer_diff, peel_reference_diff) (peel_qualified_type, peel_pointer_or_qualified_type): Declare new functions * include/abg-fwd.h (peel_qualified_type): * include/abg-ir.h (enum change_kind::{LOCAL_TYPE_CHANGE_KIND, LOCAL_NON_TYPE_CHANGE_KIND, ALL_LOCAL_CHANGES_MASK}): Add these three new enumerators. * src/abg-comparison.cc ({distinct_diff, var_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}::has_local_changes): Adjust to return an enum change_kind, rather than just a bool. (has_local_type_change_only): Define new functions. (has_basic_type_change_only): Use the new has_local_type_change_only function and the new overload for is_diff_of_basic_type. (is_diff_of_basic_type): Define an overload that takes a boolean flag. (is_qualified_type_diff, peel_pointer_diff, peel_reference_diff) (peel_qualified_type, peel_pointer_or_qualified_type): Define new functions. * src/abg-ir.cc (equals): In the overloads for decl_base, scope_decl, type_base, qualified_type_diff, pointer_type_def, reference_type_def, array_type_def, enum_type_decl, typedef_decl, var_decl, function_type, function_decl, function_decl::parameter, class_or_union, class_decl::base_spec and class_decl, properly set the new abigail::ir::{LOCAL_CHANGE_KIND, LOCAL_NON_TYPE_CHANGE_KIND, LOCAL_TYPE_CHANGE_KIND} bits. (types_have_similar_structure): Peel qualified types and typedefs off, first thing. (peel_qualified_or_typedef_type): Define new function. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt: Adjust. * tests/data/test-diff-filter/libtest45-basic-type-change-report-{0,1}.txt: New reference test reports. * tests/data/test-diff-filter/libtest45-basic-type-change-v{0,1}.so: New input test binaries. * tests/data/test-diff-filter/test45-basic-type-change-v{0,1}.cc: Source code of the input test binaries above. * tests/data/Makefile.am: Add the new test file above to source distribution. * tests/test-diff-filter.cc: Add the test input above to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
1ef833b38d |
Improve detection of local *type* changes
For variables and data member, we are quite gross in the way we detect a local type change. Basically, if a textual representation of the variable (and thus of its type) changes, then we consider that the variable has a local (possibly type) change. This leads us to (wrongly) report changes like this: 'struct S1 at test-44-anonymous-data-member-v0.c:1:1' changed: type size hasn't changed there are data member changes: anonymous data member at offset 32 (in bits) changed from: union {int b; float c;} to: union {int b; float c; char e;} Here, you see that the textual representation of the anonymous data member (of union type) changed from: union {int b; float c;} to: union {int b; float c; char e;} You see that although the textual representation of the type changed, the *structure* of the type hasn't really changed. I am using the "vague" term structure, on purpose. Here, in the case of a union, the structure hasn't change because the size of the union hasn't changed. This patch thus introduces the concept of "similarity of type structures". That is, even if two types are different, if "their structure is similar", then the type change is not a local type change. More precisely, here is what we mean by type similarity: Two indirect types (pointers, references) have similar structure if their underlying types are of the same kind and have the same name. In this indirect types case, the size of the underlying type does not matter. Two direct types (i.e, non indirect) have a similar structure if they have the same kind, name and size. Two class types have similar structure if they have the same name, size, and if their data members have similar types. This patch then uses that similarity concept to detect local type changes. * include/abg-fwd.h (is_type_decl): Declare new overload for type_base*. (types_have_similar_structure): Declare new function. * src/abg-comparison.cc (class_or_union_diff::priv::count_filtered_changed_dm): Even when looking at local changes only, do not forget to count nodes that were filtered out. * src/abg-ir.cc (types_have_similar_structure): Define new function. (is_type_decl): Define new overload for type_base*. (is_enum_type): (equals): In the overload for var_decl, use the new types_have_similar_structure function to detect local (type) changes. * src/abg-reporter-priv.cc (represent): In the overload for var_decl, use the diff::has_local_changes function to detect local changes, now that we can better detect local changes. * tests/data/test-diff-filter/test44-anonymous-data-member-report-1.txt: Adjust. * tests/data/test-diff-suppr/test36-leaf-report-0.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
277100a15c |
Sort the output of the leaf reporter
It turned out we were not sorting the output of the leaf report. This patch fixes that. * include/abg-comparison.h (diff_ptrs_type): Define new typedef. * src/abg-comparison-priv.h (sort_string_diff_ptr_map): Declare new function. * src/abg-comparison.cc (sort_string_diff_sptr_map): Update comment. (sort_string_diff_ptr_map): Define new function. * src/abg-leaf-reporter.cc (report_diffs): Sort the diff nodes before reporting about them. * tests/data/test-diff-suppr/test36-leaf-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
ef7198310d |
Initial support of anonymous data members
An anonymous data member is a data member of a struct or a union which has no name. The type of such data member is either a struct or a union. For instance: struct foo { int a; struct { // <-- this is an anonymous data member char a; char b; }; int c; }; In DWARF (as emitted by GCC at least), an anonymous data member is represented as a data member with an empty name. Libabigail sees it just fine, but then when representing *changes* to that kind of data member, it needs special treatment, otherwise users cannot make sense of the reports. This patch adds initial support to represent changes to anonymous data members. * include/abg-comparison.h (is_class_or_union_diff) (is_anonymous_class_or_union_diff): Declare new functions. * include/abg-fwd.h (is_class_type): Declare new overload for type_or_decl_base&. (is_data_member): Declare new overload for decl_base*. (is_anonymous_data_member) (anonymous_data_member_to_class_or_union) (get_class_or_union_flat_representation) (data_member_has_anonymous_type): Declare new functions. (is_at_class_scope): Return the class or union scope. * include/abg-ir.h (var_decl::get_qualified_name): New virtual data member which overloads decl_base::get_qualified_name. * src/abg-comparison.cc (is_class_or_union_diff) (is_anonymous_class_or_union_diff): Define new functions (leaf_diff_node_marker_visitor::visit_begin): Don't mark anonymous class or union diff nodes as diff nodes. * src/abg-ir.cc (is_data_member): Define new overload for decl_base*. (is_class_type, is_union_type): Define new overload for type_or_decl_base&. (is_anonymous_data_member) (anonymous_data_member_to_class_or_union) (get_class_or_union_flat_representation) (data_member_has_anonymous_type): Define new function overloads. (var_decl::get_qualified_name): Define new virtual member function. (is_at_class_scope): Return the class or union scope. (var_decl::get_pretty_representation): Support anonymous data members. (equals): In the overload for class_or_union_diff, mark data member textual representation changes as local changes. * src/abg-reporter-priv.cc (represent): In the overload for var_diff, support changes to anonymous data members. * src/abg-leaf-reporter.cc (leaf_reporter::report): Report sorted -- by offset -- data member changes before the ones that are sorted by other things. * tests/data/test-diff-filter/libtest44-anonymous-data-member-v{0,1}.so: New binary test input * tests/data/test-diff-filter/test44-anonymous-data-member-report-{0,1}.txt: New reference test outputs. * tests/data/test-diff-filter/test44-anonymous-data-member-v{0,1}.c: Source code of the new binary test output above. * tests/data/Makefile.am: Add the new test files above to the source distribution. * tests/data/test-annotate/libtest23.so.abi: Adjust test reference output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-diff-dwarf/test43-PR22913-report-0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise. * tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt: Likewise. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
ee5f2f06a6 |
Represent sizes and offsets in bytes and hexadecimal values
In current change reports, sizes and offsets are represented in bits, and as decimal values. Some users prefer having those offsets be in bytes and as hexadecimal values. This commits adds 4 new options to let users see sizes and offsets be represented either in bits, bytes, decimal or hexadecimal values. * doc/manuals/abidiff.rst: Add documentation for the new --show-bits, --show-bytes, --show-hex and --show-dec options. * doc/manuals/abipkgdiff.rst: Likewise. * doc/manuals/kmidiff.rst: Likewise. * include/abg-comparison.h (diff_context::{show_hex_values, show_offsets_sizes_in_bits}): Declare new member functions. * src/abg-comparison-priv.h (diff_context::priv::{hex_values_, show_offsets_sizes_in_bits_}): Declare new data members. (diff_context::priv::priv): Initialize them. * src/abg-comparison.cc (diff_context::{show_hex_values, show_offsets_sizes_in_bits}): Define new member functions. * src/abg-default-reporter.cc (default_reporter::report): Adjust the call to maybe_report_diff_for_symbol. * src/abg-leaf-reporter.cc (leaf_reporter::report): Likewise. * src/abg-reporter-priv.h (convert_bits_to_bytes) (maybe_convert_bits_to_bytes, emit_num_value, show_offset_or_size) (show_numerical_change): Declare new functions. (maybe_report_diff_for_symbol): Take a diff_context in parameter. * src/abg-reporter-priv.cc (convert_bits_to_bytes, emit_num_value) (maybe_convert_bits_to_bytes, show_numerical_change) (show_offset_or_size): Define new functions. (represent): In the overload for method_decl, var_decl, use the new emit_num_value function. (represent_data_member): Use the new show_offset_or_size function. (maybe_show_relative_offset_change): Use the new convert_bits_to_bytes, diff_context::show_offsets_sizes_in_bits, emit_num_value functions. (maybe_show_relative_offset_change): Likewise. (report_size_and_alignment_changes): Use the new emit_num_value and show_numerical_change functions. (maybe_report_diff_for_symbol): Tak a diff_context in argument. Use the new show_numerical_change function. * tests/test-diff-filter.cc (in_out_spec): Add a new entry to test hexa and bytes output. * tools/abidiff.cc (options::{show_hexadecimal_values, show_offsets_sizes_in_bits}): New data members. (options::options): Initialize them. (display_usage): New help strings for the new --show{bytes,bits,hex,dec} options. (parse_command_line): Parse the new --show{bytes,bits,hex,dec} options. (set_diff_context_from_opts) Set the diff context wrt hex and bytes values. * tools/abipkgdiff.cc (options::{show_hexadecimal_values, show_offsets_sizes_in_bits}): New data members. (options::options): Initialize them. (display_usage): New help strings for the new --show{bytes,bits,hex,dec} options. (set_diff_context_from_opts): Set the diff context wrt hex and bytes values. (parse_command_line): Parse the new --show{bytes,bits,hex,dec} options. * tools/kmidiff.cc (options::{show_hexadecimal_values, show_offsets_sizes_in_bits}): New data members. (options::options): Initialize them. (display_usage):New help strings for the new --show{bytes,bits,hex,dec} options. (parse_command_line): Parse the new --show{bytes,bits,hex,dec} options. (set_diff_context): Set the diff context wrt hex and bytes values. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: New reference test output. * tests/data/Makefile.am: Add the new reference test output above to source distribution. * tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust. * tests/data/test-abicompat/test0-fn-changed-report-2.txt: Likewise. * tests/data/test-abicompat/test5-fn-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test6-var-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test6-var-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-2.txt: Likewise. * tests/data/test-abicompat/test8-fn-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test9-fn-changed-report-0.txt: Likewise. * tests/data/test-abidiff/test-PR18791-report0.txt: Likewise. * tests/data/test-abidiff/test-qual-type0-report.txt: Likewise. * tests/data/test-abidiff/test-struct0-report.txt: Likewise. * tests/data/test-abidiff/test-struct1-report.txt: Likewise. * tests/data/test-abidiff/test-var0-report.txt: Likewise. * tests/data/test-diff-dwarf/test0-report.txt: Likewise. * tests/data/test-diff-dwarf/test1-report.txt: Likewise. * tests/data/test-diff-dwarf/test10-report.txt: Likewise. * tests/data/test-diff-dwarf/test11-report.txt: Likewise. * tests/data/test-diff-dwarf/test13-report.txt: Likewise. * tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test22-changed-parm-c-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test26-added-parms-before-variadic-report.txt: Likewise. * tests/data/test-diff-dwarf/test27-local-base-diff-report.txt: Likewise. * tests/data/test-diff-dwarf/test3-report.txt: Likewise. * tests/data/test-diff-dwarf/test32-fnptr-changes-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test33-fnref-changes-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test34-pr19173-libfoo-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-clang-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-gcc-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test36-ppc64-aliases-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test37-union-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test39-union-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test40-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test43-PR22913-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test8-report.txt: Likewise. * tests/data/test-diff-dwarf/test9-report.txt: Likewise. * tests/data/test-diff-filter/test0-report.txt: Likewise. * tests/data/test-diff-filter/test01-report.txt: Likewise. * tests/data/test-diff-filter/test1-report.txt: Likewise. * tests/data/test-diff-filter/test10-report.txt: Likewise. * tests/data/test-diff-filter/test11-report.txt: Likewise. * tests/data/test-diff-filter/test13-report.txt: Likewise. * tests/data/test-diff-filter/test14-0-report.txt: Likewise. * tests/data/test-diff-filter/test14-1-report.txt: Likewise. * tests/data/test-diff-filter/test15-0-report.txt: Likewise. * tests/data/test-diff-filter/test15-1-report.txt: Likewise. * tests/data/test-diff-filter/test16-report-2.txt: Likewise. * tests/data/test-diff-filter/test16-report.txt: Likewise. * tests/data/test-diff-filter/test17-0-report.txt: Likewise. * tests/data/test-diff-filter/test17-1-report.txt: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-0.txt: Likewise. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt: Likewise. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt: Likewise. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt: Likewise. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt: Likewise. * tests/data/test-diff-filter/test29-finer-redundancy-marking-report-0.txt: Likewise. * tests/data/test-diff-filter/test3-report.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-filter/test32-ppc64le-struct-change-report0.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt: Likewise. * tests/data/test-diff-filter/test37-report-0.txt: Likewise. * tests/data/test-diff-filter/test39/test39-report-0.txt: Likewise. * tests/data/test-diff-filter/test42-leaf-report-output-0.txt: Likewise. * tests/data/test-diff-filter/test6-report.txt: Likewise. * tests/data/test-diff-filter/test9-report.txt: Likewise. * tests/data/test-diff-pkg/dirpkg-1-report-1.txt: Likewise. * tests/data/test-diff-pkg/dirpkg-3-report-1.txt: Likewise. * tests/data/test-diff-pkg/dirpkg-3-report-2.txt: Likewise. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: Likewise. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Likewise. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise. * tests/data/test-diff-pkg/symlink-dir-test1-report0.txt: Likewise. * tests/data/test-diff-pkg/tarpkg-0-report-0.txt: Likewise. * tests/data/test-diff-pkg/tarpkg-1-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-7.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test11-add-data-member-report-0.txt: Likewise. * tests/data/test-diff-suppr/test12-add-data-member-report-0.txt: Likewise. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test13-suppr-through-pointer-report-0.txt: Likewise. * tests/data/test-diff-suppr/test13-suppr-through-pointer-report-1.txt: Likewise. * tests/data/test-diff-suppr/test14-suppr-non-redundant-report-0.txt: Likewise. * tests/data/test-diff-suppr/test14-suppr-non-redundant-report-1.txt: Likewise. * tests/data/test-diff-suppr/test15-suppr-added-fn-report-0.txt: Likewise. * tests/data/test-diff-suppr/test15-suppr-added-fn-report-1.txt: Likewise. * tests/data/test-diff-suppr/test15-suppr-added-fn-report-5.txt: Likewise. * tests/data/test-diff-suppr/test16-suppr-removed-fn-report-0.txt: Likewise. * tests/data/test-diff-suppr/test16-suppr-removed-fn-report-2.txt: Likewise. * tests/data/test-diff-suppr/test17-suppr-added-var-report-0.txt: Likewise. * tests/data/test-diff-suppr/test17-suppr-added-var-report-2.txt: Likewise. * tests/data/test-diff-suppr/test17-suppr-added-var-report-5.txt: Likewise. * tests/data/test-diff-suppr/test18-suppr-removed-var-report-0.txt: Likewise. * tests/data/test-diff-suppr/test18-suppr-removed-var-report-2.txt: Likewise. * tests/data/test-diff-suppr/test18-suppr-removed-var-report-5.txt: Likewise. * tests/data/test-diff-suppr/test2-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-0.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-2.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-1.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-10.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise. * tests/data/test-diff-suppr/test25-typedef-report-0.txt: Likewise. * tests/data/test-diff-suppr/test26-loc-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test26-loc-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-3.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-6.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-8.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test30-report-0.txt: Likewise. * tests/data/test-diff-suppr/test31-report-1.txt: Likewise. * tests/data/test-diff-suppr/test32-report-0.txt: Likewise. * tests/data/test-diff-suppr/test32-report-1.txt: Likewise. * tests/data/test-diff-suppr/test33-report-0.txt: Likewise. * tests/data/test-diff-suppr/test35-leaf-report-0.txt: Likewise. * tests/data/test-diff-suppr/test36-leaf-report-0.txt: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise. * tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Likewise. * tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt: Likewise. * tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt: Likewise. * tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
4d99280d27 |
Rename misleading remove_trailing_white_spaces functions
Trailing implies only whitespace at the end is removed, but these functions also remove leading whitespace. * include/abg-tools-utils.h (trim_white_space): Renamed remove_trailing_white_spaces into this. * src/abg-ini.cc (trim_white_space): Likewise. * src/abg-tools-utils.cc (get_dsos_provided_by_rpm): Adjust. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
c998a818fc |
Fix meaning of "harmless name change" to avoid overfiltering
Whenever a typedef or enum changes its name, we seem to wrongly qualify that chane as being "harmless" and thus, we tend to filter the change out, by default. We do this even when e.g, the enum change also contain other changes that might be meaningful to show. This commit fixes the issue by "tightening" the qualification of a harmless name change for typedefs and enums. For typedefs, a name change is harmless only if there is no change in the textual representation of the underlying type. For enums, a name change is harmless only if there is no other change in the enum, like on the enumerators or on the underlying type of the enum. This patch is part of the set of patches whose titles are: Do not show decl-only-to-def changes in the leaf reporter Overhaul of the report diff stats summary Do not mark "distinct" diff nodes as being redundant Fix meaning of "harmless name change" to avoid overfiltering Better handle category propagation of pointer changes Improve function changes reporting in leaf and default mode Don't filter out typedef changes with redundant underlying type changes Only show leaf type changes in the leaf type changes section Fix leaf report of class data member changes Always show redundant changes in leaf mode Avoid reporting an enum change if it has already been reported When we say an a change was reported earlier give its source location [abipkgdiff]: in leaf mode we always show redundant changes Update tests for the "better leaf mode redundancy management" patchset * include/abg-ir.h (enum_has_non_name_change): Declare new * function. Make it a friend of class enum_type_decl. * src/abg-comp-filter.cc (has_harmless_name_change): A typedef name change cannot be harmless if the textual representation of the underlying type changes too. Also, use the new enum_has_non_name_change to tighten the harmless name change definition for an enum. * src/abg-default-reporter.cc (default_reporter::report_local_typedef_changes): If the name of the typedef changed, report it no matter what. * src/abg-ir.cc (enum_has_non_name_change): Define new function. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
e73901a523 |
Do not mark "distinct" diff nodes as being redundant
When a char is changed into a const char several times in different spots of the type graph, we want to see all the occurence of those changes. Generalizing this in Abigail parlance, we'd say that we want to see all occurences of distinct diff nodes, so we don't want to mark them as being redundant. Right now, libabigail will only show the first occurence of that change will flag subsequent onces as being redundant, by virtue of the redundancy marking pass. This patch avoids marking distinct diff nodes as being redundant. This patch is part of the set of patches whose titles are: Do not show decl-only-to-def changes in the leaf reporter Overhaul of the report diff stats summary Do not mark "distinct" diff nodes as being redundant Fix meaning of "harmless name change" to avoid overfiltering Better handle category propagation of pointer changes Improve function changes reporting in leaf and default mode Don't filter out typedef changes with redundant underlying type changes Only show leaf type changes in the leaf type changes section Fix leaf report of class data member changes Always show redundant changes in leaf mode Avoid reporting an enum change if it has already been reported When we say an a change was reported earlier give its source location [abipkgdiff]: in leaf mode we always show redundant changes Update tests for the "better leaf mode redundancy management" patchset * include/abg-comp-filter.h (is_mostly_distinct_diff): Declare new function. * include/abg-fwd.h (peel_typedef_pointer_or_reference_type): Take a boolean to decide to peel qualified types or not. * src/abg-comp-filter.cc (is_mostly_distinct_diff): Define this function. * src/abg-comparison.cc (redundancy_marking_visitor::visit_begin): Do not mark distinct_diff nodes as being redundant. * src/abg-ir.cc (peel_typedef_pointer_or_reference_type): Implement taking a boolean to decide to peel qualified types or not. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
dc62bd5e71 |
Overhaul of the report diff stats summary
The leaf report diff stats summary had several shortcomings. When referring to "artifact changes", it was only talking about type changes. It should have been talked about added/removed/changed functions and variables as well. It wasn't taking changed functions and variables into account. This commit fixes all that. The commit also fixes some little errors in the default report diff stats summary. Note that at some point, we'll have to make each reporter to actually handles its own diff stats, rather that having it be done globally. Also note that that the commit doesn't update test outputs as it has an impact on lots and lots of them. Rather, test output updates will come in the last commit of the patch set that this commit introduces. This patch is part of the set of patches whose titles are: Do not show decl-only-to-def changes in the leaf reporter Overhaul of the report diff stats summary Do not mark "distinct" diff nodes as being redundant Fix meaning of "harmless name change" to avoid overfiltering Better handle category propagation of pointer changes Improve function changes reporting in leaf and default mode Don't filter out typedef changes with redundant underlying type changes Only show leaf type changes in the leaf type changes section Fix leaf report of class data member changes Always show redundant changes in leaf mode Avoid reporting an enum change if it has already been reported When we say an a change was reported earlier give its source location [abipkgdiff]: in leaf mode we always show redundant changes Update tests for the "better leaf mode redundancy management" patchset * include/abg-comparison.h (corpus_diff::diff_stats::{num_leaf_type_changes, num_leaf_type_changes_filtered_out, net_num_leaf_type_changes, num_leaf_func_changes, num_leaf_func_changes_filtered_out, net_num_leaf_func_changes, num_leaf_var_changes, num_leaf_var_changes_filtered_out, net_num_leaf_var_changes}): Declare new member functions. * src/abg-comparison-priv.h (corpus_diff::priv::count_leaf_type_changes): Declare new member function. * src/abg-comparison.cc (corpus_diff::diff_stats::net_num_leaf_changes): Fix comment. (corpus_diff::diff_stats::{num_leaf_type_changes, num_leaf_type_changes_filtered_out, net_num_leaf_type_changes, num_leaf_func_changes, num_leaf_func_changes_filtered_out, net_num_leaf_func_changes, num_leaf_var_changes, num_leaf_var_changes_filtered_out, net_num_leaf_var_changes}): Define these member functions. (do_count_diff_map_changes): Move this macro out of ... (corpus_diff::priv::count_leaf_changes): ... this. Also, use the new function corpus_diff::priv::count_leaf_type_changes. (corpus_diff::priv::count_leaf_type_changes): Splitted this out of the previous corpus_diff::priv::count_leaf_changes function. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Account for (filtered) types, functions and variables, in a leaf change manner. (corpus_diff::priv::emit_diff_stats): Emit a better stat summary that takes into account leaf-changed types, functions and variables. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
a8e68d9620 |
Do not show decl-only-to-def changes in the leaf reporter
As an introduction, this patch is the first one of a patchset which improves the handling of the leaf reporting mode. The patchset focuses mainly on handling redundancy filtering when in leaf reporting mode, but it doesn't do only that. It also fixes other issues that are related to the leaf reported mode. Note that there are so many changes that we couldn't not possibly update the reference outputs of the regression tests in each change. Rather we update the reference test outputs in on patch, at the end of the set. Here are the titles of the patches of the set: Do not show decl-only-to-def changes in the leaf reporter Overhaul of the report diff stats summary Do not mark "distinct" diff nodes as being redundant Fix meaning of "harmless name change" to avoid overfiltering Better handle category propagation of pointer changes Improve function changes reporting in leaf and default mode Don't filter out typedef changes with redundant underlying type changes Only show leaf type changes in the leaf type changes section Fix leaf report of class data member changes Always show redundant changes in leaf mode Avoid reporting an enum change if it has already been reported When we say an a change was reported earlier give its source location [abipkgdiff]: in leaf mode we always show redundant changes Update tests for the "better leaf mode redundancy management" patchset And below is is the definition of what this first patch does. In the leaf reporter, we are current showing decl-only-classes to def-only-classes changes in the leaf reporter. We should not, as it might be considered as noise. This patch fixes that. * include/abg-comp-filter.h (has_class_decl_only_def_change): Declare this function. * src/abg-comp-filter.cc (has_class_decl_only_def_change): Make this function be non-static. * src/abg-comparison.cc (leaf_diff_node_marker_visitor::visit_begin): Use it to avoid marking class-decl-only-def changes as being leaf changes. * libtest43-decl-only-def-change-leaf-report-v0.so: New test input file. * libtest43-decl-only-def-change-leaf-report-v1.so: Likewise. * test43-decl-only-def-change-leaf-report-0.txt: Likewise. * test43-decl-only-def-change-leaf-report-v0.cc: Likewise. * test43-decl-only-def-change-leaf-report-v1.cc: Likewise. * tests/test-diff-filter.cc (in_out_specs): Run the test over the new test input. * tests/data/Makefile.am: Add the new test materials to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
2939397c13 |
Make abipkgdiff avoid comparing private DSOs from RPMs
When an RPM contains a DSO which SONAME is not listed in the "provides" property of the package, abipkgdiff ought to consider that DSO as private to the RPM. It should thus *NOT* consider that DSO when comparing ABIs, at least, by default. This is as per the discussion that was held at https://pagure.io/task-abicheck/issue/8 and that led to the proposal https://pagure.io/task-abicheck/issue/8#comment-492466. This patch implements that scheme. Basically, the patch looks at the SONAMEs listed in the "provides" property of the RPM and consider them as the SONAMEs of the set of "public" DSOs of the RPM. Thus, if the RPM has a DSO that has no SONAME of one that is not listed in the set of public SONAMEs of the package, then that DSO is not considered for ABI comparison. The patch also introduces a new --private-dso option that disables this behaviour and compares all DSOs, including those that would be meant to be private. * doc/manuals/abipkgdiff.rst: Add documentation for the new --private-dso option. * include/abg-tools-utils.h (execute_command_and_get_output) (execute_command_and_get_output, remove_trailing_white_spaces): Declare new functions. * src/abg-tools-utils.cc (execute_command_and_get_output) (get_dsos_provided_by_rpm, remove_trailing_white_spaces): Define new functions. * tests/test-diff-pkg.cc (in_out_specs): Add the new --private-dso option where it makes sense. * tools/abipkgdiff.cc (options::compare_private_dsos): Add new data member. (options::options): Initialize it. (package::public_dso_sonames_): Add new data member. (package::public_dso_sonames): Add new accessors pair. (display_usage): Add a help string for the new --private-dso option. (maybe_create_public_dso_sonames_set) (must_compare_public_dso_only): Define new static functions. (create_maps_of_package_content): Call the new maybe_create_public_dso_sonames_set. Skip packages which SONAME is not in the set of public SONAMES. (parse_command_line): Parse the new --private-dso option. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
59c0a2ac7c |
Initial support for Ada ranges
In order for abipkgdiff to handle the gnat sub-packages GCC, Libabigail needs to understand some Ada-specific constructs. So far, the only unsupported construct that was problematic is the Ada Range type. This patch thus adds support for that Range type and so makes it possible to handle the gnat sub-packages of GCC. In Ada, the range type is emitted as a DW_TAG_subrange_type that is not necessarily emitted as a property of an array type. In C and C++ however, that DW_TAG_subrange_type is always a property of an array type. So the patch adds support for a so-called "free-form" DW_TAG_subrange_type. First, in the IR, the abigail::array_type_def::subrange_types is now a real full blown type which can have a name and an underlying type. That type can now be created by the both the DWARF and abixml readers. It can also be serialized by the abixml writer. Note that changes in the underlying type and on the name of the range are not yet reported by the reporting engine. That would have to be added in a subsequent patch set. * include/abg-ir.h (type_maps::subrange_types): Declare new accessors. (is_ada_language, is_subrange_type): Declare new functions. (class array_type_def::subrange_type): Make this extend type_base and decl_base. (array_type_def::subrange_type::{get_language, operator==, get_pretty_representation, traverse}): Declare new member functions. (ir_node_visitor::visit_begin): Add new overloads for array_type::def::subrange_type. * src/abg-dwarf-reader.cc (build_subrange_type): Define new static function. (build_subranges_from_array_type_die): Cleanup the parameters of this function. (build_array_type): Adjust. (build_ir_node_from_die): Support free-form DW_TAG_subrange_type. (read_context::odr_is_relevant): Handle Ada. (die_qualified_type_name): Support DW_TAG_subrange_type. (die_pretty_print_type): Likewise. Make the handling of DW_TAG_subrange_type use die_qualified_type_name. Adjust the use of build_subranges_from_array_type_die. (get_scope_die): a DW_TAG_array_type cannot be a scope. Rather, it's its scope that can be a scope. * src/abg-ir.cc (type_maps::priv::subrange_types_): New data member. (type_maps::empty): Adjust. (type_maps::subrange_types): Define new accessors. (is_ada_language, is_subrange_type): Define new functions. (odr_is_relevant): Support Ada. (maybe_update_types_lookup_map): Add an overload for array_type_def::subrange_type. In the decl_base_sptr overload, add support for the array_type_def::subrange_type type. (struct array_type_def::subrange_type::priv::location_): Remove this as it's now carried by the parent decl_base type. (array_type_def::subrange_type::subrange_type): Adjust. Take an environement pointer, a name, an underlying type and a language. (array_type_def::subrange_type::{g,s}et_underlying_type): Define new accessors. (array_type_def::subrange_type::{get_language, get_pretty_representation, traverse}): Define new member functions. (array_type_def::subrange_type::as_string): Add a representation for Ada. (equals): Define new overload for array_type_def::subrange_type. (array_type_def::subrange_type::operator==): Define three new overloads for decl_base, type_base and subrange_type. (array_type_def::subrange_type::operator!=): Define new operator. (get_type_representation): In the overload for array_type_def, support Ada. (array_type_def::get_language): Define new member function. (ir_node_visitor::visit_{begin,end}): Define new overloads for array_type_def::subrange_type. * src/abg-reader.cc (build_subrange_type): Adjust documentation. Support the new 'id', 'name', and 'type-id' properties. * src/abg-writer.cc (write_array_subrange_type): Define new static function. (write_array_type_def): Use the new write_array_subrange_type function. * tests/data/test-abidiff/test-PR18166-libtirpc.so.abi: Adjust. * tests/data/test-annotate/libtest23.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test7.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-write/test25.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
4274691cdf |
Skip class types with changed names in leaf reports
In leaf reports, a class type which is said to have changed name should not be reported because it doesn't make sense there. In the full report however, a class sub-type of a type foo changed name is worth mentioning. This patch detects name changes of class types in the context of leaf reports and avoid reporting impacted types. * include/abg-comp-filter.h (has_class_or_union_type_name_change) (has_basic_or_class_type_name_change): Declare new functions. * include/abg-comparison.h (is_diff_of_class_or_union_type): Likewise. * src/abg-comp-filter.cc (has_class_or_union_type_name_change) (has_basic_or_class_type_name_change): * src/abg-comparison.cc (leaf_diff_node_marker_visitor::visit_begin): Use the new filtering::has_basic_or_class_type_name_change to test if a basic or class/union diff type carries a name change. Update comment. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
3001e78a4f |
Fix symlinks paths handling in abipkgdiff
When elements of an RPMs are referred to using a path that contains symlinks, we need to resolve the symlinks in order to be able to compare those paths. We are not doing this fully and so we are hitting corner cases where things break down in subtle ways. This patch fixes that. * include/abg-tools-utils.h (real_path): Declare new function. * src/abg-tools-utils.cc (real_path): Define it. * tools/abipkgdiff.cc (package::convert_path_to_relative): Use the new real_path function to consider real path (where symlinks are resolved) of the extraction directory of the package. (get_interesting_files_under_dir): Similarly, use the new real_path function to consider the real path of the directory we are exploring. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
6909dcb43c |
Bug 22692 - Consider Java as a language that supports the ODR
While comparing libgcj.so, it turned out that we are trying to canonicalize a DW_TAG_class_type DIE expressing a Java type. Right now, we don't canonicalize DW_TAG_class_type yet because languages that emit those DIEs (like C++) do respect the One Definition Rule. So in theory, we do not need to canonicalize the DW_TAG_class_type by using structural comparison. We only perform DIE canonicalization of DIEs originating from the C language as that language does not respect the ODR. We were assuming that only C++ actually respects the ODR. In practise, Java does also, so this patch now assumes that C++ and Java respect the ODR. So when facing DIEs originating from those languages, we don't try (yet) to canonicalize their DIEs. In the future though, we need to canonicalize all DIEs, irrespective of the language they originated from. And for that, we need to support structural comparison of DW_TAG_class_type DIEs, among others. * include/abg-ir.h (is_java_language): Declare new function. * src/abg-dwarf-reader.cc (odr_is_relevant): Adjust to consider that Java also respects the ODR. * src/abg-ir.cc (is_java_language): Define new function. (odr_is_relevant): Adjust to consider that Java also respects the ODR. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
2df84dd767 |
Fix version revision number printing in tools --help option
The revision number of the version string is junk since 1.0. This patch fixes that. The patch also comes up with a function that returns a version string, rather than having client code constructing the version string on their own. * configure.ac: Properly set the VERSION_REVISION macro. * include/abg-tools-utils.h (get_library_version_string): Declare new function. * src/abg-tools-utils.cc (get_library_version_string): Define the new function. (gen_suppr_spec_from_kernel_abi_whitelist): Dis-ambiguate the use of the 'config' type. * tools/abicompat.cc (main): Use the new abigail::tools_utils::get_library_version_string function. * tools/abidiff.cc (main): Likewise. * tools/abidw.cc (main): Likewise. * tools/abilint.cc (main): Likewise. * tools/abipkgdiff.cc (main): Likewise. * tools/abisym.cc (main): Likewise. * tools/kmidiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
b3c3049fdd |
Update copyright notice for all source files
Happy New Year 2018, I guess :-) * update-copyright.sh: New sed-based script to update the year in the copyright notice. * include/abg-comp-filter.h: Updated the year in the copyright notice. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-suppression.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-workers.h: Likewise. * include/abg-writer.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus-priv.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-default-reporter.cc: Likewise. * src/abg-diff-utils.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ini.cc: Likewise. * src/abg-internal.h: Likewise. * src/abg-ir-priv.h: Likewise. * src/abg-ir.cc: Likewise. * src/abg-leaf-reporter.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-libzip-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-reporter-priv.cc: Likewise. * src/abg-reporter-priv.h: Likewise. * src/abg-sptr-utils.cc: Likewise. * src/abg-suppression-priv.h: Likewise. * src/abg-suppression.cc: Likewise. * src/abg-tools-utils.cc: Likewise. * src/abg-traverse.cc: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-workers.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/test-abicompat.cc: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-types-stability.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tests/test-write-read-archive.cc: Likewise. * tools/abiar.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. * tools/kmidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
8028cdd236 |
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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
eead00efb0 |
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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
933c744034 |
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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
b438c0648e |
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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
108a6074a5 |
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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
3824d8f3c2 |
Allow several kinds of reports to be emitted
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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |