mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-24 02:32:16 +00:00
912eb7e36b
338 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Dodji Seketeli
|
912eb7e36b |
Speed up type canonicalization by avoiding recursive hashing
Recursive type hashing was showing up as the major hot spot of performance profiles. After spending a few days on trying to speed it up, I have officially declared recursive tree node hashing as a slow process and I am giving up. I have thus decided to not use that at type canonicalization time. Rather, I am proposing a new type canonicalization routine where types are first hashed by hashing their pretty representation string. Basically, if T is the total number of types in the system and C the number of classes of equivalences (or the number of canonical types), the number of type comparisons done by a naive type canonicalization routine is N x C. With the worse C being equal to N itself, that worse number of comparisons is N*N. By using a hash table to store the canonical types, keyed by a hash of their pretty representation string, the number of type comparisons can be brought down to N*P, where P is a the greater number of which pretty representation string hash collide. That number P is usually small; my measurements show that N usually goes from 1 to 3. And moreover, computing the hash of the pretty representation string of the function is way faster than using the recursive type hash! As a result, running abidw on the libcilkrts.so library, from GCC goes from 12 minutes to 0.4 seconds! Incidentally, now that we are not trying to speed up the recursive type hashing process, all the complicated business we had around caching the result of the hashing is gone! I was thinking that hash cashing was inherently a bad idea, especially for recursive types -- that refer to themselves directly or indirectly, because in those case, depending on when you cached the hash value, the value of the hashing can be different. The abixml writer's code doesn't use the recursive type hash anymore either; it uses the pointer value of the canonical type as hash. Super fast too! The patch had to fix pieces here and there to comply with the fact that canonical types are now used across the board in a mandatory fashion. * include/abg-ir.h (canonical_types_map_type): Adjust this typedef to make it point to an unordered_map which the key is now a string and the value is a vector of types. (type_or_decl_base::{get_cached_hash_value, set_cached_hash_value, cached_hash}): Remove these member functions and type. (struct type_base::cached_hash): Remove. * src/abg-ir.cc (struct type_or_decl_base::priv::hash_): Remove. (type_or_decl_base::priv::priv): Adjust. (type_or_decl_base::{g,s}et_cached_hash_value): Remove. (type_base::get_canonical_type_for): For declaration-only classes, look at their definition for the canonical_type. Do not use recursive type hashing anymore. Rather, use the pretty representation string, and hash that. (class_decl::base_spec::get_hash): Do away with hash value caching here. (class_decl::operator==): For decl-only classes, look at their definitions for canonical types. (hash_type_or_decl): Adjust comment. Use the canonical type pointer value for type hash. That's the fast path. Otherwise, if not available, fall back to a slow path which is the recursive type hash we were using before. * src/abg-dwarf-reader.cc (maybe_canonicalize_type): Schedule all classes and typedef to classes for late canonicalization. * src/abg-hash.cc (type_base::dynamic_hash::operator()): There is no hash value cashing anymore. (type_base::cached_hash::operator()): Remove. * src/abg-reader.cc (read_context::get_type): Slight style adjustment. (read_translation_unit_from_file) (read_translation_unit_from_buffer): Do not forget to canonicalize types when reading just one translation unit. (build_type_tparameter, build_template_tparameter): Canonicalize the type. * src/abg-writer.cc (struct type_hasher): New hasher type. (type_ptr_map): Use a deep pointer comparison equal operator functor, and canonical types as type hash values. (write_class_decl): Do not write size and alignment on decl-only classes. Do not record decl-only classes as being emitted. Their definition must be emitted before. * tests/test-read-write.cc (main): Do not do abi testing on translation units (as opposed to doing it on abi corpora) as that code is not wet yet. We need to know how to diff namespaces. * tests/data/test-abidiff/test-PR18791-report0.txt: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3e146f14ba |
Update qualified name of a decl when it's added to its context
The building of the qualified name of a declaration is showing up in performance profile as a hot spot. This patch addresses that performance issue by updating the qualified name of a declaration whenever the declaration is added to its context and saving the result. Getting the qualified name later is just a matter of a string copy. I guess we can do something about those string copies later as they don't show up high performance profiles at the moment. * include/abg-ir.h (decl_base::priv_): Make this be public, so that the qualified name updater function can access it. (class class_decl): Make set_member_is_static() a friend function. * src/abg-ir.cc (class ::qualified_name_setter): New tree walking type. (decl_base::get_qualified_parent_name): Do not do any computation here. Just return the pre-computed qualified parent name string. (decl_base::get_qualified_name): Likewise, for qualified name. (scope_decl::{add,insert}_member_decl): Update the qualified name of the newly added member. Set the scope of the member here. It's not going to be set elsewhere, from now on. (add_decl_to_scope): Do not set the scope here anymore. Just call scope_decl::add_member_decl and let it do the work. (insert_decl_into_scope): Likewise, just call scope_decl::insert_member_decl and let it do the work. (class_decl::{add_data_member, add_member_function}): Do not handle details of context setting at this point. Let scope_decl::add_member_decl do it. Adjust the properties of the context relation afterwards. In add_data_member, when a data member changes its static-ness, move the data member into the class_decl::priv::non_static_data_members_ or out of it, as necessary. (class_decl::insert_member_decl): By default, a data member is considered static. (set_member_is_static): Move this definition after the definitions of class_decl, so that this function can see those. Also, when a data member changes its static-ness, move the data member into the class_decl::priv::non_static_data_members_ or out of it, as necessary. (class_decl::add_member_function_template): As we the underlying function template decl to the context, do not do any scope adding for it here. (::qualified_name_setter::{do_update, visit_begin}): Define new member functions. (update_qualified_name): Define new static function. * src/abg-reader.cc (build_class_decl): Make build_function_decl, build_var_decl, build_function_tdecl and build_class_tdecl automatically add the created decl to their context, and then update the properties of the resulting member decl later, just like what we do in the DWARF reader. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
0cc38b2327 |
Add new test functions
This patch adds a new set of test functions that are going to be used in subsequent patches to come. * include/abg-fwd.h (is_function_decl, is_decl, is_namespace) (is_scope_decl): Declare new function overloads. * src/abg-ir.cc (is_function_decl, is_decl, is_namespace) (is_scope_decl): Define them. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
46c263fbae |
Constify some diff-utils functor operators
* include/abg-diff-utils.h (deep_ptr_eq_functor::operator()): Make the overloads be const. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
16299395d7 |
Support source_location_not_in and source_location_not_regexp suppressions
This patch adds support for properties source_location_not_in and source_location_not_regexp in the [suppress_type] section of suppression specifications. So the suppression specification: [suppress_type] source_location_not_in = foo1.h, foo2.h bar1.h bar2.h suppresses ABI change reports about types that are *NOT* defined in files foo{1,2}.h and bar{1,2}.h. The intended use of this construct is to constrain abi change reports to types that are part of the API of a given shared library. The API of the library is supposed to be defined in foo.h and bar.h only. Similarly, the suppression specification: [suppress_type] source_location_not_regexp = (foo|bar){1,2}\\.h suppresses ABI change reports about types that are not defined in the same set of files foo1.h, foo2.h, bar1.h and bar2.h. * include/abg-ini.h (enum property_value::value_kind): Add a LIST_PROPERTY_VALUE kind. (class {list_property_value, list_property}): Declare new types. (is_list_property, is_list_property_value): Declare new functions. * src/abg-ini.cc (struct list_property_value::priv): Define new type. (list_property_value::{list_property_value, get_content, set_content, as_string}): Define new member functions. (is_list_property_value): Define new function. (struct list_property::priv): Define new type. (list_property::{list_property, get_value, set_value, handle_escape}): Define new member functions. (is_list_property): Define new function. (read_context::buf_): New data member. (read_context::{peek, get, put_back, good, eof, read_string, read_list_property_value}): New member functions. (read_context::read_next_char): Use the new read_context::{get, good, eof} member function, rather than using the input stream directly. (read_context::{skip_white_spaces, skip_comments, skip_white_spaces_or_comments, read_property_name, read_function_name, read_function_argument, read_function_call_expr, read_property_value, read_tuple_property_value, read_section_name, read_section}): Adjust to use the new member functions of read_context rather than using the input stream directly. (read_context::read_string_property_value): Likewise. Use the new read_context::read_string() method. (read_context::{read, write}_property): Support reading list_property. * include/abg-comparison.h (type_suppression::{get_source_locations_to_keep, set_source_locations_to_keep, set_source_location_to_keep_regex_str, get_source_location_to_keep_regex_str}): Add new member functions. * src/abg-comparison.cc (type_suppression::priv::{source_location_to_keep_, source_location_to_keep_regex_str_, source_location_to_keep_regex_}): Add new data members. (type_suppression::priv::{g,s}et_source_location_to_keep_regex): Define new member functions. (type_suppression::{g,s}et_source_locations_to_keep): Define new member functions. (type_suppression::{g,s}et_source_location_to_keep_regex_str): Likewise. (type_suppression::suppresses_type): Support "source_location_not_regexp" and "source_location_not_in" properties of suppression specifications. (read_type_suppression): Likewise. Also adjust to the fact that ta tuple property value that is a list of strings is not a list property value. * doc/manuals/libabigail-concepts.rst: Add documentation for source_location_not_in and source_location_not_regexp. * tests/data/test-diff-suppr/libtest26-loc-suppr-v{0,1}.so: New binary test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-{0,1,2}.suppr: New suppression specification test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-report-{0,1,2,3}.txt: New test reference reports. * tests/data/test-diff-suppr/test26-loc-suppr-v{0,1}.cc: Source code of the test binary input above. * tests/data/test-diff-suppr/test26-loc-suppr.h: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
110494af94 |
Pass simple property data by reference
* include/abg-ini.h (simple_property::{simple_property, set_value}): Pass the value shared pointer by reference. * src/abg-ini.cc (simple_property::{simple_property, set_value): Pass the value shared pointer by reference. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a717ca6faf |
Adjust {s,g}et_show_stats() to use a reference
* include/abg-dwarf-reader.h ({s,g}et_show_stats): Use a reference to the reader. * tools/abidiff.cc (main): Adjust. * tools/abidw.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b2e5366d3f |
Introduce the concept of environment
There are resources needed by the type system and other artifacts of libabigail. Today, when the life time of those resources need to be greater than all of artifacts of Abigail, then said resources are made global. But then global resources are not great, if anything because they complicate the future use of the library in concurrent computing setups. As I was in the need to add one resource to be used by the type system, I decided to sit down and first overhaul how these long lived resources needed to be handled. And here comes the concept of "environment". An environment is a place where one can put resources that need to live longer than all the other artifacts of the Abigail system. And so, the code that creates Abigail artifacts needs and environment of for said artifacts to use. In other words, artifacts now use an environment. This has interesting and strong implications. We can only compare two artifacts if they use the same environment. This is quite a strong requirement. But then when this requirement is fulfilled, comparing two types amounts to just comparing two pointer values; hash values for types can also be cached. Now *that* is great for speed of comparison, is it not? This patch introduce the concept environment (which is basically a new abigail::ir::environment type), removes the global variables and uses the environment instead. Each ABI artifact (either type or decl) now has a ::get_environment() member function to get its environment. This patch also disables the caching of hash values because the caching must happen only *after* all types have been canonicalized. We were not respecting that requirement until now, and that introduces wrong hash values. A subsequent patch is going to re-introduce hash value caching again, once the infrastructure is in place to set a flag in the environment (hah!) once type canonicalization is done, and then later read that flag when some client code requests a hash value, to know if we should look in the hash value cache or not. The patch obviously changes the output of numerous regression tests (if anything b/c it disables hash value caching) so 'make check' yields regressions. But then, it's only the subsequent patch that updates the tests. * include/abg-ir.h: Adjust note about memory management. (class environment): Declare new class. (translation_unit::translation_unit): Take an environment in parameter. (translation_unit::{g,s}et_environment): Declare new member functions. (type_or_decl_base::{g,s}et_environment): Likewise. (type_or_decl_base::{get_cached_hash_value, set_cached_hash_value}): Change the name of decl_base::peek_hash_value() and decl_base::set_hash() here into these and move them here. (type_or_decl_base::hashing_started): Move decl_base::hashing_started() here. ({g,s}et_environment_for_artifact): Declare new functions. (class decl_base): Move member functions hashing_started(), peek_hash_value() and set_hash() on to the type_or_decl_base base class. (scope_decl::scope_decl): Initialize the virtual member type_or_decl_base(). (type_decl::{get_void_type_decl, get_variadic_parameter_type_decl}): Remove these static member functions. They are now non-static member functions of the new environment type. * src/abg-ir.cc (class environment_setter): New internal class. (get_canonical_types_map): Remove. This now becomes a member function of the environment type. (class usage_watchdog): Remove. (usage_watchdog_{s,w}ptr): Remove these typedefs. (get_usage_watchdog_wptr, ref_usage_watchdog) (maybe_cleanup_type_system_data): Remove these functions. (translation_unit::priv::usage_watchdog_): Remove data member. (translation_unit::priv::env_): New data member. (translation_unit::priv::priv): Take an environment and initialize the new env_ data member. Do not initialize the removed usage_watchdog_. (translation_unit::translation_unit): Take an environment parameter. (translation_unit::get_global_scope): Set the environment of a new global scope. (translation_unit::{g,s}et_environment): New accessors. (translation_unit::bind_function_type_life_time): Set the environment of the function type. (struct environment::priv): New class. (environment::{environment, ~environment, get_canonical_types_map, get_variadic_parameter_type_decl, canonicalization_is_done}): New member functions. (struct type_or_decl_base::priv): New class. (type_or_decl_base::{type_or_decl_base, hashing_started, get_cached_hash_value, set_cached_hash_value, set_environment, get_environment, traverse}): New member functions. ({s,g}get_environment_for_artifact): New functions. (decl_base::priv::{hash_, hashing_started}): Remove. (decl_base::priv::priv): Adjust. (decl_base::decl_base): In the copy constructor, initialize the virtual base type_or_decl_base. Do not initialize hash_ and hashing_started data member that got removed. (decl_base::{hashing_started, peek_hash_value, set_hash}): Remove member functions. (strip_typedef): Set the environment of the new type which has its typedefs stripped off. Adjust the call to type_or_void(). (scope_decl::{add, insert}_member_decl): Set the environment of the new member decl to the environment of its scope. (synthesize_type_from_translation_unit) (synthesize_function_type_from_translation_unit): Set the environment for the newly synthesized type. Adjust calls to type_or_void(). (type_or_void): Take an environment in parameter. Get the void type from the environment. (get_canonical_types_map): Remove. (type_base::get_canonical_type_for): Get the canonical types map from the environment, not from a global variable. (type_decl::{get_void_type_decl, get_variadic_parameter_type_decl}): Remove. (pointer_type_def::pointer_type_def): Adjust call to type_or_void. (reference_type_def::reference_type_def): Likewise. (function_decl::parameter::get_pretty_representation): Get the variadic parameter type decl from the environment. (class_decl::priv::classes_being_compared_): Remove static data member. (class_decl::priv::{mark_as_being_compared, unmark_as_being_compared, comparison_started): Use the "classes being compared" map from the environment. (class_decl::base_spec::get_hash): Adjust. (keep_type_alive): Get the alive types array from the environment) not from a global variable anymore. (get_next_string): Put the counter in thread-local storage. * src/abg-hash.cc (scope_decl:#️⃣:operator()) (function_decl:#️⃣:operator()): Do not handle caching (here). * include/abg-corpus.h (corpus::{g,s}et_environment): Declare new accessors. * src/abg-corpus.cc (corpus::priv::env): New data member. (corpus::priv::priv): Initialize it. (corpus::corpus): Take an environment in parameter. (corpus::{g,s}et_environment): Define new member functions (corpus::add): Set the environment of the newly added translation unit, if it's not set already set. In any case, assert that the translation unit must use the same environment as the corpus. * include/abg-dwarf-reader.h (create_read_context) (read_corpus_from_elf): Take an environment parameter. ({s,g}et_debug_info_root_path, {s,g}et_environment): Declare new functions. * src/abg-dwarf-reader.cc (read_context::{env_, offline_callbacks_}): New data members. (read_context::read_context): Initialize them. (read_context::clear_per_translation_unit_data): Do not touch the void type declaration, it doesn't belong to the translation unit. (read_context::{env, offline_callbacks}): New accessors. (read_context::{create_default_dwfl}): New member function. (read_context::dwfl_handle): Add a setter overload. ({s,g}et_debug_info_root_path): Define new accessors. (create_default_dwfl, create_dwfl_sptr, create_default_dwfl_sptr): Remove these. (build_translation_unit_and_add_to_ir): Adjust to pass the environment to the newly created translation unit. (build_function_decl): Adjust to pass the environment to the created function and parameter types. Get variadic parameter type node from the current environment, not from a global variable. And do not try to canonicalize function types here. (read_debug_info_into_corpus): Set the environment of the newly created corpus. (build_ir_node_for_void_type): Get the void type node from the current environment, rather than from a global variable. (create_read_context): Take the environment in parameter. Create the default dwarf front end library handle using the new member function of the read context. Set the current environment used by the reader. (read_corpus_from_elf): Take an environment in parameter. Overhaul. This is now simpler. (has_alt_debug_info): Adjust the call to create_read_context() to make it pass an empty environment. * include/abg-fwd.h (class environment): Forward declare. * include/abg-reader.h (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream) (read_corpus_from_native_xml): Take an environment in parameter. * src/abg-reader.cc (read_context::m_env): New data member. (read_context::read_context): Initialize it. (read_context::{get_environment, set_environment}): New data member. (read_translation_unit): Set environment of the new translation unit. (read_corpus_from_input): Set the environment of the new corpus. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream, read_corpus_from_native_xml): Take an environment in parameter. (build_function_parameter): Get variadic parameter type from the environment. * src/abg-comparison.cc (compute_diff): Add asserts in all the overloads to ensure that the artifact being compared come from the same environment. * tests/print-diff-tree.cc (main): Create an env for the ABI artifacts to use. * tests/test-abidiff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-ir-walker.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tools/abicompat.cc (main): Likewise. * tools/abidiff.cc (main): Likewise. * tools/abidw.cc (main): Likewise. * tools/abilint.cc (main): Likewise. * tools/abipkgdiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
bb5085741b |
Fix redundant const qualifier stripping
In the DWARF reader, we strip the const qualifier when it applies to reference types because a reference is always const. Those redundant const qualifiers can later introduce spurious changes in type comparison. But then we were forgetting to add the stripped type to the IR, in some cases. This patch fixes that. * include/abg-ir.h (operator&, operator~): Add overloaded bitwise operators for qualified_type_def::CV. * src/abg-ir.cc (operator&, operator~): Define them. * src/abg-dwarf-reader.cc (maybe_strip_qualification): Fix comment. If there are multiple qualifiers, only strip the const one. (build_ir_node_from_die): Once we've built a qualified type, if the 'const' qualifier is stripped, then add the new (stripped) type to the set of new types. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3b6bada297 |
More type degradation fixes (from DWARF to abixml)
The series of fixes to make "abidw foo > foo.abi && abidiff foo foo.abi" work continues. On a binary submitted as part of bug 18904, I am still seeing type degradation. This patch addresses the different cases of degradation that are happening. * include/abg-fwd.h (get_type_scope): Declare new function. * src/abg-hash.cc (var_decl:#️⃣:operator()): Do not cache the hash because that can alter the hash computing of a larger type which embeds a var decl as a member declaration. This is especially true if the var decl indirectly references the larger type. The only way to cache the value of a var decl would be to wait after all canonical types have been computed. We'd then seal all types. After that sealing happens, we can cache var decls starting from the top-level ones. (function_decl:#️⃣:operator()): Likewise. * src/abg-ir.cc (get_type_scope): Define new functions. * src/abg-reader.cc (read_is_declaration_only): Declare this function earlier. (typedef const_types_map_it): Adjust this to make it point to a map of string and vector of types, as opposed to a map to string and type as it was before. (typedef types_map_it): New typedef. (read_context::map_id_and_node): Map a type id to the last xmlNodePtr that represent a *declaration*. That gives more leeway to the declaration resolution code to choose the right definition later. Otherwise, there are cases where the wrong definition. By wrong definition, I mean a definition that is different from the one chosen by the DWARF reading code, for a given declaration. Basically for a given ABI corpus, a type declaration resolve to the first definition seen in the corpus. (read_context::get_all_type_decls): Define new member function. (read_context::types_equal): Use qualified names only if both types have a scope. (read_context::key_type_decl): Now a given ID is associated to *all* the declarations and definition that have that ID. (read_translation_unit_from_input): Make sure the current corpus node points to the right node. (build_class_decl): Resolve class declarations to the first definition seen in the corpus. Key a type decl before reading its members as a reading a member can request the current decl. No need to try and canonicalize a member type, as build_class_decl() does that already. * tests/data/test-read-dwarf/test16-pr18904.so: New test binary input. * tests/data/test-read-dwarf/test16-pr18904.so.abi: New test output reference. * tests/test-read-dwarf.cc: Run the test above. * tests/data/Makefile.am: Add the new test input to source distribution. * tests/data/test-abidiff/test-PR18791-report0.txt: Adjust. * 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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5822798dd1 |
Bug 18894 - Fix representation of enumerators in abixml format
It turns out that using a size_t to serialize an enumerator is not enough to represent things like enum foo {value = -3}; We need to represent it using ssize_t. Also, the patch avoids early canonicalization (when reading DWARF) of types that refer to themselves. This was leading to type degradation (serializing the type from IR to abixml and de-serializing it back to IR leads to a different type). * include/abg-ir.h (enum_type_decl::enumerator::get_value()): Change the type of this from size_t to ssize_t. * src/abg-ir.cc (enum_type_decl::enumerator::get_value): Do the same on the definition side. (non_canonicalized_subtype_detector::visit_begin): If a type refers to itself, late canonicalize it to have a similar hashing result as what the abixml reader does. * src/abg-reader.cc (build_enum_type_decl): Use ssize_t to read the value of enumerators. * tests/data/test-read-dwarf/test13-pr18894.so.abi: New test input. * tests/data/Makefile.am: Add the new test inputs above to source distribution. * tests/test-read-dwarf.cc (in_out_specs): Add new test inputs. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. * 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. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
425f8a4ec4 |
Detect vtable changes from member function changes
This patch adds vtable changes detection based on the detection of virtual member function changes. That is, when a member function changes, if that member function is virtual, then infer if the change implies changes to the vtable of the containing class. Before that patch, we were doing the vtable change detection when we were comparing two classes; we were then comparing their virtual member functions. But as for a given class all its virtual member functions are not necessarily emitted in the DWARF debug info (only the virtual member functions that are used in a given translation unit are emitted in that translation unit) it's not reliable to compare virtual member functions as part of comparing a given class. We thus decided some patches ago to stop comparing virtual member functions when we compare two classes. So with this patch now, we still detect changes to the vtable and emit an appropriate message to the user. * include/abg-ir.h (class_decl::{has_virtual_base, has_vtable}): Declare new member functions. * src/abg-comp-filter.cc (has_virtual_mem_fn_change): New overload for function_decl_diff. (has_virtual_mem_fn_change): In the overload for diff*, support virtual member function changes detection for function_decl_diff*. * src/abg-comparison.cc (function_decl_diff::report): Detect and report changes to a vtable by looking a changes that can happen to a given member function. (corpus_diff::report): Detect and report changes to vtables by looking at changes change to member functions. * tests/data/test-diff-dwarf/test29-vtable-changes-report-0.txt: New text input. * tests/data/test-diff-dwarf/test29-vtable-changes-v{0,1}.cc: Source code of new test input binaries. * tests/data/test-diff-dwarf/test29-vtable-changes-v{0,1}.o: New test input binaries. * tests/data/test-diff-dwarf/test30-vtable-changes-report-0.txt: New text input. * tests/data/test-diff-dwarf/test30-vtable-changes-v{0,1}.cc: New test input. * tests/data/test-diff-dwarf/test30-vtable-changes-v{0,1}.o: New test input binaries. * tests/data/test-diff-dwarf/test31-vtable-changes-report-0.txt: New test input. * tests/data/test-diff-dwarf/test31-vtable-changes-v{0,1}.cc: Source code of new test input binary. * tests/data/test-diff-dwarf/test31-vtable-changes-v{0,1}.o: New test input binary. * tests/data/Makefile.am: Add the new test input files above to source distribution. * tests/test-diff-dwarf.cc (in_out_specs): Consume the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fbba4bf0ed |
Fix template comparison operators
There are two issues in comparing templates currently. One is that comparing member class template recurses for ever (oops). The other is that the logic of comparing function templates is wrong and leads to false comparisons. * include/abg-ir.h (function_tdecl::operator==): Introduce a new virtual member operator that takes a function_tdecl&. * src/abg-ir.cc (class_decl::member_function_template::operator==): Avoid the static cast in the overload for member_base. In the overload for member_class_template, avoid infinite recursion. (function_tdecl::operator==): In the overload for decl_base, do not do the real work here in the overload for decl_base Rather, the real work is done in the new overload for function_tdecl, and all other overloads call that one. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9ab2c3a3fd |
Use size/alignment of class definition when requested on declaration
Sometimes during hashing the "type sub-object" of a class can be queried for its size or alignment. In those case, if the class is a declaration that happens to be accompanied with a definition, its the size/alignment of the definition that we want, not the one of the declaration, that is zero. Otherwise, this can cause spurious hashing changes between two class types that are otherwise equivalent modulo the use of a class declaration. This patch being part of a series that aims at fixing a number of type hashing issues, the regression tests are adjusted at the end of the series, not here. * include/abg-ir.h (type_base::{set_size_in_bits, set_alignment_in_bits}): Make these member functions virtual. (class_decl::{set_size_in_bits, get_size_in_bits, get_alignment_in_bits, set_alignment_in_bits}): Declare these virtual member functions. * src/abg-ir.cc (class_decl::{set_size_in_bits, get_size_in_bits, get_alignment_in_bits, set_alignment_in_bits}): Define these virtual functions. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
85feb73bad |
Accept base classes which types are compatible with class type
Until now, a base class had to be a class itself. It couldn't be a typedef to a class, for instance. Clang's debug info does allow base classes which are compatible with classes (e.g, typedefs of classes), which is correct. We ought to accept that. Hence this patch. * include/abg-fwd.h (is_compatible_with_class_type): Declare a new overload. * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Rather than requiring that base classes be of class type, just require that they be compatible with class types. * src/abg-ir.cc (is_compatible_with_class_type): Define a new overload. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
585fc4c33c |
Make abipkgdiff compare tar archives containing binaries
This patch adds support for comparing the ABI of binaries contained in a tar archive. If the archive is compressed with gzip, bzip2, lzip, lzma or xz, then abipkgdiff recognizes the usual relevant file extensions and lets the GNU tar program handle the decompression. If the archive is not compressed, abipkgdiff recognizes the UStar (Uniform Standard Tape ARchive) format, even if the archive file name doesn't end with the .tar extension, and lets the GNU tar program handle the extraction. If the file ends up with the .tar extension anyway (even if it's not in the UStar format, abipkgdiff lets the GNU tar program handle its extraction. * config.h.in (WITH_TAR): New configuration preprocessor macro. * configure.ac: Add a new --enable-tar option. It's turned on automatically if the tar program is found in the PATH. Adjust the build configuration report to add the tar archive support. * include/abg-tools-utils.h (string_ends_with): Declare new function. (enum file_type): Add a new FILE_TYPE_TAR enumerator. * src/abg-tools-utils.cc (string_ends_with): Define new function. (operator<<(ostream&, file_type)): Serialize the new FILE_TYPE_TAR enumerator. (guess_file_type): Detect UStar format file by reading its magic number. Detect compressed tar files based on the file path extension. * tools/abipkgdiff.cc (extract_tar): Define new function. (extract_package): Handle tar packages. (main): Handle tar archives. * tools/abidiff.cc (main): Handle the new FILE_TYPE_TAR enumerator. * tools/abilint.cc (main): Likewise. * tests/data/test-diff-pkg/tarpkg-0-dir{1,2}.ta{,r,.bz2, gz}: New test input tarballs. * tests/data/test-diff-pkg/tarpkg-0-report-0.txt: New test output reference. * tests/data/Makefile.am: Add the new test data file above to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add new tests cases. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fca8506ab9 |
Misc style fixes in abipkgdiff
* include/abg-tools-utils.h (enum file_type): Fix the comment for for the FILE_TYPE_DEB enumerator. * tools/abipkgdiff.cc (main): Fix the style of the conditions. Also, fix the text emitted. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d7dbbf0d50 |
Make abipkgdiff compare directories containing binaries
abipkgdiff knows how to compare the ABI of binaries contained in .deb and .rpm files. This patch adds support for comparing the ABI of binaries contained in two directories. * include/abg-tools-utils.h (enum file_type): Add a new FILE_TYPE_DIR enumerator. * src/abg-tools-utils.cc (operator<<(ostream&, file_type)): Support serialization of the new FILE_TYPE_DIR enumerator. (guess_file_type): Detect that the path given is a directory. * tools/abipkgdiff.cc (package::package): If the package is a directory, then set its extracted directory path to the path of the directory. (package::erase_extraction_directory): Do not erase the extraction directory if the package is a directory provided by the user. (extract_package): If the package is a directory provided by the user, then there is nothing to extract. (main): If the first package is a directory, then the second one should be a directory as well. * tools/abidiff.cc (main): Support directories as input. * tools/abilint.cc (main): Likewise. * tests/data/test-diff-pkg/dirpkg-0-dir{1,2}/libobj-v0.so: New binary test inputs. * test/data/test-diff-pkg/dirpkg-0-report-0.txt: New input test file. * tests/data/test-diff-pkg/dirpkg-1-dir{1,2}/obj-v0.cc: Source code of the binary test inputs above. * tests/data/Makefile.am: Add the new files above to the source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the new test input files above to the set of tests this harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
45be4d7fdd |
Make get_pretty_representation work on method types
Until now, get_pretty_representation() considered method types just as function types. This patch makes it know about them specifically. This useful for debugging, at least. * include/abg-fwd.h (is_method_type): Declare new overloads for naked pointers. (get_method_type_name): Declare new functions. (get_pretty_representation): Declare new overloads for method_type. * src/abg-ir.cc (get_function_type_name): If the function type is a method type, handle it as such. (get_method_type_name): Define new functions. (get_pretty_representation): If the function type is a method type, handle it as such. (get_pretty_representation): Define new overloads for method_type and pointer/reference to method_type. (is_method_type): Add overloads for naked pointers. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7bcaf67504 |
Add a --stats to abidiff and abidw
For now, this new --stats emits diagnostics about the number of types canonicalized at the very end of building the ABI corpus as well as the number of types that were scheduled for late canonicalizing and that couldn't be canonicalized. * include/abg-dwarf-reader.h (get_show_stats) (set_show_stats): New accessors for a new "show_stats" property of the dwarf reader context. * src/abg-dwarf-reader.cc: Include iostream to use std::cerr. (dwarf_reader::show_stats_): New data member. (dwarf_reader::dwarf_reader): Initialize it. (dwarf_reader::show_stats) (get_show_stats) (set_show_stats): Define new accessors. (dwarf_reader::die_type_map): Add const overload to this accessor. (dwarf_reader::lookup_type_from_die_offset): Make this accessor const. (dwarf_reader::add_late_canonicalized_types_stats): New member function. (dwarf_reader::perform_late_type_canonicalizing): Emit the statistics about late-canonicalized types if the user asked for it. * tools/abidiff.cc (options::show_stats): New data member. (options::options): Initialize it. (display_usage): Document it. (parse_command_line): Parse the new --stats option. (main): Create a dwarf reader context, set the show_stats to it and then use that context to read the corpora before diffing them. * tools/abidw.cc (options::show_stats): New data member. (options::options): Initialize it. (display_usage): Document it. (parse_command_line): Parse the new --stats option. (main): Set the show_stats to the dwarf reader context before using it. * doc/manuals/abidiff.rst: Update the manual. * doc/manuals/abidw.rst: Update the manual. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
bd161caa52 |
Make type_has_non_canonicalized_subtype() tighter
type_has_non_canonicalized_subtype() gives up too quickly. For instance, suppose it's looking a type 'foo'. If foo has no canonicalized type yet and has a data member which type is foo* (for instance), then type_has_non_canonicalized_subtype() just sees that type 'foo*' has no canonicalized type, and so it returns, saying that he found a non-canonicalized subtype for foo. In that case though, what type_has_non_canonicalized_subtype() should do is detect that foo* is a pointer to foo itself, so it shouldn't count as a non-canonicalized sub-type. It should keep going and look for other meaningful non-canonicalized sub-types. And this what this patch does. It changes the sub-type walker that type_has_non_canonicalized_subtype() uses, so that - it doesn't flag sub-types that refer to the type we are looking at as non-canonicalized sub-types. This is for sub-types that are combinations of pointers, references and typedefs. - it doesn't consider sub-types of member functions of the type we are looking at, unless that member function is virtual. The result is that more types are canonicalized early during DWARF reading, and so there are less types to store on the side for late canonicalization. This can have a big impact on, e.g, C++ libraries with tens of thousands of types. * include/abg-fwd.h (is_typedef, is_pointer_type) (is_reference_type): Declare new overloads. (peel_typedef_type): Renamed get_typedef_underlying_type into this. (peel_pointer_type, peel_reference_type) (peel_typedef_pointer_or_reference_type): Declare new functions. * src/abg-ir.cc (peel_typedef_type): Renamed get_typedef_underlying_type into this. (is_typedef, is_pointer_type, is_reference_type): Define new overloads. (peel_pointer_type, peel_reference_type) (peel_typedef_pointer_or_reference_type): Define new functions. (non_canonicalized_subtype_detector::has_non_canonical_type_): Make the type of this data member be a type_base*, not a bool. This is so that we can return the first non-canonicalized subtype of the type we are looking at. (non_canonicalized_subtype_detector::non_canonicalized_subtype_detector): Adjust the data member initialization. (non_canonicalized_subtype_detector::visit_begin): Add an overload for function_decl*, to avoid looking into non-virtual member functions. In the overload for type_base*, peel typedefs, pointers and reference of each sub-type that has no canonical type, to see if refers to the type we are actually walking. If yes, then keep going. (type_has_non_canonicalized_subtype): Return the non-canonicalized sub-type found. * src/abg-comparison.cc (type_suppression::suppresses_diff): Adjust for the get_typedef_underlying_type -> peel_typedef_type renaming. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
39b2e8b7d5 |
Make decl_base::get_qualified_name() work when decl context changes
decl_base::get_qualified_name() caches its result. So when it's first called on a decl that is not added to a scope, what is returned is a non-qualified name. Which is all right. But then when the decl is later added to a scope, the cached result of decl_base::get_qualified_name() is not longer correct. This patch resets the cache of decl_base::get_qualified_name() when the decl gets added to a new scope. * include/abg-ir.h (class decl_base): Make class scope_decl a friend of decl_base. (type_base::priv_): Make this protected, rather than private. * src/abg-ir.cc (scope_decl::add_member_decl) (scope_decl::insert_member_decl): Reset the cache of the result of decl_base::get_qualified_name(). * tests/data/test-abidiff/test-PR18791-report0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Matthias Klose
|
4df0a4d952 |
Add support for .deb files to abipkgdiff
This lets abipkgdiff compare debian binary packages. The patch contains test cases for debian package with split debug info that is referenced by the build-id scheme. These test cases come from the bug report https://sourceware.org/bugzilla/show_bug.cgi?id=18792, more particularly from the attachment https://sourceware.org/bugzilla/attachment.cgi?id=8516. * include/abg-tools-utils.h (file_type): Add FILE_TYPE_DEB. * tools/abipkgdiff.cc (extract_deb): New. (extract_package, main): Handle FILE_TYPE_DEB. * src/abg-tools-utils.cc (operator<<): Handle FILE_TYPE_DEB. (guess_file_type): Detect FILE_TYPE_DEB. * tools/abidiff.cc (main): Handle FILE_TYPE_DEB. * tools/abilint.cc (main): Handle FILE_TYPE_DEB. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a-dbgsym_2.4.0-1_amd64.ddeb: Input debian debug info package; to be compared by the test harness runtestdiffpkg. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64.deb: Input debian package; to be compared by the test harness runtestdiffpkg. * tests/data/test-diff-pkg/libsigc++-2.0-0v5-dbgsym_2.4.1-1ubuntu2_amd64.ddeb: Input debug info package * tests/data/test-diff-pkg/libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64.deb: Input debian package; to be compared by the test harness runtestdiffpkg. * 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: Reference output for the comparison of the packages above. * tests/data/Makefile.am: Add the new files above to the source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the input packages above to the set of files to be compared by this test harness. Signed-off-by: Matthias Klose <doko@debian.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
465b25e0d8 |
Update diff stats when added symbols are removed from change report
Until now, when added symbols were removed from the diff output, the diff stat was not properly updated. This patch fixes that. * include/abg-comparison.h (diff_context_wptr) (corpus_diff::diff_stats_sptr): New typedefs. (corpus_diff::diff_stats::diff_stats): Make this constructor take a diff_context_sptr. Make the default constructor private. * src/abg-comparison.cc (corpus_diff::diff_stats::priv::ctxt_): New data member. This is a weak pointer to a diff_context. (corpus_diff::diff_stats::priv::priv): Take a diff_context_sptr and initialize the weak pointer ctxt_ to it. (corpus_diff::diff_stats::priv::ctxt): New accessor to the diff_context hold by the diff_stats. (corpus_diff::diff_stats::{num_removed_func_filtered_out, num_added_func_filtered_out, num_removed_vars_filtered_out, num_added_vars_filtered_out, num_removed_func_syms_filtered_out, num_added_func_syms_filtered_out, num_removed_var_syms_filtered_out, num_added_var_syms_filtered_out}): If the user asked for the added [or removed] variables/functions/symbols to be ignored, the accessors for the number of filtered added/removed variables/functions/symbols return the total number of added/removed variables/functions/symbols; that is, say that *all* added/removed variables/functions/symbols got filtered out. (corpus_diff::priv::diff_stats_): Turn this data member into a [shared] pointer to diff_stats. (corpus_diff::priv::filters_and_suppr_applied_): Remove this data member. Now that diff_stats_ is a pointer, we don't need this boolean anymore. (corpus_diff::apply_filters_and_suppressions_before_reporting): Adjust to the fact that filters_and_suppr_applied_ is gone, and that diff_stats_ is now a pointer. (corpus_diff::report): Control un-referenced added symbols reporting with diff_context::show_added_symbols_unreferenced_by_debug_info() Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a746f4afee |
Make applying supp specs through pointer access look through typedefs
Consider the declaration of the exported function bar() below: struct _OpaqueType {int member;}; typedef struct _OpaqueType Type; void bar(Type*); Once the *definition of struct _OpaqueType and bar() are compiled into a shared library, if a layout change happens to struct _OpaqueType, then abidiff rightfully reports that bar() is impacted by the layout change to struct _OpaqueType. But then, the following suppression specification won't silence the ABI change report: [suppress_type] name = _OpaqueType type_kind = struct accessed_through = pointer This is because strictly speaking, it's not struct _OpaqueType that is accessed through a pointer, from function bar(); it's the type 'Type', (which is a typedef of struct _OpaqueType) that is accessed though a pointer. But then, as 'Type' and 'struct _OpaqueType' are the same type (modulo the typedef), this behaviour is not super useful. It would be more interesting if the suppression specification could silence the ABI change report. And this is what this patch does. * include/abg-comparison.h (type_suppression::suppresses_type): Declare new member function. (get_typedef_diff_underlying_type_diff): Declare new function. * include/abg-fwd.h (get_typedef_underlying_type): Likewise. * src/abg-comparison.cc (type_suppression::suppresses_type): Define new member function. (get_typedef_diff_underlying_type_diff): Define new function. (type_suppression::suppresses_diff): After looking through the different kind of access methods, use the new type_suppression::suppresses_type(), rather than doing lots of stuff ourselves here. But then, if the suppression doesn't apply to the subjects of the diff, look through typedefs and try to apply the suppression again. * src/abg-ir.cc (get_typedef_underlying_type): Define new function. * tests/data/test-diff-suppr/libtest25-typedef-v{0,1}.so: New binary test input files. * tests/data/test-diff-suppr/test25-typedef-v{0,1}.c: Source code for the binary test input files above. * tests/data/test-diff-suppr/test25-typedef-report-{0, 1}.txt: New test input files. * tests/data/test-diff-suppr/test25-typedef-suppr-0.txt: New test input file. * tests/data/Makefile.am: Add the new test material to the source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the test inputs above to the set of test inputs this harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e5cf9d1f60 |
Consider default symbol versions when computing added/removed fns/vars
When computing the set of added function or variable symbols, if a symbol S with no version symbol was present in a given corpus and that symbol gained a *DEFAULT* version V in the second corpus, we should not consider that a new symbol S was added (and that the former S was removed) because: 1/ S was already present in the first corpus 2/ applications linked to the first corpus and that were using S (with no version) there, will automatically use the S with version V in the second corpus, without needing any re-linking; the power of symbol versioning! Rather, it's just that S gained a default symbol version. This patch implements that. * include/abg-corpus.h (corpus::{lookup_function_symbol, lookup_variable_symbol}): Take a elf_symbol::version object, rather than a string representing the version. Add an overload that takes an elf_symbol. * src/abg-corpus.cc (find_symbol_by_version): New static function. (corpus::{lookup_function_symbol, lookup_variable_symbol}): Take a elf_symbol::version object, rather than a string representing the version. Add an overload that takes an elf_symbol. If the looked up symbol has no version and if the corpus contains a symbol with the same name and with a default version, then return that latter symbol if the corpus doesn't contain a symbol with the same name and empty version. * src/abg-comparison.cc (class_diff::ensure_lookup_tables_populated): Adjust. (corpus_diff::priv::ensure_lookup_tables_populated): Before deciding that a symbol has been added, if the symbol has a default version, make sure no symbol with the same name and without version was present in the former corpus. Similarly, before deciding that a symbol has been removed, if the symbol has no version, make sure the latter corpus has no symbol with the same name and with a default version. * tests/data/test-diff-dwarf/test12-report.txt: Adjust. The function should not be considered as added, because its symbol (and version) was already present in the former DSO. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
636202c833 |
Fix style issues
* include/abg-ir.h (struct ir_node_visitor): Fix the wording of the comment of this type. * src/abg-dwarf-reader.cc (build_ir_node_from_die): Fix the filling of the text of the comment of the code that chooses to perform early canonicalizing. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
915bf047fb |
Add a new corpus_diff::has_net_changes() entry point
This entry point is to test if there are still ABI changes between two corpora after applying suppression specifications. * include/abg-comparison.h (corpus_diff::has_net_changes): Declare new member function. * src/abg-comparison.cc (corpus_diff::has_net_changes): Define it. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
0cf1828a90 |
Fix type synthesis to fix abicompat weak mode
While looking further in the issue Sinny Kumari reported, I realized that the weak mode wasn't working in that example either. It turned out that synthesizing qualified types was not working because we were just looking them up in the binary, rather than looking up the un-qualified underlying type and then synthezing the resulting qualified type. This patch just does that. * include/abg-fwd.h (synthesize_type_from_translation_unit): Declare new function. (synthesize_function_type_from_translation_unit): Make the translation_unit parameter non-const because the function needs to bind the life time of the synthesized function to the life time of the translation unit. Make this function be a friend of abigail::ir::translation_unit. (synthesize_function_type_from_translation_unit): * src/abg-ir.cc (translation_unit::priv::synthesized_types_): New data member. (synthesize_type_from_translation_unit): Define new function. (synthesize_function_type_from_translation_unit): Make the translation_unit parameter non-const. If the return is void, then take that in account carefuly. Rather than just looking up the type of parameters and return value, synthesize them too, especially when they are qualified types. Bind the life time of the synthesized function type to the lifetime of the translation unit. * tests/data/test-abicompat/test7-fn-changed-report-1.txt: New test reference output. * tests/test-abicompat.cc (in_out_spec): Run the harness on the exisiting test7-fn-changed-app and libtest7-fn-changed-libapp-v1 but in weak mode this time. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f681c33970 |
Remove use of tmpnam from abilint
We were using the unsafe tmpnam function in abilint. This patch creates a helper type abigail::tools_utils::temp_file that does away with the use tmpnam in abilint. * include/abg-tools-utils.h (abigail::tools_utils::temp_file): Declare new type. (abigail::tools_utils::temp_file_sptr): New typedef. * src/abg-tools-utils.cc (temp_file::priv): Define new type. (temp_file::{temp_file, is_good, get_path, get_stream, create}): Define new member functions. * tools/abilint.cc (main): Do not use tmpnam anymore. Use the new abigail::tools_utils::temp_file type instead. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1ddde3d9d0 |
Try to avoid a race condition when abipkgdiff extracts packages.
abipkgdiff extracts the content of the first package in a directory named <tmpdir>/package1 and the content second package in <tmpdir>/package2. If two independant instances of abipkgdiff are launched at the same time, they are going to walk on each others' toes, to say the least. This patch extracts the content of each package in directory named <tmpdir>/<randomname>/package1, where randomname is supposed to be a random number, and so should be unique, most of the time. I guess we should try harder to generate a randomname that is unique when we see that the directory <tmpdir>/<randomname> exists already, but for now, what we have is good enough, or at least better than what we have had so far. * include/abg-tools-utils.h (get_random_number) (get_random_number_as_string): Declare new functions. * src/abg-tools-utils.cc (get_random_number) (get_random_number_as_string): Define them. * tools/abipkgdiff.cc (package::extracted_package_parent_dir_path): New data member. (package::package): Initialize package::extracted_package_parent_dir_path to <tmpdir>/<randomname>, with randomname being a random number represented as a string. (extract_rpm): Make sure to create a hierarchy of directories, not just a directory. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7cae79e0d8 |
On changed fn, show symbol info when name is different from linkage name in C
In change reports for function sub-type changes, for the C language, when the name of the function is different from its linkage name, even when the function symbol has no aliases, show the symbol information of the function. * include/abg-ir.h (translation_unit::language): New enum type. (translation_unit::{get_language, set_language}): Declare new accessors. (translation_unit_language_to_string) (string_to_translation_unit_language, is_c_language) (is_cplus_plus_language): Declare new functions. * src/abg-ir.cc (translation_unit::priv::language_): New data member. (translation_unit::priv::language_): Initialize it. (translation_unit::{set_language, get_language}): Define new member functions. (translation_unit_language_to_string) (string_to_translation_unit_language, is_c_language) (is_cplus_plus_language): Define new functions. * src/abg-dwarf-reader.cc (dwarf_language_to_tu_language): New static function. (build_translation_unit_and_add_to_ir): Read the language of the translation unit. * src/abg-comparison.cc (corpus_diff::report): When reporting a change in a function sub-type, if we are in C language translation unit, if the function name is different from its linkage name, even if the symbol doesn't have any alias, show symbol information. * src/abg-reader.cc (read_translation_unit_from_input): Read the 'language' property of the translation unit, if present. * src/abg-writer.cc (write_translation_unit): Write the 'language' property to the translation unit, if present. * tests/data/test-read-dwarf/test0.abi: Adjust for the new 'language' property of the 'abi-instr' element. * tests/data/test-read-dwarf/test1.abi: Likewise. * tests/data/test-read-dwarf/test2.so.abi: Likewise. * tests/data/test-read-dwarf/test3.so.abi: Likewise. * tests/data/test-read-dwarf/test4.so.abi: Likewise. * tests/data/test-read-dwarf/test5.o.abi: Likewise. * tests/data/test-read-dwarf/test6.so.abi: Likewise. * tests/data/test-read-dwarf/test7.so.abi: Likewise. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f3ed9dfa92 |
Support file_name_regexp and soname_regexp in supp-specs
With this patch it's now possible to express the soname or name of the binary file that contains the ABI artifacts the suppression specifications should apply to. * include/abg-comparison.h (suppression_base::priv_): Make this pimpl member protected. (suppression_base::set_file_name_regex_str) (get_file_name_regex_str, get_soname_regex_str) (set_soname_regex_str): Declare new accessors. (function_suppression::{suppresses_function, suppresses_function_symbol}): Take a diff_context_sptr. (variable_suppression::{suppresses_variable, suppresses_variable_symbol}): Take a diff_context_sptr. * src/abg-comparison.cc (suppression_base::priv::{file_name_regex_str_, file_name_regex_, soname_regex_str_, soname_regex_}): Define new data members. (suppression_base::priv::get_file_name_regex_str) (get_soname_regex_str): Define new member functions. (suppression_base::set_file_name_regex_str) (get_file_name_regex_str, get_soname_regex_str) (set_soname_regex_str): Define new accessors. (type_suppression::suppresses_diff): Evaluate file_name_regexp and soname_regexp. (read_type_suppression): Fix the reading of the "label" property. Read the file_name_regexp and soname_regexp properties. (function_suppression::{suppresses_function, suppresses_function_symbol): Take a diff_context_sptr parameter. Evaluate file_name_regexp and soname_regexp properties. (function_suppression::suppresses_diff): Adjust for the api change of function_suppression::suppresses_function(). (read_function_suppression): Read the file_name_regexp and soname_regexp properties. (variable_suppression::suppresses_variable): Take a diff_context_sptr parameter and evaluate file_name_regexp and soname_regexp properties. (variable_suppression::suppresses_variable_symbol): Likewise. (variable_suppression::suppresses_diff): Adjust for the api change of variable_suppression::suppresses_variable(). (read_variable_suppression): Read the file_name_regexp and soname_regexp properties. (function_is_suppressed, variable_is_suppressed): Take a diff_context_sptr parameter. (corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars): Adjust. * doc/manuals/libabigail-concepts.rst: Document file_name_regexp and soname_regexp in the manual. * tests/data/test-diff-suppr/libtest24-soname-v{0,1}.so: New test binary input files. * tests/data/test-diff-suppr/test24-soname-report-{0,4}.txt: New test input files. * tests/data/test-diff-suppr/test24-soname-suppr-{0,4}.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-v{0,1}.cc: Source code of the binary test input files above. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Add the new test inputs to the set of tests this harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5df40e91ce |
Remove the last direct fiddling with ELF from abipkgdiff.cc
Directly using elfutils from abipkgdiff.cc feels like a taping into the wrong abstraction layer from this level. So this patch moves the determination of the type of elf file into abg-dwarf-reader.cc and uses it from there. The patch also simplifies the instantiation of types elf_file and package, from abipkgdiff.cc. * abg-dwarf-reader.h (enum elf_type): Move this declaration here from abipkgdiff.cc to here. (get_type_of_elf_file): Declare this new function. (get_soname_from_elf): Change this to take a path to the elf file rather than a Elf* handler. So now to use this, the user doesn't have to get her hand dirty with elfutils. * src/abg-dwarf-reader.cc (get_soname_from_elf): Change this to take a path to the elf file rather than a Elf* handler. (elf_file_type): Move this static function here, from abipkgdiff.cc. (get_type_of_elf_file): New function. This has been factorized out of create_maps_of_package_content() in abipkgdiff.cc. * tools/abipkgdiff.cc (class elf_file): Changed struct elf_file into this. Make the default constructor private. (elf_file::elf_file): Change the constructor to just take the path to the elf_file. The base name, soname and elf file type are now computed from the path file, in the constructor. This makes instantiation much much easier from the point of view of the user of the type. (struct abi_diff): Renamed struct abi_changes into this. (abi_diff::has_changes): Define new member function. (abi_diffs): Remove this global variable. (package::package): Remove the elf file type from the set of parameters of this constructor. Rather, compute that elf file type from the path to the elf file, in the constructor. Again, this eases the use of the type. (elf_file_type): Remove this from here, as it got moved to abg-dwarf-reader.cc. (compare): In the elf_file overload, return true if the comparison yields ABI changes. (create_maps_of_package_content): Do not fiddle with elfutils stuff here. Rather, just instantiate elf_file and the analyzing of the file magically happens. (compare): Make the package overload take an abi_diff as output parameter, rather than populating a global variable in return. (compare): Add an other overload for package that doesn't take the abi_diff as output parameter and write it in terms of the previous one. (main): Adjust as the instantiation of package is now simpler. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Sinny Kumari
|
254dfd3655 |
Move get_soname() function to abg-dwarf-reader.h/cc
Initially, fetching SONAME from a given DSO file was done in abipkgdiff.cc. But, this function fits better when defined in abg-dwarf-reader.cc in order to make it usable by other tools if needed. For consistancy, get_soname() function has been renamed to get_soname_from_elf(). * include/abg-dwarf-reader.h (get_soname_from_elf): Declare new function * src/abg-dwarf-reader.cc (get_soname_from_elf): Define new function * tools/abipkgdiff.cc (get_soname): Remove function (pkg_diff): Call get_soname_from_elf() instead of get_soname() Signed-off-by: Sinny Kumari <sinny@redhat.com> |
||
Sinny Kumari
|
b55e516d49 |
Guess RPM file type
To run abipkgdiff between two pacakges, it should know whether input files are valid pacakge file or not. This patch detects RPM and SRPM pacakge file type. abipkgdiff uses it to know whether input files are valid RPM pacakge file or not. * include/abg-tools-utils.h (file_type): Added member FILE_TYPE_RPM and FILE_TYPE_SRPM (operator<<): New function declaration. * src/abg-tools-utils.cc (file_type): Detect RPM and SRPM file type (operator<<): New function definition * tools/abidiff.cc (main): Check for RPM and SRPM file type as well. * tools/abilint.cci (main): Check for RPM and SRPM file type as well. * tools/abipkgdiff.cc (main): Check whether input files to abipkgdiff are valid RPM files or not. Signed-off-by: Sinny Kumari <sinny@redhat.com> |
||
Dodji Seketeli
|
5b09ea77e2 |
Handle the life time of the map of canonical types
While working on something else, it turned out that we need to cleanup (de-allocate) the map of canonical types when all the translation units that own types are de-allocated. Otherwise, when new translation units are created later, the types in the canonical types map become unrelated to the types in these new translation units, leading to memory management issues. This patch introduces a "usage watchdog" which detects when no translation unit uses the type system anymore. That usage watchdog is then used in the destructor of the translation_unit type to de-allocate the global data that is logically owned by by the type system. The patch also changes the API to read translation units and corpora in a way that forces users to get a handle on the resulting shared pointer. * include/abg-ir.h (type_base::canonical_types_map_type): Move this typedef into abg-ir.cc and out of the type_base namespace. (type_base::get_canonical_types_map): Likewise. * src/abg-ir.cc (canonical_types_map_type): New typedef that got moved here from type_base::canonical_types_map_type. (get_canonical_types_map): Likewise got moved here from type_base::get_canonical_types_map. Made static in the process. (class usage_watchdog): New type. (usage_watchdog_sptr, usage_watchdog_wptr): New typedefs. (get_usage_watchdog, get_usage_watchdog_wptr, ref_usage_watchdog) (maybe_cleanup_type_system_data): New static functions. (translation_unit::priv::usage_watchdog_): Add new data member. (translation_unit::priv::priv): Get a reference on the usage watchdog. (translation_unit::priv::~priv): If the usage watchdog says that the type system is not used, then cleanup the global data logically owned by the type system. * include/abg-dwarf-reader.h (read_corpus_from_elf): Make this return a corpus and set the status by reference using a parameter. * src/abg-dwarf-reader.cc (read_corpus_from_elf): Implement the above. * include/abg-reader.h (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Remove the overloads that do not return a translation_unit_sptr and that pass it as a parameter. Only keep the overloads that return a translation_unit_sptr, forcing users of the API to own a proper reference on the resulting translation_unit pointer. That is important to handle the life time of the global data of the type system that need to be cleared when the last translation unit is de-allocated. * src/abg-reader.cc (read_translation_unit_from_input): Make this return a translation_unit_sptr. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Remove the overloads that do not return a translation_unit_sptr and that pass it as a parameter. Only keep the overloads that return a translation_unit_sptr. (read_to_translation_unit): Make this return a translation_unit_sptr. * tests/print-diff-tree.cc (main): Adjust. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-ir-walker.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tools/abicompat.cc (main): Likewise. * tools/abidiff.cc (main): Likewise. * tools/abidw.cc (main): Likewise. * tools/abilint.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a2601a596a |
Factorize incompatible and subtype changes detection
In abg-comparison.h, there is no function to test if a given corpus_diff carries incompatible or subtype (after having applied suppression specifications) ABI changes. So this patch factorizes the code of abidiff.cc to provide these features to corpus_diff. * include/abg-comparison.h (corpus_diff::{has_incompatible_changes, has_net_subtype_changes}): Declare new member functions. * src/abg-comparison.cc (corpus_diff::{has_incompatible_changes, has_net_subtype_changes}): Define them. * abidiff.cc (main): Use the new member functions above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fe9fa7a05f |
Support filtering out just one alias of a function
Suppose a function private_foo() has a symbol private_foo and also a another one (an alias) named public_foo. Then suppose we want to filter out sub-type changes to private_foo(). But then we still want to see changes to public_foo. This patch does add this feature. The [suppress_function] directive now has a new (hidden) boolean 'allow_other_aliases' property. When set to 'yes' or 'true', if the function being looked at has an alias symbol that does *NOT* match the other properties of the directive, then the directive doesn't suppress reports for the function. This new property is set to yes by default. This means that when a function has got multiple aliases, to suppress the function, one needs to write a regular expression that matches the names of aliases. Otherwise the function will not be suppressed. * include/abg-comparison.h (function_suppression::{get, set}_allow_other_aliases): Declare new member functions. * src/abg-comparison.cc (function_suppression::priv::allow_other_aliases_): New data member. (function_suppression::priv::priv): Initialize it to 'true'. (function_suppression::{get, set}_allow_other_aliases): Define new member functions. (read_function_suppression): Parse the new "allow_other_aliases" property. (function_suppression::suppresses_function): Update to evaluate the new 'allow_other_aliases' property when there is a property to match against some a symbol name of the function. (corpus_diff::report): Fix the printing of function aliases when printing sub-type changes to properly emit the plural of the word 'symbol' when the function has several aliases. * include/abg-ir.h (elf_symbol::get_number_of_aliases): Declare new member function. * src/abg-ir.cc (elf_symbol::get_number_of_aliases): Define new member function. * doc/manuals/libabigail-concepts.rst: Update manual. * tests/data/test-diff-dwarf/test5-report.txt: Adjust. * tests/data/test-diff-suppr/libtest23-alias-filter-v0.so: New test input. * tests/data/test-diff-suppr/libtest23-alias-filter-v1.so: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-0.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-1.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-2.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-3.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-4.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-0.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-1.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-2.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-3.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-4.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-5.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-v0.c: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-v1.c: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-version-script: Likewise. * tests/data/Makefile.am: Add the new test stuff to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Add the tests inputs above to the list of input to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
25dc383b40 |
Show aliases of functions with changed sub-types
The report emitted by abidiff now tells the user about the aliases of the current function, when that function has some sub-type changes. * include/abg-ir.h (elf_symbol::get_aliases_id_string): Declare new overload. * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define new overload. * src/abg-comparison.cc (corpus_diff::report): For functions with sub-type changes report their aliases. Do not do this if the function is a constructor or destructor because these almost always have aliases, at least with GCC and the developer most certainly has not done anything special for that; she would thus be uselessly surprised by that remote implementation detail. * tests/data/test-diff-dwarf/test5-report.txt: Adjust test. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
79383f937c |
Apply suppression specifications to added and removed functions and variables
Until now, specifications for suppressing change reports were applied only to functions and variables that have sub-type changes. Change reports about function and variables that were added or removed could not be suppressed. This patch makes suppression specifications to apply to added and removed functions and variables too. They can also apply to function and variable symbols that are not referenced by any debug info. The patch also fixes some typo and formatting glitches and updates some existing tests accordingly. * include/abg-comparison.h (is_type_suppression) (is_function_suppression): Declare new functions. ({function, variable}_suppression::change_kind): Declare new enum. (function_suppression::{parse_change_kind, get_change_kind, set_change_kind, suppresses_function, suppresses_function_symbol}): Declare new member functions. (variable_suppression::{parse_change_kind, get_change_kind, set_change_kind, suppresses_variable, suppresses_variable, suppresses_variable_symbol}): Declare new member functions. (operator{&,|}): Declare new operators for function_suppression::change_kind and variable_suppression::change_kind enums. (corpus_diff::diff_stats::{num_removed_func_filtered_out, net_num_func_removed, num_added_func_filtered_out, net_num_func_added, num_removed_vars_filtered_out, net_num_vars_removed, num_added_vars_filtered_out, net_num_vars_added, num_removed_func_syms_filtered_out, num_added_func_syms_filtered_out, net_num_removed_func_syms, net_num_added_func_syms, num_added_var_syms_filtered_out, num_removed_vars_filtered_out, net_num_removed_var_syms, net_num_added_var_syms}): Declare new member functions. (corpus_diff::diff_stats::num_changed_vars_filtered_out): Renamed corpus_diff::diff_stats::num_vars_filtered_out into this. (corpus_diff::diff_stats::num_changed_func_filtered_out): Renamed corpus_diff::diff_stats::num_func_filtered_out into this. * src/abg-comparison.cc (is_type_suppression) (is_function_suppression): Define new function. (function_suppression::priv::change_kind): New data member. (function_suppression::priv): Initialize it. (function_suppression::{parse_change_kind, get_change_kind, set_change_kind, suppresses_function, suppresses_function_symbol}): Define new member functions. (operator{&,|}): Define new operators for the new function_suppression::change_kind enum. (function_suppression::suppresses_diff): Re-write this in terms of the new function_suppression::suppresses_function() function. (read_function_suppression): Support reading the new "change_kind" property. (variable_suppression::priv::change_kind_): New data member. (variable_suppression::priv::priv): Initialize it. (variable_suppression::{parse_change_kind, get_change_kind, set_change_kind, suppresses_variable, suppresses_variable_symbol}): Define new member functions. (is_variable_suppression): Define new function. (operator{&,|}): Define new operators for variable_suppression::change_kind enum. (variable_suppression::suppresses_diff): Re-write in terms of the new variable_suppression::suppresses_variable function. (read_variable_suppression): Support reading the new "change_kind" property. (corpus_diff::diff_stats::priv::{num_removed_func_filtered_out, num_added_func_filtered_out, num_removed_vars_filtered_out, num_added_vars_filtered_out, num_removed_func_syms_filtered_out, num_added_func_syms_filtered_out, num_removed_var_syms_filtered_out, num_added_var_syms_filtered_out}): New data members. (corpus_diff::diff_stats::priv::num_changed_func_filtered_out): Renamed the data member num_func_filtered_out into this. (corpus_diff::diff_stats::priv::num_changed_vars_filtered_out): Renamed data member num_vars_filtered_out into this. (corpus_diff::diff_stats::priv::priv): Initialize the new data members. (corpus_diff::diff_stats::{num_removed_func_filtered_out, num_removed_func_filtered_out, net_num_func_removed, net_num_func_added, num_added_func_filtered_out, net_num_func_added, num_removed_vars_filtered_out, num_removed_vars_filtered_out, net_num_vars_removed, num_added_vars_filtered_out, net_num_vars_added, num_removed_func_syms_filtered_out, num_added_func_syms_filtered_out, net_num_removed_func_syms, net_num_added_func_syms, num_added_var_syms_filtered_out, num_removed_vars_filtered_out, net_num_removed_var_syms, net_num_added_var_syms}): Define new member functions. (corpus_diff::diff_stats::num_changed_func_filtered_out): Renamed corpus_diff::diff_stats::num_func_filtered_out into this. (corpus_diff::diff_stats::num_changed_vars_filtered_out): Renamed corpus_diff::diff_stats::num_vars_filtered_out into this. (corpus_diff::diff_stats::{net_num_func_changed, net_num_vars_changed}): Adjust. (corpus_diff::priv::{suppressed_deleted_fns_, suppressed_added_fns_, suppressed_deleted_vars_, suppressed_added_vars_, suppressed_added_unrefed_fn_syms_, suppressed_deleted_unrefed_fn_syms_, suppressed_added_unrefed_var_syms_, suppressed_deleted_unrefed_fn_syms_}): New data members. (corpus_diff::priv::{apply_suppressions_to_added_removed_fns_vars, deleted_function_is_suppressed, added_function_is_suppressed, deleted_variable_is_suppressed, added_variable_is_suppressed, added_unrefed_fn_sym_is_suppressed, deleted_unrefed_fn_sym_is_suppressed, added_unrefed_var_sym_is_suppressed, deleted_unrefed_var_sym_is_suppressed}): Define member functions. (function_is_suppressed, variable_is_suppressed): Define new functions. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute stats for filtered added or removed functions, variables and their symbols. (corpus_diff::priv::emit_diff_stats): Emit diff stats for filtered added or removed functions, variables and symbols. (corpus_diff::report): Support suppressed reports about added or removed functions, variables and symbols. Fixed a typo that was in there for a while. Note that that fix requires updating some regression tests, and the part of this patch that touches regression tests does that. (apply_suppressions): In the overload for corpus_diff, apply the suppression to added or removed functions and variables. * doc/manuals/libabigail-concepts.rst: Update this manual to reflect the changes above. Also, perform an extensive cleanup of the manual to introduce more section titles to make it easier to navigate the document using the table of content. * tests/data/test-abicompat/test2-var-removed-report-0.txt: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Likewise. * tests/data/test-diff-dwarf/test12-report.txt: Likewise. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test19-soname-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test7-report.txt: Likewise. * tests/data/test-diff-dwarf/test8-report.txt: Likewise. * tests/data/test-diff-dwarf/test9-report.txt: Likewise. * tests/data/test-diff-dwarf/test16-syms-only-report.txt: Likewise. * tests/data/test-diff-dwarf/test17-non-refed-syms-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test28-vtable-changes-report-0.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/test13-report.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-v0.o: Add new test material. * tests/data/test-diff-filter/test15-0-report.txt: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test21-compatible-vars-report-0.txt: Likewise. * tests/data/test-diff-filter/test24-compatible-vars-report-1.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-v1.o: Likewise. * test-diff-suppr/test15-suppr-added-fn-0.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-1.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-2.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-3.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-4.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-0.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-1.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-2.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-3.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-4.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-5.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-v0.cc: Likewise. * test-diff-suppr/test15-suppr-added-fn-v1.cc: Likewise. * test-diff-suppr/test16-suppr-removed-fn-v0.o: Likewise. * test-diff-suppr/test16-suppr-removed-fn-v1.o: Likewise. * test-diff-suppr/test16-suppr-removed-fn-0.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-1.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-2.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-3.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-4.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-0.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-1.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-2.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-3.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-4.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-5.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-v0.cc: Likewise. * test-diff-suppr/test16-suppr-removed-fn-v1.cc: Likewise. * test-diff-suppr/test17-suppr-added-var-v0.o: Likewise. * test-diff-suppr/test17-suppr-added-var-v1.o: Likewise. * test-diff-suppr/test17-suppr-added-var-0.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-1.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-2.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-3.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-4.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-report-0.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-1.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-2.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-3.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-4.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-5.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-v0.cc: Likewise. * test-diff-suppr/test17-suppr-added-var-v1.cc: Likewise. * test-diff-suppr/test18-suppr-removed-var-v0.o: Likewise. * test-diff-suppr/test18-suppr-removed-var-v1.o: Likewise. * test-diff-suppr/test18-suppr-removed-var-0.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-1.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-2.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-3.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-4.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-0.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-1.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-2.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-3.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-4.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-5.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-v0.cc: Likewise. * test-diff-suppr/test18-suppr-removed-var-v1.cc: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v0.o: New test input. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v1.o: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-0.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-1.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-2.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-3.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-4.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-0.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-1.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-2.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-3.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-4.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-5.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v0.cc: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v1.cc: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v0.o: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v1.o: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-1.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-2.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-0.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-1.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-2.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-3.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-4.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-5.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v0.cc: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v1.cc: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-v0.o: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-v1.o: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-0.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-1.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-2.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-3.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-4.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-0.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-1.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-2.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-3.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-4.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-5.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-v0.cc: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-v1.cc: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v0.o: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v1.o: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-0.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-1.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-2.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-3.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-4.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-0.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-1.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-2.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-3.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-4.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v0.cc: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v1.cc: Likewise. * tests/data/Makefile.am: Add the new test materials above to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new tests material above to the list of test inputs this harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9e64891731 |
Do not compare static data members when comparing types
The comparison code was too eager in comparing class types because it
was comparing static data members in the process. This was causing
some spurious false positives about functions or variables sub-type
changes. This patch fixes that by not comparing static data members
when comparing class types.
* include/abg-ir.h (class_decl::get_non_static_data_members):
Declare new data members.
* src/abg-comparison.cc
(class_diff::ensure_lookup_tables_populated): Only look at
non-static data members.
(compute_diff): In the overload for class_decl, only compare
non-static data members.
* src/abg-hash.cc (class_decl:#️⃣:operator()): Do not hash
static data members members hashing a class_decl.
* src/abg-ir.cc (class_decl::priv::data_members_): New data
member.
(class_decl::priv::priv): When initializing data members, store
the non-static data members on the side, in the new
class_decl::priv::non_static_data_members_ data member.
(class_decl::get_non_static_data_members): Define member function.
(class_decl::add_data_member): Store the non-static data members
on the side in class_decl::priv::non_static_data_members_.
(equals): In the overload for class_decl, do not take in account
static data members when running the comparison.
* tests/data/test-diff-dwarf/test7-report.txt: Adjust.
* tests/data/test-diff-filter/test12-report.txt: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
|
||
Dodji Seketeli
|
723222568e |
Change the linkage name only when necessary
Up to now the linkage name of a declaration was set to the name of it's underlying symbol. This patch changes that to instead honour what the DW_AT_linkage_name DWARF property says, unless the value of that property is either missing or wrong. * include/abg-ir.h (elf_symbol::get_alias_from_name): Declare new member function. * src/abg-ir.cc (elf_symbol::get_alias_from_name): Define it. * src/abg-dwarf-reader.cc (build_var_decl, build_function_decl): Once the linkage name is supposed to contain the value of the DW_AT_linkage_name attribute, set it the name of the underlying symbol only if value of DW_At_linkage_name is missing or different from the names of all the aliases of the underlying symbol. * tests/data/test-read-dwarf/test2.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
afd0411b64 |
Various white space cleanups
* include/abg-comparison.h: Remove various useless vertical white spaces. * tests/test-diff-dwarf.cc (in_out_spec): Fix indentation of some entries. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
0cd814766b |
Support new 'accessed_through' suppression property
It turned out it's important to be able to suppress changes about types that are reachable from a function parameter only through e.g, a pointer or a reference, so that only changes types that are reachable directly from a function parameter are emitted. This patch adds that feature. While doing this, I noticed this: Suppose a diff node D2 is marked as being redundant with a diff node D1 seen previously. So only D1 is reported; D2 is not, because it's been filtered out, because it's redundant with D1. But then suppose D1 is filtered out, due to a suppression specification. At that point, D2 should not be marked redundant anymore, and should be reported. Of course, the code before this patch was wrongly filtering D2 *and* D1 out. So this patch fixes that. * include/abg-comparison.h (enum type_suppression::reach_kind): Define new enum. (type_suppression::{get_consider_reach_kind, set_consider_reach_kind, get_reach_kind, mark_last_diff_visited_per_class_of_equivalence, clear_last_diffs_visited_per_class_of_equivalence, get_last_visited_diff_of_class_of_equivalence}): Declare new member functions. * src/abg-comparison.cc (diff_has_ancestor_filtered_out) (read_suppression_reach_kind): Define static function. (type_suppression::priv::{consider_reach_kind_, reach_kind_}): Define new data members. (type_suppression::priv::priv): Take a new reach_kind parameter. (type_suppression::type_suppression): Adjust to new prototype of priv constructor. (type_suppression::{get_consider_reach_kind, set_consider_reach_kind, get_reach_kind, set_reach_kind}): Define new member functions. (type_suppression::suppresses_diff): Interpret the result of type_suppression::get_reach_kind() to determine if the suppression specification suppresses a given diff node. (read_type_suppression): Support reading the content of the "accessed_through" property. (diff_context::priv::last_visited_diff_node_): New data member. (diff_context::{mark_last_diff_visited_per_class_of_equivalence, clear_last_diffs_visited_per_class_of_equivalence, get_last_visited_diff_of_class_of_equivalence}): Define new data members. (redundancy_marking_visitor::visit_begin): So if the current diff node has already been visited, but if the previously visited node has been filtered out, then do not mark this node as being redundant. And mark the current diff node as being the last visited one in its class of equivalence. (categorize_redundancy): Clear the map of diff nodes visited per class of equivalence. * doc/manuals/libabigail-concepts.rst: Document the new 'accessed_through' property. * tests/data/test-diff-suppr/test13-suppr-through-pointer-0.suppr: New test input data. * tests/data/test-diff-suppr/test13-suppr-through-pointer-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/libtest13-suppr-through-pointer-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test13-suppr-through-pointer-v{0,1}.cc: Source code of the test input binaries above. * tests/data/test-diff-suppr/test14-suppr-non-redundant-0.suppr: New test input data. * tests/data/test-diff-suppr/test14-suppr-non-redundant-report-0.txt: Likewise. * tests/data/test-diff-suppr/test14-suppr-non-redundant-v{0,1}.o: New test input binaries. * tests/data/test-diff-suppr/test14-suppr-non-redundant-v{0,1}.cc: Source code of the binaries above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
85929105f5 |
Fix redundancy marking for change of types used directly
If a type T is used directly (i.e, not through a pointer or reference) as a function parameter or as a base class, a change in T should never be marked as redundant in that context. Otherwise, the change in that context might be filtered out, possibly hiding real ABI incompatible changes. This patch implements this policy. Also, it turned out in some circumstances, we where marking the first visited diff node of a given class of equivalence of nodes as being redundant, while we should only mark the *subsequently* visited nodes of that class of equivalence as visited. The patch also fixes that. * include/abg-comparison.h (pointer_map): Make this be a map of {size_t, size_t} pairs, rather than {size_t, bool}, so that each pointer in the map can be associated to another one. (diff_context::diff_has_been_visited): Return the pointer to the first diff node of the equivalence class that has been visited. * src/abg-comparison.cc (is_pointer_diff, is_reference_diff) (is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff) (is_child_node_of_function_parm_diff, is_child_node_of_base_diff): Define new static functions. (diff_context::diff_has_been_visited): Return the pointer to the first diff node of the equivalence class that has been visited. (diff_context::mark_diff_as_visited): Save the pointer to the first diff node of a given class of equivalence that has been visited. (redundancy_marking_visitor::visit_begin): If a diff node is a child node of a function parameter diff or base diff node and if it's not a pointer or reference diff node, then do not mark it as redundant. Also, make sure to not mark the first diff node of a given class of equivalence that has been visited, as redundant; only the other subsequent nodes should be marked redundant; we were hitting this case because of an optimization that makes equivalent class diff nodes to share their private (pimpl) data. * tests/data/test-diff-filter/test29-finer-redundancy-marking-v{0,1}.o: New test input binaries. * tests/data/test-diff-filter/test29-finer-redundancy-marking-v{0,1}.cc: Source code of the new test input binaries above. * tests/data/test-diff-filter/test29-finer-redundancy-marking-report-0.txt: New test input. * tests/data/Makefile.am: Add the new test material above to the source distribution. * tests/test-diff-filter.cc (in_out_specs): Make this test harness run over the additional test input above. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
41d0ad035f |
Fix symbols comparison
While working on something else, I noticed that the code for handling copying symbols (and their aliases) was broken, and so comparing two symbols which main name were different by which had aliases that were equal was wrongly resulting in the two symbol being different. I think we shouldn't actually copy symbols and their aliases. Once a symbol is allocated, interested code should just manipulate that symbol by address rather than by value an thus do away with the copying. The patch does that, essentially. In the implementation of a symbol, the aliases as well as the main symbol are now weak pointers, rather than naked pointers. Numerous API entry points that were taking containers of elf_symbol (and were copying elf_symbols over) are not taking containers of smart pointers to elf_symbol. Copying of instances of elf_symbol is now thus disabled. As a result many tests that were exercising elf_symbols (with alias) comparison have been updated. As a result, many empty sub-result of PR libabigail/PR17948 are now fixed. * include/abg-ir.h (elf_symbol_wptr): New typedef. (elf_symbol): Make the constructors and assignment operator private. The type can neither be copied nor created with the new operator. (elf_symbol::create): New static member function. (elf_symbol::{get_main_symbol, get_next_alias, add_alias}): Adjust. ( compute_aliases_for_elf_symbol): Likewise. (elf_symbol::operator=): Make this private. (elf_symbol::get_alias_which_equals): Declare new member function. * src/abg-comp-filter.cc (function_name_changed_but_not_symbol): Adjust. * src/abg-comparison.cc (class_diff::ensure_lookup_tables_populated): Adjust. * src/abg-corpus.cc (corpus::priv::build_unreferenced_symbols_tables): Likewise. * include/abg-dwarf-reader.h (lookup_symbol_from_elf) (lookup_public_function_symbol_from_elf): Adjust. * src/abg-dwarf-reader.cc (lookup_symbol_from_sysv_hash_tab) (lookup_symbol_from_gnu_hash_tab, lookup_symbol_from_elf_hash_tab) (lookup_symbol_from_symtab, lookup_symbol_from_elf) (lookup_public_function_symbol_from_elf) (lookup_public_variable_symbol_from_elf): Adjust. (read_context::lookup_elf_symbol_from_index): Likewise. (read_context::lookup_elf_fn_symbol_from_address): Likewise. (read_context::lookup_elf_var_symbol_from_address): Likewise. (read_context::lookup_public_function_symbol_from_elf): Likewise. (read_context::lookup_public_variable_symbol_from_elf): Likewise. (read_context::load_symbol_maps): Likewise. (build_var_decl, build_function_decl): Likewise. * src/abg-ir.cc (elf_symbol::priv::{main_symbol_, next_alias_}): Change the type of these from elf_symbol* to elf_symbol_wptr. (elf_symbol::priv::priv): Adjust. (elf_symbol::{create, get_alias_which_equals}): Define new functions. (textually_equals): Likewise. (elf_symbol::{get_main_symbol, is_main_symbol, get_next_alias, add_alias}): Adjust to return or take elf_symbol_sptr type, rather than a elf_symbol* one. (elf_symbol::{get_aliases_id_string, does_alias}): Adjust. (compute_alias_for_elf_symbol): Likewise. (elf_symbol::operator==): Two symbols A and B are now equal if A has at least one alias that is textually equal to B. (equals): In the overload for function_decls, in the part where we compare the decl_base part of the functions without considering their decl names, we now also omit considering their linkage names, because we compared they symbols before. * tools/abisym.cc (main): Adjust. * tests/data/test-diff-dwarf/test12-report.txt: Adjust. * tests/data/test-diff-dwarf/test12-report.txt: Adjust. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Adjust. * tests/data/test-diff-dwarf/test8-report.txt: Adjust. * tests/data/test-diff-filter/test10-report.txt: Adjust. * tests/data/test-diff-filter/test13-report.txt: Adjust. * tests/data/test-diff-filter/test2-report.txt: Adjust. * tests/data/test-diff-filter/test20-inline-report-0.txt: Adjust. * tests/data/test-diff-filter/test20-inline-report-1.txt: Adjust. * tests/data/test-diff-filter/test9-report.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d0bd599b4b |
Support specifying data member insertion in suppressions
This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
6ce6f160b5 |
Better detection of parameter sub-type changes
Just looking at if the name of the changed type hasn't changed is not enough for detecting a sub-type change; that will be fooled by compatible changes (changes involving typedefs). So this patch looks through compatible changes for that matter. * include/abg-fwd.h (type_has_sub_type_changes): Declare new function. * src/abg-ir.cc (type_has_sub_type_changes): Define it. * src/abg-comparison.cc (fn_parm_diff::report): Use the new function type_has_sub_type_changes() instead of just looking at name changes. * tests/data/test-diff-dwarf/test4-report.txt: Adjust this reference test output. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5c08779f5d |
Add debugging function for function parameters
* include/abg-ir.h (function_decl::parameter::get_pretty_representation): Declare new virtual member function. * src/abg-ir.cc (function_decl::parameter::get_pretty_representation): Define it. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |