mirror of
git://sourceware.org/git/libabigail.git
synced 2025-03-06 06:37:31 +00:00
6c07e82933
544 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
|
6c07e82933 |
write_context: allow mutating the ostream used
Allowing the mutation of the ostream, allows heavy reuse of the write_context as this is the distinction in most places where write_context is used. Hence, fixup various users of write_context and use common objects where applicable. * include/abg-writer.h (set_ostream): Declare new function. * src/abg-writer.cc (write_context::m_ostream): Make this data member be a pointer rather than a reference. (write_context::{write_context, get_ostream): Adjust. member. (write_context::set_ostream): Define new member function. (set_ostream): Define new free-form function. * tools/abidw.cc (load_corpus_and_write_abixml) (load_kernel_corpus_group_and_write_abixml): Use the feature of mutating the ostream and reuse the write_context in most cases. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
6aeed171c1 |
abg-writer: Refactor write_corpus_group API
Introduce a new call overload for write_corpus_group that follows the parameter order context, object (i.e. corpus_group), indent. Deprecate all other overloads that were part of the API and mostly forward them to the new overload. That effort is made to ensure write_context is always provided. write_context allows access to all options that influence the output format. * include/abg-writer.h (write_corpus_group): Introduce new overload write_corpus_group(ctxt, corpus_group, indent) and deprecate all others. * src/abg-writer.cc (write_corpus_group): Likewise for the definitions and adjust. * tools/abidw.cc (load_kernel_corpus_group_and_write_abixml): Migrate to new API of write_corpus_group() Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
948f27480f |
abg-writer: Refactor write_corpus API
Introduce a new overload for write_corpus that follows the parameter order context, object (i.e. corpus), indent. Deprecate all other overloads that were part of the API and mostly forward them to the new overload. That effort is made to ensure write_context is always provided. write_context allows access to all options that influence the output format. * include/abg-writer.h (write_corpus): Introduce new overload write_corpus(ctxt, corpus, indent) and deprecate all others. * src/abg-writer.cc (write_corpus): Likewise for the definitions and adjust. * tests/test-read-dwarf.cc (test_task::perform): Use the new write_corpus which requires a write_context. * tools/abidw.cc (load_corpus_and_write_abixml, ): Likewise. * tools/abilint.cc (main): Likewise. Also simplify logic around the locations as they now can be expressed with less code. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
f5907c7e74 |
abg-writer: Refactor write_translation_unit API
Introduce a new overload for write_translation_unit that follows the parameter order context, object (i.e. translation unit), indent. Deprecate all other overloads that were part of the API and mostly forward them to the new one. That effort is made to ensure write_context is always provided. write_context allows access to all options that influence the output format. * include/abg-writer.h (write_translation_unit): Declare a new overload write_translation_unit(ctxt, tu, indent) and deprecate all others. * src/abg-writer.cc (write_translation_unit): Likewise in the definitions. (write_corpus, dump, write_translation_unit): Adjust. * tools/abilint.cc (main): use new write_translation_unit() API Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
b0f123c18e |
Add deprecation facilities
Add the macro 'ABG_DEPRECATED' to mark APIs as to be removed in a next major release. APIs marked with that flag are supposed to work as before, but might come with downsides. E.g. they could perform worse or provide only limited functionality. All deprecated functions shall come with a hint to equivalent functionality within the non-deprecated part of the API. * include/abg-fwd.h: Introduce deprecation macro ABG_DEPRECATED Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
f754d81116 |
Bug 24552 - abidiff fails comparing a corpus against a corpus group
In this problem report, the issue is that when comparing two corpus groups, especially when looking up function/variable symbols, the get_fun_symbol_map() and get_var_symbol_map() member functions used are corpus::get_{fun,var}_symbol_map, rather than corpus_group::get_{fun, var}_symbol_map. Note that the type corpus_group inherits from the type corpus. That leads to unexpected comparison results, especially for symbols. This patch fixes this by making the corpus::get_{fun, var}_symbol_map member function be virtual and by using it during the lookup of function/variable symbols. That way, the right symbol map gets used. * include/abg-corpus.h (corpus{_group}::get_{fun, var}_symbol_map): Make these member functions virtual. * src/abg-corpus.cc (corpus::lookup_{function, variable}_symbol): Use the virtual corpus::get_{fun, var}_symbol_map() member function to get the symbols of the current corpus or corpus_group. * tests/data/Makefile.am: Add the new test input material below to source distribution. * tests/data/test-abidiff/test-PR24552-report0.txt: New test input. * tests/data/test-abidiff/test-PR24552-v0.abi: Likewise. * tests/data/test-abidiff/test-PR24552-v1.abi: Likewise. * tests/test-abidiff.cc (main): Support comparing corpus groups. (specs): Add the new test inputs to the harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
2cf9a18e8c |
Better handle several anonymous types of the same kind
This is a follow-up patch for the commit:
|
||
|
43d56de89b |
Handle several member anonymous types of the same kind
When there are several anonymous types (e.g, anonymous classes, unions or enums) in a given class or union, libabigail's internals do struggle. An anonymous class, for instance, is named __anonymous_struct__. When there are more than one of these inside a given class, then we can't name and look them up, because they all have the same name. Incidentally, when add_or_update_class_type completes a class type that was initially constructed before, it fails to determine that an anonymous member type of that class was already present in that context. It thus wrongly duplicates anonymous structs/unions/enums in there and that leads to spurious textual (abixml) representation differences later, where duplicated anonymous member types would appear intermittently, depending on the order in which the class was built. This patch addresses this general issue by naming anonymous member types in a way that allows several of them to exist. That is, if there are two anonymous structs in a class, they are going to be named __anonymous_struct__ and __anonymous_struct__1. We do follow a similar scheme for anonymous unions and enums. This is handled by the DWARF reader that builds the internal representation. While looking at this issue, I also fixed a tangent bug; some DWARF emitters wrongly *define* types in the scope of a DW_TAG_subroutine_type or DW_TAG_array_type. We handle that by actually defining those types in the scope of that subroutine or array. But then it appears that if that scope itself a class and if the type defined is an anonymous type, then putting that anonymous type in the class scope might interfere with the *naming* of the existing legit anonymous types of that scope. I decided to put those anonymous types in the containing namespace instead. We'll see how that goes in real time use. The patch also updates lots of existing tests and adds a new one. * include/abg-ir.h (class_or_union::get_num_anonymous_member_{classes, unions, enums}): Declare new member functions. * src/abg-dwarf-reader.cc (get_internal_anonynous_die_base_name) (build_internal_anonymous_die_name) (get_internal_anonymous_die_name, is_anonymous_type_die): Define new static functions. (die_qualified_type_name): Use the new get_internal_anonymous_die_name. (get_scope_for_die): Fix this to put anonymous types that were wrongly emitted into the scope of DW_TAG_subroutine_type or DW_TAG_array_type by buggy DWARF emitters into the enclosing namespace, rather than into the enclosing class/union. (build_enum_type): Take the scope of the enum to have a chance to properly name potential anonymous enums. (lookup_class_typedef_or_enum_type_from_corpus): Take an anonymous member type index for when the DIE we are lookup up represents an anonymous type. Support proper building of the internal anonymous name of the anonymous type we are lookup up. (add_or_update_class_type): Use the new get_internal_anonynous_die_base_name and build_internal_anonymous_die_name functions. Support making sure that the anonymous member type we are adding to the class wasn't already there, especially for cases where we are updating a class type. (add_or_update_union_type): Use the new get_internal_anonynous_die_base_name and build_internal_anonymous_die_name functions. (build_ir_node_from_die): Adjust the use of build_enum_type to pass it the scope of the enum type we are building. * src/abg-ir.cc (lookup_union_type): Add a new overload. (lookup_class_or_typedef_type): Use the new overload of lookup_union_type above to support looking up union types too. (class_or_union::get_num_anonymous_member_{classes, unions, enums}): Define new member functions. * src/abg-reporter-priv.cc (represent): Detect when anonymous types of anonymous data members have their internal names change, probably because anonymous member types were inserted in the scope. * tests/data/Makefile.am: Add the new test-anonymous-members-0.* test input files to the source distribution. * tests/data/test-annotate/test-anonymous-members-0.cc: New test input file. * tests/data/test-annotate/test-anonymous-members-0.o: Likewise. * tests/data/test-annotate/test-anonymous-members-0.o.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Adjust. * 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/test21-pr19092.so.abi: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt * tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.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/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/test-annotate.cc (int_out_specs): Add the new test inputs to this test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
04d61a726d |
Don't try to de-duplicate all anonymous struct DIEs
Trying to de-duplicate anonymous struct DIEs can lead to subtle issues, because there can be two different naming typedefs designating two anonymous structs that are equivalent, in the same translation unit. In that case, de-duplicating the two leaf anonymous structs DIEs leads to non-resolvable conflict. This patch avoids de-duplicating anonymous structs DIEs and rather de-duplicates (naming) typedefs. * include/abg-fwd.h (is_typedef): Remove the overloads for type_base_sptr and decl_base_sptr. Replace those with an overload for type_or_decl_base_sptr. * src/abg-ir.cc (is_typedef): Do the same for the definitions. * src/abg-dwarf-reader.cc (add_or_update_class_type) (add_or_update_union_type): Do not de-duplicate anonymous struct/union DIEs. (build_typedef_type): Try to de-duplicate typedefs DIEs. * tests/data/test-annotate/test17-pr19027.so.abi: Adjust. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.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/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
15b4f9bb66 |
viz-dot: remove unused members from dot
_M_canvas and _M_typo are unused within "dot". Remove them and all references. * include/abg-viz-dot.h: remove unused data members from 'dot' Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
704932b75a |
add missing virtual destructors
Several virtual desctructors were missing. Even though there might not have been actual leaks or similar bugs, it is worth fixing these locations as they might lead to bugs in the future. Clang also warns at these locations: warning: delete called on non-final 'abigail::ir::corpus' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor] * include/abg-comparison.h: add virtual destructor for corpus_diff and diff_node_visitor * include/abg-corpus.h: add virtual destructor for corpus * include/abg-reporter.h: add virtual destructor for reporter_base * include/abg-traverse.h: add virtual destructor for traversable_base Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
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> |