mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-30 05:42:05 +00:00
ccdc44b3eb
378 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Dodji Seketeli
|
4b29b46269 |
Fix a stupid typo in function sorting code
* src/abg-comparison.cc (function_comp::operator()): Fix a typo preventing the proper sorting of function name when their declarator names are equal. Oops. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ba741963b9 |
Use cache type hash values only after type canonicalization is done
Look at this code: struct list; struct payload { int value; list* parent_list; //<-- the hash value of struct list when looking // through this pointer is the non-zero // value as computed on the struct list // type below. }; struct list { payload* p; // <-- While walking the struct list type, the hash // value of the 'struct list' sub-tree node when // looking through this pointer is zero, because we // are still computing the hash value of struct list. // we do it this way to break the otherwise infinite // recursion that might occur here. list* next; // <-- likewise here. list* prev; // <-- likewise here. }; // <-- when we reach this point the hash value of struct list // is computed and is different from zero. Basically, when a type refers to itself in one of its sub-type (like struct list here, where list::p refers to struct list, because its type contains a pointer to struct list), then we need to devise a way to break the infinite recursion we might fall into when computing its hash value. So, when computing the hash value of struct list, when we look at the type of list::prev, which is "list*", we say that the hash value of the type pointed to by the type of list::next (which is struct list itself) is zero. This allows us to break the possibly infinite recursion here. But then, this means that the hash value of "struct list" depends on *when* we request that hash value. If we are computing the hash value of struct list itself, then the temporary value of "struct list" is zero. But then once we are done computing the hash value of "struct list", that value becomes non-zero. Hence, the hash value of a type depends on when that value is computed. But then if we want to cache that hash value and re-use it later, which value should we cache? Definitely not the zero value! So in other words, we can use (and thus cache) the hash value of a given type T only after the hash values of all types which use T have been computed. To satisfy that condition, we decide to use the (cached) hash value of each type only after we've computed all the hash values of all types of the system. So, during type canonicalization, when a type T is canonicalized, this patch stores the hash value of T. But then it's only when all types are canonicalized that the hashing code is allowed to re-use the cached value of types. This fixes the issues of spurious type differences introduced when the same type was read either from DWARF or from abixml. Those differences where introduced by differences in the order of hashing types which sub-types refer to themselves. The patch also updates regression tests accordingly. * src/abg-dwarf-reader.cc (read_debug_info_into_corpus): Before we read debug info and build the IR, set a flag in the environment saying that type canonicalization isn't finished yet. But then, after type canonicalization is done, flip that flag to say that type canonicalization is done. * src/abg-reader.cc (read_corpus_from_input): Likewise. * src/abg-ir.cc (type_base::get_canonical_type_for): Once a type has been canonicalized, cache its hash value. * src/abg-hash.cc (type_base::dynamic_hash::operator()): If type canonicalization has been done and if the type has a cached value, use that one. * tests/data/test-read-dwarf/test2.so.abi: 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
|
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
|
4fb1cb6263 |
Re-arrange some regression tests order
runtestreaddwarf and runtestcanonicalizetypes.sh are now the tests which takes the most time. Run them at the beginning. * tests/Makefile.am: Run runtestreaddwarf and runtestcanonicalizetypes at the beginning. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
49759d3be8 |
Bug 18904 - Fix support for C++ rvalue references
* src/abg-comparison.cc (reference_diff::has_changes): Just compare the references, rather than assuming that the change can only be on underlying types. (reference_diff::report): Describe lvalue/rvalue changes for references. * src/abg-ir.cc (reference_type_def::reference_type_def): Properly set the name for an rvalue reference. (equals): For references, compare lvalue-ness too. (reference_type_def::get_qualified_name): Properly set rvalue reference names. * tests/data/test-diff-filter/test30-pr18904-rvalueref-liba.so: New test input. * tests/data/test-diff-filter/test30-pr18904-rvalueref-libb.so: New test input. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: New test reference output. * tests/data/Makefile.am: Add the new files to source distribution. * tests/test-diff-filter.cc (in_out_specs): Run the new tests. 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
|
a4b9f670fe |
Bug 18892 - type degradation from DWARF to abixml on libtsan.so
abidiff-ing libtsan.so again the output of abidw libtsan.so does not yield the empty set. This is because some types, especially an enum (in certain cases) when read (de-serialized) from DWARF doesn't hash the same as when de-serialized from abixml. This is because an enum type can have a linkage name, referred to by the DW_AT_linkage_name DWARF attribute. This linkage_name was being read from DWARF but wasn't serialized to abixml. At de-serialization time, well, the linkage_name information was lost. Oops. Also, I have seen that in some case we can canonicalize enum types too early, when we de-serialize them from abixml, before we are done building them. This patch addresses these issues. * src/abg-reader.cc (read_context::maybe_canonicalize_type): Late canonicalize enum types. (build_enum_type_decl): Read the linkage name of the enum type. * src/abg-writer.cc (write_enum_type_decl): Emit the linkage name of the enum type. * tests/data/test-read-dwarf/test15-pr18892.so: New binary test input. * tests/data/test-read-dwarf/test15-pr18892.so.abi: New test output reference. * tests/data/Makefile.am: Add the new test inputs above to source distribution. * tests/test-read-dwarf.cc (in_out_specs): Run the two tests above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
60cdabd931 |
Bug 18893 - type degradation from dwarf to abixml on libGLU.so
abidiff-ing libGLU.so against the result of 'abidw libGLU.so' does not yield the empty set. This is because hashing certain types when they are read (de-serialized) from DWARF doesn't give the same result as when they are de-serialized from abixml. I call this type degradation. And it leads to spurious comparison differences. This is due to several issues. 1/ The logical link between a class declaration and its definition -- that is built when reading types from DWARF is not preserved in abixml. So, for example, when a class S refers to itself via a pointer to its declaration, that type might hash differently when read from DWARF and when read from abixml. When read from abixml it's a pointer to S itself. But then that 'self' can be a copy of S that is defined in another file because abixml doesn't enforce the One Definition Rule from C++ either. 2/ As the result of hashing is kept in a cache for var_decl and function_decl, hashing those decl before their types are completely built caches a value that becomes wrong when their type become completely built. 3/ In DWARF, a class which has a virtual member function can still be considered as being declaration-only. And its definition can come later in the DWARF info. Our DWARF reader removes the "declaration-only" flag from a class as soon as it sees virtual member functions in that class; that makes us consider that class as a definition. And then later when we read the real definition of the class we have two classes of the same name, with different layouts/size in the system. This leads to spurious comparison differences too. This patch addresses issues 1, 2 and 3. * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Do not consider that virtual member functions disqualify a class from being declaration-only. * src/abg-hash.cc (var_decl:#️⃣:operator()): Do not cache the result of hashing before we are done building the type of the var_decl. (function_decl:#️⃣:operator()): Likewise, do not cache the result of hashing before we are done building the type of the function_decl. * src/abg-reader.cc (build_class_decl): Build the link between a class declaration and its definition. If there are several definitions of a class in the corpus, keep just one. * src/abg-writer.cc (write_class_is_declaration_only): Emit the link between a class declaration and its definition. (write_class_decl): Emit a class declaration even if it has a definition. The definition is going to be emitted separately. * tests/data/test-read-dwarf/test14-pr18893.so: New binary test input. * tests/data/test-read-dwarf/test14-pr18893.so.abi: New test reference output. * tests/data/Makefile.am: Add the new test input files to source distribution. * tests/test-read-dwarf.cc (in_out_specs): Run the new tests. * 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/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise. 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
|
d8af43b827 |
Do not hash or compare virtual member functions as par of classes
When comparing two classes, do not compare their virtual member
functions anymore, because DWARF might not represent all the virtual
member functions of a class, in a given translation unit.
We still detect changes to virtual member functions (adding or
removing) because the index of a given member function in a vtable is
a property of the member function itself. So if a vtable index
changes on a function, we detect it as part of comparing the exported
member functions themselves. Likewise, if a member function is added
or removed, we detect it; and so if it's a virtual member function
then we detect it too. In a subsequent patch, we'll add a dedicated
section to the report emitted by abidiff for changes to the vtable of
classes, I guess.
For now, this patch fixes some crashes we were having due to
discrepancies in hash values of classes, due to the fact that not all
of their virtual member functions were present in the debug info,
depending on the translation unit of the classes in question.
* src/abg-ir.cc (equals): When comparing two classes, do not
compare their virtual member functions.
* src/abg-hash.cc (class_decl:#️⃣:operator()): Do not hash
virtual member functions when hashing a class.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
|
||
Dodji Seketeli
|
540370c9d1 |
Adjust many reference output for the non-regression test suite
So the last series of patches have changed the test output a lot. This patch adjusts the reference output to have "make check" work again. There is still one test that fails: ./build/tests/runtestreaddwarf. It'll be addressed in subsequent patches from now. * tests/data/test-abidiff/test-enum0-report.txt: Adjust. * tests/data/test-abidiff/test-enum1-report.txt: Adjust. * tests/data/test-abidiff/test-qual-type0-report.txt: Adjust. * tests/data/test-abidiff/test-struct0-report.txt: Adjust. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. * tests/data/test-read-write/test17.xml: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9449d60d9f |
Make test-read-dwarf.cc and test-read-write.cc abidiff the ABIs
use abidiff to compare the ABI of the input ABI against the result of writing that input back into an XML format. It should yield the empty set. I wonder why I haven't done this since the beginning. It turned out we had to fix many things to make it work now. Just using "GNU diff" to compare the output against a reference output is definitely not enough. * tests/test-read-dwarf.cc (main): Use abidiff to compare the input elf file with the XML emitted. That should yield the empty set. * tests/test-read-write.cc (main): Likewise, use abidiff to compare the input abixml file with the one that is emitted. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
72b42c3090 |
Misc style cleanups
* configure.ac: Fix some spelling typos. * src/abg-tools-utils.cc (guess_file_type): Fix indentation. * tests/test-diff-pkg.cc (int_out_specs): Add some vertical spaces for better legibility. * tools/abidiff.cc (main): Add a missing space. * tools/abipkgdiff.cc (extract_deb): Fix a typo in the comment. 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
|
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
|
ae5e1be5c3 |
[dwarf reader] Support reference types without explicit DW_AT_byte_size
On x86_64 at least, in the debug info emitted by Clang, reference types don't necessarily have the DW_AT_byte_size property. In that case, assume the size of the pointer type is the address size of the current translation unit, rather than giving up and not building the type. * src/abg-dwarf-reader.cc (build_reference_type): If the type DIE has no DW_AT_byte_size, assume the type size is the translation unit's address size. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
12123aede6 |
[dwarf reader] Support pointer types without explicit DW_AT_byte_size
On x86_64 at least, in the debug info emitted by Clang, pointer types don't necessarily have the DW_AT_byte_size property. In that case, assume the size of the pointer type is the address size of the current translation unit, rather than giving up and not building the type. * abg-dwarf-reader.cc (build_pointer_type_def): If the type DIE has no DW_AT_byte_size, assume the type size is the translation unit's address size. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ddb17eddba |
Hash a class declaration the same as its definition
A class declaration hashes differently from its definition.
Since the abixml format can now use a class element id before defining
it, it's more consistent to stop representing class declarations in
the abixml format, when the class is actually defined in the corpus.
So this patch now hashes a class declaration the same as its
definition, when the definition is present. If the definition is not
present then the hash value of the declaration is just zero. This is
consistent with what is done elsewhere in the code as a hash value of
zero means the hash could not be computed, somehow, as the type
comparison code knows that a type with hash value zero can be equal to
a type with a hash value that is different from zero.
As a result, many tests which use the abixml format have been adjusted
to reflect the new form of abixml where class declarations are now
omitted when these declarations are accompanied with their definition.
I made sure that abidiff reports that former abixml output and the new
one are equivalent.
After this change abixml outputs should contain less redundant type
declarations. This is another step toward normalizing the abixml
output.
* src/abg-hash.cc (class_decl:#️⃣:operator()(const class_decl&)):
If the class declaration has a definition, hash its definition
instead. Otherwise, if the class declaration has no definition,
just return a zero hash, like what we were doing before.
* src/abg-reader.cc (read_context::maybe_canonicalize_type): Do
not early canonicalize method types because most of the time, when
this function is called, the method hasn't been added to its
parent class yet. So wait until late before canonicalizing.
* src/abg-writer.cc (write_class_is_declaration_only): Do not emit
the "is-declaration-only" property if the declaration has a
definition.
(write_class_decl): If the class declaration has a definition,
emit the definition instead.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
* tests/data/test-read-write/test18.xml: Likewise.
* tests/data/test-read-write/test20.xml: Likewise.
* tests/data/test-read-write/test21.xml: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
|
||
Dodji Seketeli
|
4f5c0326a4 |
Canonicalize all types that got scheduled for late canonicalization
Until now, when late type canonicalization time come (after having read all of the ABI corpus), the types scheduled for late canonicalization were considered and only those that don't have non-canonicalized sub-types were canonicalized. This patch just canonicalizes all the scheduled type. As a result, all types should now be canonicalized, so type comparison should be as fast as a pointer comparison now. But then, loading DWARF is now even longer, type canonicalization needs to happen. * src/abg-dwarf-reader.cc (read_context::canonicalize_types_scheduled): Canonicalize all types scheduled for late canonicalization. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. 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> |
||
Dodji Seketeli
|
ba5b4452d5 |
Bug 18844 - assert failure in abidw at abg-dwarf-reader.cc:6537
The DWARF reader is not scheduling a declaration-only class for resolution when the class has member types. When reading the code of build_class_type_and_add_to_ir(), we see that the scheduling is done before getting out of the function. But then, building members of the class can trigger another invocation of build_class_type_and_add_to_ir() before the current invocation returns. In that case, the declaration-only class being built appears as not being scheduled for resolution. And that is what violates the assertion that declaration-only classes should be scheduled for resolution whenever they are used. This patch addresses the issue by scheduling the resolution earlier, when we know we are dealing with a declaration-only class, and before dealing with members of that classes. * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Schedule declaration-only class resolution before the class appears as usable as to other types being built. * tests/data/test-read-dwarf/test12-pr18844.so: Add a new binary test input. * tests/data/test-read-dwarf/test12-pr18844.so.abi: The reference ABI XML output for the binary above. * tests/data/Makefile.am: Add the new test inputs above to the source distribution. * tests/test-read-dwarf.cc (in_out_specs): Add the new test inputs above to the set of input this test harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fce31333cb |
Fix a little glitch in the test suite
* test-read-dwarf.cc (in_out_specs): Emit the output of the test11 to output/test-read-dwarf/test11-pr18828.so.abi, not output/test-read-dwarf/test10-pr18828.so.abi. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f38c19f8da |
Bug 18828 - Handle force-resolving of multiple declarations-only of the same type
When a declaration-only type that is used in a context where it needs to be complete (and no definition is present for that type in the ABI corpus) handle cases where that type is was actually declared several times. * src/abg-dwarf-reader.cc (read_context::resolve_declaration_only_classes): Accept that a class that needs to be force-resolved might have been declared several times. In that case, some instances of that declaration-only class might have already been resolved (or completed). * tests/data/test-read-dwarf/test11-pr18828.so: New binary input. It comes from bug https://sourceware.org/bugzilla/show_bug.cgi?id=18828. * tests/data/test-read-dwarf/test11-pr18828.so.abi: The reference output for the binary above. * tests/data/Makefile.am: Add the test input files above to source distribution. * tests/test-read-dwarf.cc (in_out_specs): Add the test inputs above to the set of input this test harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
88ae73fdf9 |
Avoid declaring a type several times in the same TU in the XML format
It appears a lot of duplicated type declarations can appear in a given translation unit. This patch avoids that. * src/abg-writer.cc (write_context::{record_type_id_as_emitted, record_type_as_emitted, type_id_is_emitted, type_is_emitted, clear_emitted_types_map}): New member functions. (write_context::m_emitted_type_id_map): New data member. (write_translation_unit): Clear the per-translation unit map of emitted types. Do not emit a type that has already been emitted in this translation unit. (write_namespace_decl): Do not emit a type that has already been emitted in this translation unit. (write_type_decl, write_qualified_type_def) (write_pointer_type_def, write_reference_type_def) (write_array_type_def, write_typedef_decl, write_class_decl) (write_type_tparameter, write_template_tparameter): Record the type we've just written as having been written out. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust as duplicated declarations got removed. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
160961f3cb |
Bug 18818 - abidw aborts on a class with a non-complete base class
On some binaries with debug info emitted by "Ubuntu clang version 3.6.0-2ubuntu1" and "GNU C++ 4.9.2" (as the value of the DW_AT_producer property), it seems some classes can have a base class that is not complete. E.g, the debug info (that I have extracted using the command eu-readelf --debug-dump=info <the-binary-attached-to-the-bug>) has these relevant pieces: [...] [ 5ff7] class_type containing_type (ref4) [ 7485] name (strp) "system_error" byte_size (data1) 40 decl_file (data1) 46 decl_line (data1) 22 [ 6003] inheritance type (ref4) [ 7480] [...] Here, we are looking at the type system_error (actually boost::system::system_error) that inherits the type which DIE is referred to as offset '7480'. Then the definition of the DIE at offset 7480 is: [...] [ 7480] class_type name (strp) "runtime_error" declaration (flag_present) [ 7485] class_type name (strp) "exception" declaration (flag_present) [...] You can see that the type "runtime_error" (actually std::runtime_error) has the flag DW_AT_declaration set, marking it as a declaration (with no definition yet). And no other DIE in the same translation unit (src/third_party/boost-1.56.0/libs/filesystem/src/codecvt_error_category.cpp) or in the same DSO provides the definition for that declaration. I believe this is ill-formed. A base class should be defined and have a layout completed expressed and accessible from the translation unit it's used in. The patch I am proposing detects that the base class is still incomplete when we finish loading the current binary. In that case, the base class is made complete with a size of 1. Meaning it's an empty class (with no data member and no base class). This works as a viable work-around *if* the producer only omitted definitions for empty classes. We'll need to fix the producers eventually. * src/abg-dwarf-reader.cc (read_context::decl_only_classes_to_force_defined_map_): New data member. (read_context::declaration_only_classes_to_force_defined): New accessors. (read_context::schedule_declaration_only_class_for_forced_resolution): New member function. (build_class_type_and_add_to_ir): If a base class is a declaration-only class then mark it as needing to be force-defined *if* it's still not defined at the end of the abi corpus loading. (read_context::resolve_declaration_only_classes): If declaration-only classes that need to force-defined are present and not defined (when we reach the end of the ABI corpus) then force-define them as empty classes. * tests/data/test-read-dwarf/test10-pr18818-gcc.so: New test binary input file. This comes from a user binary submitted to bug https://sourceware.org/bugzilla/show_bug.cgi?id=18818. The original URL to the binary is https://sourceware.org/bugzilla/attachment.cgi?id=8518. * tests/data/test-read-dwarf/test9-pr18818-clang.so: New binary input file. This comes from the same bug report as above. The original URL to the binary is https://sourceware.org/bugzilla/attachment.cgi?id=8511. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: New reference output file. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/Makefile.am: Add the new files above to the source distribution. * tests/test-read-dwarf.cc (in_out_specs): Add the test inputs above the set of tests input this harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
28090bad1b |
Make the support of RPM and DEB package formats conditional
If at configure time the libabigail source tarball detects that rpm2cpio and cpio are present then it enables the support for rpm files. Users can explicitly enable or disable that support by passing --enable-rpm or --disable-rpm to configure. Similarly if it detects that dpkg is present at configure time then it enables the support for deb files. Users can explicitly enable or disable that support by passing --enable-deb or --disable-deb to configure. * config.h.in: Define WITH_DEB and WITH_RPM pre-processor macros. * configure.ac: Add --enable-{rpm,deb} switches. Check for rpm2cpio and cpio programs, unless --disable-rpm was provided. If they are found and if --enable-rpm=auto was provided, then consider that --enable-rpm=yes was provided. In that case, set the WITH_RPM macro to 1. Otherwise, undefine that macro. Similarly, check for dpkg unless --disable-deb was provided. If it's found and if --enable-deb=auto was provided, consider that --enable-deb=yes was provided. In that case, set the WITH_DEB macro to 1. Otherwise, undefine that macro. Define the ENABLE_RPM and ENABLE_DEB conditional automake variables, if the rpm resp. deb support is enabled. Emit a notice about the rpm and deb features being enabled or not, at the end of the configure process. * tests/test-diff-pkg.cc: Include the config.h header. (in_out_spec): Guard rpm tests by the WITH_RPM macro. Similarly, guard deb tests by the WITH_DEB macro. * tools/abipkgdiff.cc: Include the config.h header. (extract_rpm): Guard this function definition with the WITH_RPM macro. (extract_deb): Guard this function definition with the WITH_DEB macro. (extract_package): Guard the handling of rpm packages with the WITH_RPM macro and the handling of deb package with the WITH_DEB macro. If a package not-support package format is encountered, emit an appropriate error message and error out. 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
|
242e49a321 |
Bug 18791 - libabigail fails to read the output of abidw
The reader fails to set the access specifier for a member type. Fixed thus. * src/abg-reader.cc (read_context::get_scope_for_node): Take an access_specifier output parameter to set the access specifier of the current node in its scope. Update the function to set the access_specifier. (read_context::build_or_get_type_decl): Adjust to set the access specifier of the type we are building, in case it's a member type. * tests/data/test-abidiff/test-PR18791-v{0,1}.so.abi: New test input files. * tests/data/test-abidiff/test-PR18791-report0.txt: New test output reference. * tests/data/Makefile.am: Add the new test material to the source distribution. * tests/test-abidiff.cc (specs): Add the new test inputs to the set of input files this test harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9f7c07460d |
Add --no-added-syms to abipkgdiff
With this new option the tool ignores added functions, variables and their symbols. * tools/abipkgdiff.cc (options::show_added_syms): New data member. (options::options): Initialize it. (parse_command_line): Parse the new --no-added-syms option and set the options::show_added_syms flag accordingly. (display_usage): Add a help string for the new option. (set_diff_context_from_opts): Set the diff context according to the state of the new options::show_added_syms flag. * doc/manuals/abipkgdiff.rst: Add manual entry for the new --no-added-syms options. * tests/data/test-diff-pkg/test-rpm-report-5.txt: New test reference input file. * tests/data/Makefile.am: Add the new file above to source distribution. * tests/test-diff-pkg.cc (InOutSpec::prog_options): New data member. (in_out_specs): Adjust. Add a new input to run the test again with --no-added-syms. (main): Adjust to pass the program options contained in InOutSpec::prog_options to abipkgdiff. Signed-off-by: Dodji Seketeli <dodji@redhat.com> fixup! Add --no-added-syms to abipkgdiff 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
|
88a1e8d6a0 |
Make the name of the removed variable section be consistent
The removed functions section is introduced by the string "Removed functions", whereas the removed variables section is introduced by the string "Deleted variables". This patch makes the latter be "Removed variables" just like for the functions. * src/abg-comparison.cc (corpus_diff::report): Introduce the section of removed variables with the string "Removed variable", rather than with the string "Deleted variable". * tests/data/test-abicompat/test2-var-removed-report-0.txt: Adjust. * tests/data/test-diff-suppr/test18-suppr-removed-var-report-0.txt: Likewise. * tests/data/test-diff-suppr/test18-suppr-removed-var-report-3.txt: Likewise. * tests/data/test-diff-suppr/test18-suppr-removed-var-report-5.txt: Likewise. 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
|
819f8941cf |
Show linkage names in abipkgdiff output
With this patch abipkgdiff now shows the linkage names of added/removed functions and variables. In addition, there now is a --no-linkage-name option to avoid seeing linkage names. * doc/manuals/abipkgdiff.rst: Document the new --no-linkage-name options. * tools/abipkgdiff.cc (options::show_linkage_names): New data member. (options::options): Initialize it. (display_usage): Display a usage string for --no-linkage-name. (parse_command_line): Parse the --no-linkage-name option. (set_diff_context_from_opts): Set the diff context accordingly. * tests/data/test-diff-pkg/test-rpm-report-0.txt: Adjust. 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
|
92b821034a |
Clean up the output of abicompat weak mode
Remove ugly vertical spaces from the output of abicompat in weak mode and adjust regression tests accordingly. * tools/abicompat.cc (perform_compat_check_in_weak_mode): Remove disgracious vertical spaces in the wording. * tests/data/test-abicompat/test5-fn-changed-report-0.txt: Adjust. * tests/data/test-abicompat/test6-var-changed-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
af2a94defa |
Fix computing the set of exported functions and varible symbols
Sinny Kumari reported that abicompat is failing to report ABI changes on a library linked to a small test program. It turned out that the code that compute if a given exported function is to be kept by looking at the white list of symbols to keep has a bug in which the versions of the symbols of the white list were not being reset as they should. Fixed thus. * src/abg-ir.cc (elf_symbol::get_name_and_version_from_id): Always set the version and name of the symbol. * src/abg-corpus.cc (corpus::exported_decls_builder::{keep_wrt_id_of_fns_to_keep, keep_wrt_id_of_vars_to_keep}): Reset the symbol name *and* version before passing it. This is redundant with the fix in elf_symbol::get_name_and_version_from_id() that always set the symbol name and version now, but I felt it makes it easier to understand the fix overall. * tests/data/test-abicompat/libtest7-fn-changed-libapp-v{0,1}.so: New test input binaries. * tests/data/test-abicompat/test7-fn-changed-app: Likewise. * tests/data/test-abicompat/test7-fn-changed-{app, libapp-v0, libapp-v1}.c: Source code of the binary test inputs above. * * tests/data/test-abicompat/test7-fn-changed-{libapp-v0, libapp-v1}.h: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-0.txt: Test input. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-abicompat.cc (int_out_specs): Add the test inputs above to the set of inputs this test harness has to run over. 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> |
||
Sinny Kumari
|
260b92f5df |
Add regression tests for abipkgdiff tool
Add tests for the abipkgdiff tool. The tests runs abipkgdiff on RPM packages. RPMs for test data are taken from Fedora koji build with build id - 106158 and 648058 * tests/Makefile.am: Build new runtestdiffpkg regression test * tests/data/Makefile.am: Add new test files to source * tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm: Test data for abipkgdiff tool * tests/data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm: Likewise * tests/data/test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: Likewise * tests/data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: Likewise * tests/data/test-diff-pkg/test-rpm-report-0.txt: Expected test output * tests/data/test-diff-pkg/test-rpm-report-1.txt: Likewise * tests/data/test-diff-pkg/test-rpm-report-2.txt: Likewise * tests/data/test-diff-pkg/test-rpm-report-3.txt: Likewise * tests/data/test-diff-pkg/test-rpm-report-4.txt: Likewise * tests/test-diff-pkg.cc: New file Signed-off-by: Sinny Kumari <sinny@redhat.com> |
||
Dodji Seketeli
|
f154ff8db1 |
Remove extra vertical spaces from diff report
* src/abg-comparison.cc (class_diff::report): Do not emit new line unless the diff is to be reported. * tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: Adjust. * tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt: Adjust. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt: : Adjust. Signed-off-by: Dodji Seketeli <dodji@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
|
f2175b70cc |
Adjust some tests for output changes
After commit "8a4b0c9 Fix missing newlines in diff report", I forgot to adjust some test reference outputs, leading to some test failures. Fixed thus. * tests/data/test-abidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-dwarf/test10-report.txt: Likewise. * tests/data/test-diff-dwarf/test11-report.txt: Likewise. * tests/data/test-diff-dwarf/test13-report.txt: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt: Likewise. * tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.txt: Likewise. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt: Likewise. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt: Likewise. 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
|
4bc7b5bbea |
Misc typo fixes
* src/abg-comparison.cc (corpus_diff::priv::{deleted, added}n_variable_is_suppressed): Fix a typo. * tests/data/test-diff-dwarf/test16-syms-only-v0.cc: Fix a typo in the comments. * tests/data/test-diff-dwarf/test16-syms-only-v1.cc: Likewise. 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
|
088f0778bc |
Build libabigail tests with position-independent code
Like what we just did for libabigail tools, build the non-regression tests with the -fPIC option to please the Fedora Rawhide builds. * tests/Makefile.am: Add -fPIC to the compile flags. 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
|
ad0ec3fd20 |
Report vtable changes in top-level function change reports
Up to know we were not reporting vtable changes on top-level function change reports. This patch adds that feature. * src/abg-comparison.cc (function_decl_diff::report): Report about virtual-ness and vtable offset changes. * tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: New test input file. * tests/data/test-diff-dwarf/test28-vtable-changes-v{0,1}.o: New test input binaries. * tests/data/test-diff-dwarf/test28-vtable-changes-v{0,1}.cc: Source code of the input binaries above. * tests/data/Makefile.am: Add the new test input above to source distribution. * tests/test-diff-dwarf.cc (in_out_specs): Add the new test input above to the list of input this test harness has to run over. 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
|
318b31db5d |
Fix detection of local changes in base classes
It appears we were flagging too many base class changes as local. That was preventing some change category propagation through base class diff nodes. This patch fixes that. * abg-ir.cc (equals): In the overload of class_decl::base_spec, if the underlying class carries changes, then do not flag these changes as local for the class_decl::base_spec. * tests/data/test-diff-dwarf/test27-local-base-diff-v{0,1}.o: New test input binaries. * tests/data/test-diff-dwarf/test27-local-base-diff-v{0,1}.cc: Source code for the test input binaries above. * tests/data/test-diff-dwarf/test27-local-base-diff-report.txt: New test input. * tests/data/Makefile.am: Add the test inputs above to source distribution. 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
|
8cc7a3e8ef |
Make indexes of function parameters start at 1
This patch make indexes of a function parameters start at 1, rather at 0 like they used to be. Actually, for member functions, the artificial implicit 'this' pointer parameter starts at 0. In that case, the first non-implicit parameter starts at 1 too, then. The biggest part of the patch adjusts the numerous test cases that are impacted. * src/abg-ir.cc (function_type::function_type): Starts the index of the parameters at 1, unless the firs parameter is an artificial one, in which case it starts at 0. * tests/data/test-abicompat/test5-fn-changed-report-0.txt: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. * tests/data/test-diff-dwarf/test1-report.txt: Adjust. * tests/data/test-diff-dwarf/test10-report.txt: Adjust. * tests/data/test-diff-dwarf/test11-report.txt: Adjust. * tests/data/test-diff-dwarf/test13-report.txt: Adjust. * tests/data/test-diff-dwarf/test15-enum-report.txt: Adjust. * tests/data/test-diff-dwarf/test2-report.txt: Adjust. * tests/data/test-diff-dwarf/test20-add-fn-parm-report-0.txt: Adjust. * tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: Adjust. * tests/data/test-diff-dwarf/test22-changed-parm-c-report-0.txt: Adjust. * tests/data/test-diff-dwarf/test24-added-fn-parms-report-0.txt: Adjust. * tests/data/test-diff-dwarf/test25-removed-fn-parms-report-0.txt: Adjust. * tests/data/test-diff-dwarf/test26-added-parms-before-variadic-report.txt: Adjust. * tests/data/test-diff-dwarf/test4-report.txt: Adjust. * tests/data/test-diff-dwarf/test6-report.txt: Adjust. * tests/data/test-diff-dwarf/test7-report.txt: Adjust. * tests/data/test-diff-dwarf/test8-report.txt: Adjust. * tests/data/test-diff-filter/test0-report.txt: Adjust. * tests/data/test-diff-filter/test01-report.txt: Adjust. * tests/data/test-diff-filter/test1-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/test14-0-report.txt: Adjust. * tests/data/test-diff-filter/test14-1-report.txt: Adjust. * tests/data/test-diff-filter/test16-report-2.txt: Adjust. * tests/data/test-diff-filter/test16-report.txt: Adjust. * tests/data/test-diff-filter/test17-0-report.txt: Adjust. * tests/data/test-diff-filter/test17-1-report.txt: Adjust. * tests/data/test-diff-filter/test18-report.txt: Adjust. * tests/data/test-diff-filter/test19-enum-report-1.txt: Adjust. * tests/data/test-diff-filter/test2-report.txt: Adjust. * tests/data/test-diff-filter/test22-compatible-fns-report-0.txt: Adjust. * tests/data/test-diff-filter/test23-redundant-fn-parm-change-report-0.txt: Adjust. * tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: Adjust. * tests/data/test-diff-filter/test25-cyclic-type-report-1.txt: Adjust. * tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt: Adjust. * tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.txt: Adjust. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt: Adjust. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt: Adjust. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt: Adjust. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt: Adjust. * tests/data/test-diff-filter/test3-report.txt: Adjust. * tests/data/test-diff-filter/test9-report.txt: Adjust. * tests/data/test-diff-suppr/test0-type-suppr-report-0.txt: Adjust. * tests/data/test-diff-suppr/test0-type-suppr-report-3.txt: Adjust. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Adjust. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Adjust. * tests/data/test-diff-suppr/test10-changed-parm-c-report-0.txt: Adjust. * tests/data/test-diff-suppr/test2-struct-suppr-report-0.txt: Adjust. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Adjust. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Adjust. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Adjust. * tests/data/test-diff-suppr/test4-local-suppr-report-0.txt: Adjust. * tests/data/test-diff-suppr/test4-local-suppr-report-1.txt: Adjust. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust. * tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Adjust. * tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Adjust. * tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Adjust. * tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Adjust. * tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Adjust. * tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: Adjust. * tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: Adjust. * tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: Adjust. * tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: Adjust. * tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Adjust. * tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt: Adjust. * tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt: Adjust. * tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a05384675c |
Type read from DWARF don't have alignment information
Types read from DWARF don't have any alignment information so we
shouldn't try to guess it, especially for structures. So this patch
sets the alignment to zero in that case. This helps remove some
spurious alignment changes detected by abidiff just because in some
cases we fail to guess that.
In the process, I noticed that when calculating the hash value of a
given data member, we were not including the hash value of its
context. This led to mistakenly considering some data member changes
as redundant. So the patch fixes that too.
* src/abg-dwarf-reader.cc (build_type_decl)
(build_class_type_and_add_to_ir, build_pointer_type_def)
(build_reference_type, build_function_decl): Set the alignment for
native types, class, reference and function type to zero,
effectively meaning that they don't have alignment information.
* src/abg-hash.cc (var_decl:#️⃣:operator): Take the hash value
of the data member context in account when computing the hash
value of a given data member.
* tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt:
Adjust.
* tests/data/test-diff-dwarf/test10-report.txt: Likewise.
* tests/data/test-diff-dwarf/test13-report.txt: Likewise.
* tests/data/test-diff-dwarf/test22-changed-parm-c-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test26-added-parms-before-variadic-report.txt: Likewise.
* tests/data/test-diff-dwarf/test8-report.txt: Likewise.
* tests/data/test-diff-dwarf/test9-report.txt: Likewise.
* tests/data/test-diff-filter/test13-report.txt: Likewise.
* tests/data/test-diff-filter/test6-report.txt: Likewise.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt: Likewise.
* tests/data/test-read-dwarf/test0.abi: Likewise.
* 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
|
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
|
9b4d20db90 |
Bug 18342 - Segmentation fault while comparing functions with variadic parameters
In the IR built from DWARF, a variadic variadic parameter has an empty type. Later during type comparison, comparing an empty (NULL) type with other types proves to be troublesome. This patch handles the issue by creating a new kind of abigail::type_decl type specifically for variadic parameters. This is like what is done for void types. After that it appears that the categorizing sub-system flags a change of variadic type to non-variadic type as redundant if that change appears several times on different functions. We don't want that because it can hide important changes we want to see. The patch fixes that too. * include/abg-fwd.h (is_array_type): New overload for a naked pointer. * include/abg-ir.h (type_decl::get_variadic_parameter_type_decl): Declare new static function. * src/abg-ir.cc (is_array_type): Define new function overload for naked pointers (type_decl::get_variadic_parameter_type_decl): Define new static function. * src/abg-dwarf-reader.cc (build_function_decl): The type of variadic parameter is now a special type_decl. * include/abg-comparison.h (is_diff_of_variadic_parameter_type) (is_diff_of_variadic_parameter): New function declarations. * src/abg-comparison.cc (is_diff_of_variadic_parameter_type) (is_diff_of_variadic_parameter): Define new functions. (compute_diff): Refuse to return a NULL diff for types. Assert that the parameters are non-NULL. (report_size_and_alignment_changes): We are comparing arrays only if the two parameters are arrays. (fn_parm_diff::fn_parm_diff): Refuse that type diff for this diff node is non empty. (fn_parm_diff::report): Strengthen an assert. Cleanup a comment. (redundancy_marking_visitor::visit_begin): Do not mark function type and variadic parms diff nodes as redundant for local changes. * tests/data/test-diff-dwarf/libtest26-added-parms-before-variadic-v{0,1}.so: New test input binaries. * tests/data/test-diff-dwarf/test26-added-parms-before-variadic-report.txt: New test output reference. * tests/data/test-diff-dwarf/test26-added-parms-before-variadic-v{0,1}.c: Source code of the new test input binaries above. * tests/data/Makefile.am: Add the new test stuff to source distribution. * tests/test-diff-dwarf.cc (in_out_specs): Add the new test inputs above to the set of input to run this test harness over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
18bbfb5ec3 |
Fix archive writing support
The runtestwritereadarchive test is failing on Rawhide (Fedora 23) for me now. It appears it was because the content to write to the zip archive is in a buffer which is stored in a vector of buffers. When the vector grows, the buffers are potentially copied over, and the old buffers are destroyed, making the address of the old buffers being stalled. But then those old address are used by the code that write stuff in the zip archive. Ooops. This patch essentially replaces the vector of buffer with a list, so that growing the list doesn't invalidate the buffers. The patch also does away with using deprecated APIs of libzip. * configure.ac: Require libzip 0.10.1 at least. * src/abg-writer.cc (archive_write_ctxt::serialized_tus): Make this be a list<string>, rather than a vector<string>. (create_archive_write_context): Truncate the archive if it exists already. (write_translation_unit_to_archive): Do not use the deprecated zip_add() function anymore. Rather, use zip_file_add(). * tests/test-write-read-archive.cc (main): Double check if the translation unit we read is empty or not. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
6baecca506 |
18252 - Added parameters are not properly sorted
In the changed functions/variables section of the abidiff report, when function parameters were added or removed, they were not properly sorted. This patch fixes that. * src/abg-comparison.cc (sort_string_parm_map): Define new static function. (struct parm_comp): Define new type. (function_type_diff::priv::{sorted_deleted_parms_, sorted_added_parms_}): New data members that hold sorted deleted/added parameters. (function_type_diff::ensure_lookup_tables_populated): Initialize the two new data members above. (function_type_diff::report): For the report of parameters that got added/removed, use the sorted set of added/removed parameters above. * tests/data/test-diff-dwarf/test24-added-fn-parms-report-0.txt: New test input. * tests/data/test-diff-dwarf/libtest24-added-fn-parms-v{0,1}.so: Likewise. * tests/data/test-diff-dwarf/test25-removed-fn-parms-report-0.txt: Likewise. * tests/data/test-diff-dwarf/libtest25-removed-fn-parms-v{0,1}.so: Likewise. * tests/data/test-diff-dwarf/test24-added-fn-parms-v{0,1}.c: Likewise. * tests/data/test-diff-dwarf/test25-removed-fn-parms-v{0,1}.c: Likewise. * tests/data/Makefile.am: Add the new test material above to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
21adfb066f |
Misc reporting fixes/improvements
This patch contains various reporting improvement about how variables and data member changes are represented, as well as how type changes are represented. The number changes itself is not that big, but the number of adjustments to regression test is. * src/abg-comparison.cc (distinct_diff::report): Remove spurious vertical space before reporting size and alignment changes here. (represent): In the variables/data member overload, report type changes first. Then the other changes. (report_size_and_alignment_changes): Make this report array size changes too. Also, make some small adjustments about how type size/alignment changes are introduced. (array_diff::report): Now that report_size_and_alignment_changes() supports size change reporting, just use that function rather than doing it here. (corpus_diff::report): Consistently add a space between each changed function report. Prefix changed variables with a [C], just like for functions. * tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust. * tests/data/test-abicompat/test5-fn-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test6-var-changed-report-0.txt: Likewise. * tests/data/test-abidiff/test-qual-type0-report.txt: Likewise. * tests/data/test-abidiff/test-struct0-report.txt: Likewise. * tests/data/test-abidiff/test-struct1-report.txt: Likewise. * tests/data/test-abidiff/test-var0-report.txt: Likewise. * tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test0-report.txt: Likewise. * tests/data/test-diff-dwarf/test1-report.txt: Likewise. * tests/data/test-diff-dwarf/test10-report.txt: Likewise. * tests/data/test-diff-dwarf/test11-report.txt: Likewise. * tests/data/test-diff-dwarf/test13-report.txt: Likewise. * tests/data/test-diff-dwarf/test15-enum-report.txt: Likewise. * tests/data/test-diff-dwarf/test2-report.txt: Likewise. * tests/data/test-diff-dwarf/test20-add-fn-parm-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test22-changed-parm-c-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test3-report.txt: Likewise. * tests/data/test-diff-dwarf/test6-report.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-filter/test0-report.txt: Likewise. * tests/data/test-diff-filter/test01-report.txt: Likewise. * tests/data/test-diff-filter/test1-report.txt: Likewise. * tests/data/test-diff-filter/test10-report.txt: Likewise. * tests/data/test-diff-filter/test11-report.txt: Likewise. * tests/data/test-diff-filter/test13-report.txt: Likewise. * tests/data/test-diff-filter/test14-0-report.txt: Likewise. * tests/data/test-diff-filter/test14-1-report.txt: Likewise. * tests/data/test-diff-filter/test15-0-report.txt: Likewise. * tests/data/test-diff-filter/test15-1-report.txt: Likewise. * tests/data/test-diff-filter/test16-report-2.txt: Likewise. * tests/data/test-diff-filter/test16-report.txt: Likewise. * tests/data/test-diff-filter/test17-0-report.txt: Likewise. * tests/data/test-diff-filter/test17-1-report.txt: Likewise. * tests/data/test-diff-filter/test18-report.txt: Likewise. * tests/data/test-diff-filter/test19-enum-report-1.txt: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test20-inline-report-1.txt: Likewise. * tests/data/test-diff-filter/test21-compatible-vars-report-0.txt: Likewise. * tests/data/test-diff-filter/test22-compatible-fns-report-0.txt: Likewise. * tests/data/test-diff-filter/test23-redundant-fn-parm-change-report-0.txt: Likewise. * tests/data/test-diff-filter/test24-compatible-vars-report-1.txt: Likewise. * tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: Likewise. * tests/data/test-diff-filter/test25-cyclic-type-report-1.txt: Likewise. * tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt: Likewise. * tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.txt: Likewise. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-0.txt: Likewise. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt: Likewise. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt: Likewise. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt: Likewise. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt: Likewise. * tests/data/test-diff-filter/test3-report.txt: Likewise. * tests/data/test-diff-filter/test6-report.txt: Likewise. * tests/data/test-diff-filter/test9-report.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test10-changed-parm-c-report-0.txt: Likewise. * tests/data/test-diff-suppr/test2-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise. * tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Likewise. * tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt: Likewise. * tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt: Likewise. * tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fc55e7f343 |
Make abidiff and abicompat return meaningful exit codes
As per https://sourceware.org/bugzilla/show_bug.cgi?id=18146, abidiff the exit code of abidiff and abicompat is now a bit field that can be inspected to know if the ABI change reported is incompatible for sure, or if it needs user review of the output to decide. This patch also updates the documentation. * doc/manuals/abicompat.rst: Update documentation for abicompat exit codes. * doc/manuals/abidiff.rst: Likewise for abidiff exit codes. * include/abg-tools-utils.h (enum abidiff_status): Declare new enum. (operator{|,&,|=}): Declare new operators for the new enum abidiff_status. (abidiff_status_has_error, abidiff_status_has_abi_change) (abidiff_status_has_incompatible_abi_change): Declare new functions. * src/abg-tools-utils.cc (operator{|,&,|=}): Define these new operators. (abidiff_status_has_error, abidiff_status_has_abi_change) (abidiff_status_has_incompatible_abi_change): Define new functions. * tests/test-diff-filter.cc (main): Adjust for the new exit code of abidiff. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-abicompat.cc (main): Likewise. * tools/abicompat.cc (enum abicompat_status): Remove. (operator{|,&,|=}): Remove these operators for enum abicompat_status. (perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode): Return abidiff_status instead of abicompat_status. Adjust therefore. (main): Adjust to return abidiff_status now, instead of a just zero for all non-error cases. * tools/abidiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a102a2f032 |
Add support for abicompat weak mode
This patch implements the weak mode of abicompat. In this mode, just the application and the new version of the library are provided. The types of functions and variables of the library that are consumed by the application are compared to the types of the functions and variables expected by the application. The goal is to check if the types of the declarations consumed by the application and provided by the library are compatible with what the application expects. The abicompat first gets the set of symbols undefined in the application and exported by the library. It then builds the set of declarations exported by the library that have those symbols. We call these the set of declarations of the library that are consumed by the application. Note that the debug information for the application does not contain the declarations of the functions/variables whose symbols are undefined. So we can not just read them to compare them to declarations exported by the library. But the *types* of the variables and the *sub-types* of the functions whose symbols are undefined in the application are present in the debug information of the application. So in the weak mode, abicompat compare the *types* of the declarations consumed by the application as expected by the application (described by the debug information of the application) with the types of the declarations exported by the library. To do this a number of changes were necessary. The patch builds a representation of all the types found in the application's debug info. Before that, only the types that are reachable from exported declarations were represented. The abidw tool got a new --load-all-types to test this new ability of loading all types. The patch also adds support for looking a type, not by name, but by its internal representation. In the comparison engine, function_type_diff is introduced to represent changes between two function types. For this, a new class type_or_decl_base has been introduced in the IR. It's now the base class for both decl_base and type_base. And abigail::comparison::diff now takes two pointers of type_or_decl, not decl_base anymore. So function_type_diff can take two function_type now; not that a function_type has no declaration so it doesn't inherit decl_base. A bunch of changes got made just to adjust to this modification. A number of fixes were made too, to make this work, like adding missing comparison operators, removing asserts that too strong, etc.. The patch also adjust the test suite as well as the documentation. * include/abg-fwd.h (class type_or_decl_base): Forward declare this. (is_decl, is_type, is_function_type, get_name, get_type_name) (get_function_type_name, get_pretty_representation) (lookup_function_type_in_corpus, lookup_type_in_translation_unit) (lookup_function_type_in_translation_unit) (synthesize_function_type_from_translation_unit) (hash_type_or_decl): New function declarations. * src/abg-corpus.cc (lookup_type_in_corpus) (lookup_function_type_in_corpus): Define new functions. * include/abg-ir.h (translation_unit::lookup_function_type_in_translation_unit): Declare new friend function. (class type_or_decl_base): Declare this. (operator==(const type_or_decl_base&, const type_or_decl_base&)): Declare new operator. (operator==(const type_or_decl_base_sptr&, const type_or_decl_base_sptr&)): Likewise. (class {decl_base, type_base}): Make these class inherit type_or_decl_base. (decl_base::get_member_scopes): New const overload. (bool operator==(const function_decl::parameter_sptr&, const function_decl::parameter_sptr&)): New operator. (function_type::get_parameters): Remove the non-const overload. (function_type::get_pretty_representation): Declare new member function. (method_type::get_pretty_representation): Likewise. * src/abg-ir.cc (bool operator==(const type_or_decl_base&, const type_or_decl_base&)): Define new equality operator. (bool operator==(const type_or_decl_base_sptr&, const type_or_decl_base_sptr&)): Likewise. (strip_typedef): Do not expect canonicalized types anymore. Now the system accepts (and expects) canonicalized types in certain cases. For instance, non-complete types and aggregated types that contain non-complete sub-types. (get_name, get_function_type_name, get_type_name) (get_pretty_representation, is_decl, is_type, is_function_type) (lookup_function_type_in_translation_unit) (synthesize_function_type_from_translation_unit) (lookup_type_in_scope, lookup_type_in_translation_unit): Define new functions or new overloads. (bool operator==(const function_decl::parameter_sptr&, const function_decl::parameter_sptr& r)): Define new operator. (function_type::get_parameters): Remove non-const overload. (function_type::get_pretty_representation): Define new function. (function_type::traverse): Adjust. (method_type::get_pretty_representation): Likewise. (function_decl::get_pretty_representation): Avoid emitting the type of cdtors. (hash_type_or_decl): Define new function. * include/abg-dwarf-reader.h (create_read_context) (read_corpus_from_elf): Take a new 'read_all_types' flag. * src/abg-dwarf-reader.cc (read_context::load_all_types_): New flag. (read_context::read_context): Initialize it. (read_context::canonical_types_scheduled): If some types still have non-canonicalized sub-types, then do not canonicalize them. (read_context::load_all_types): New member functions. (build_function_decl): Do not represent void return type like empty type anymore, rather, represent it like a void type node. (build_ir_node_from_die): When asked, load all types including those that are not reachable from an exported declaration. (create_read_context, read_corpus_from_elf): Take a new 'load_all_types' flag and honour it. * src/abg-reader.cc (read_context::type_is_from_translation_unit): Support looking up function types in the current translation unit, now that we now how to lookup function types. * include/abg-comparison.h (diff_context::{has_diff_for, add_diff, set_canonical_diff_for, set_or_get_canonical_diff_for, get_canonical_diff_for}): Make these take instances of type_or_decl_base_sptr, instead of decl_base_sptr. (diff::diff): Likewise. (diff::{first_subject, second_subject}): Make these return type_or_decl_base_sptr instead of decl_base_sptr. (type_diff_base::type_diff_base): Make these take instances of type_or_decl_base_sptr instead of decl_base_sptr. (distinct_diff::distinct_diff): Likewise. (distinct_diff::{first, second}): Make these return type_or_decl_base_sptr instead of decl_base_sptr. (distinct_diff::entities_are_of_distinct_kinds): Make these take instances of type_or_decl_base_sptr instead of decl_base_sptr. (class function_type_diff): Create this new type. It's a factorization of the function_decl_diff type. * src/abg-comparison.cc (): * src/abg-comp-filter.cc ({harmless, harmful}_filter::visit): Adjust as diff::{first,second}_subject() now returns a type_or_decl_base_sptr, no more a decl_base_sptr. (decls_type, decls_diff_map_type): Remove these typedefs and replace it with ... (types_or_decls_type, types_or_decls_diff_map_type): ... these. (struct {decls_hash, decls_equals): Remove these type sand replace them with ... (struct {types_or_decls_hash, types_or_decls_equals}): ... these. ({type_suppression, variable_suppression}::suppresses_diff): Adjust. (diff_context::priv::decls_diff_map): Replace this with ... (diff_context::priv::types_or_decls_diff_map): ... this. (diff_context::{has_diff_for, add_diff, get_canonical_diff_for, set_canonical_diff_for, set_or_get_canonical_diff_for}): Take type_or_decl_base_sptr instead of decl_base_sptr. (diff::priv::{first, second}_subject): Make the type of these be type_or_decl_base_sptr, no more decl_base_sptr. (diff::priv::priv): Adjust for the subjects of the diff being of type type_or_decl_sptr now, no more decl_base_sptr. (diff_less_than_functor::operator()(const diff_sptr, const diff_sptr) const): Adjust. (diff::diff): djust for the subjects of the diff being of type type_or_decl_sptr now, no more decl_base_sptr. (diff::{first,second}_subject): Make the type of these be type_or_decl_base_sptr, no more decl_base_sptr. (report_size_and_alignment_changes): Likewise. (type_diff_base::type_diff_base): Make the type of this be type_or_decl_base_sptr instead of type_base_sptr. (distinct_diff::distinct_diff): Make this take instances of type_or_decl_base_sptr instead of decl_base_sptr. (distinct_diff::{first, second, entities_are_of_distinct_kinds}): Likewise. (distinct_diff::has_changes): Simplify logic. (distinct_diff::report): Adjust. (compute_diff_for_types): Add an additional case to support the new function_type. (report_size_and_alignment_changes): Make this take instances of type_or_decl_base_sptr instead of decl_base_sptr. (class_diff::priv::member_type_has_changed): Return an instance of type_or_decl_base_sptr rather than a decl_base_sptr. (class_diff::report): Adjust. (diff_comp::operator()(const diff&, diff&) const): Adjust. (enum function_decl_diff::priv::Flags): Remove. (function_decl_diff::priv::{first_fn_flags_, second_fn_flags_, fn_flags_changes_}): Remove. (function_decl_diff::priv::{fn_is_declared_inline_to_flag, fn_binding_to_flag}): Remove. (function_decl_diff::{deleted_parameter_at, inserted_parameter_at}): Remove. (function_decl_diff::ensure_lookup_tables_populated): Empty this. (function_decl_diff::chain_into_hierarchy): Adjust. (function_decl_diff::function_decl_diff): This now only takes the subjects. It's body is now empty. (function_decl_diff::{return_type_diff, subtype_changed_parms, removed_parms, added_parms, type_diff}): Remove these member functions. (function_decl_diff::type_diff): Define new member function. (function_decl_diff::report): Simplify logic by using the reporting of the child type diff node. (compute_diff): Likewise, in the overload for function_decl_sptr simplify logic by using the child type diff object. (function_type_diff::priv): Define new type. (function_type_diff::{function_type_diff, ensure_lookup_tables_populated, deleted_parameter_at, inserted_parameter_at, finish_diff_type, first_function_type, second_function_type, return_type_diff, subtype_changed_parms, removed_parms, added_parms, get_pretty_representation, has_changes, has_local_changes, report, chain_into_hierarchy}): Define new functions. (compute_diff): Define new overload for function_type_sptr. * tools/abicompat.cc (options::weak_mode): New data member. (options::options): Initialize it. (enum abicompat_status): New enum (abicompat_status operator|(abicompat_status, abicompat_status)) (abicompat_status& operator|=(abicompat_status &, abicompat_status)) (abicompat_status operator&(abicompat_status, abicompat_status)): New operators to manipulate the abicompat_status enum. (display_usage): Add help string for the new --weak-mode option. (parse_command_line): Add the new --weak-mode command line argument. If the tool is called with just the application and one library then assume that we are in the weak mode. (perform_compat_check_in_normal_mode): Define new function, factorized from what was in the main function. (perform_compat_check_in_weak_mode): Define new function. (struct {fn,var}_change): Define new types. (main): Use perform_compat_check_in_weak_mode() and perform_compat_check_in_normal_mode(). * tools/abidiff.cc (main): Adjust. * tools/abidw.cc: (options::load_all_types): Add new data member. (options::options): Initialize it. (display_usage): New help string for --load-all-types. (parse_command_line): Support the new --load-all-types option. (main): Adjust and honour the --load-all-types option. * tools/abilint.cc (main): Adjust. * doc/manuals/abicompat.rst: Update documentation for the new weak mode. Also provide stuff that was missing from the examples provided. * doc/manuals/abidw.rst: Update documentation for the new --load-all-types option. * tests/print-diff-tree.cc (main): Adjust. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/data/test-abicompat/test0-fn-changed-app: Recompile this. * tests/data/test-abicompat/libtest5-fn-changed-libapp-v{0,1}.so: New new test input binaries * tests/data/test-abicompat/test5-fn-changed-app: Likewise. * tests/data/test-abicompat/test6-var-changed-app: Likewise. * tests/data/test-abicompat/libtest6-var-changed-libapp-v{0,1}.so: Likewise. * tests/data/test-abicompat/test5-fn-changed-report-0.txt: Reference output for one test above. * tests/data/test-abicompat/test6-var-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test5-fn-changed-app.cc: Source file for a binary above. * tests/data/test-abicompat/test5-fn-changed-libapp-v{0,1}.{h,cc}: Likewise. * tests/data/test-abicompat/test6-var-changed-libapp-v{0,1}.{cc,h}: Likewise. * tests/data/test-abicompat/test6-var-changed-app.cc: Likewise. * tests/data/Makefile.am: Add the test related files above to the source distribution. * tests/test-abicompat.cc (in_out_spec): Add the new test input above to the list of inputs to feed to this test harness. (main): Support taking just the app and one library. * tests/data/test-read-dwarf/test{0, 1, 2.so, 3.so, 5.o, 8-qualified-this-pointer.so,}.abi: Adjust for void type being really emitted now, as opposed to just being an empty type. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji
|
2486b210ff |
PR libabigail/18180
commit eea9ce11eabfda96b2192341b50e9dcc27653369
Author: Dodji Seketeli <dodji@redhat.com>
Date: Mon Mar 30 22:02:52 2015 +0200
18180 - runtestreadwrite fails on i386
The issue here is that unresolved decl-only classes and resolved
decl-only classes have the same hash value (zero), and that changes
the type-id of the resolved decl-only class.
This patch ensures that the hash value of a decl-only class is zero
only for non-resolved classes. The patch also fixes an error in an
input XML file.
* src/abg-hash.cc (class_decl:#️⃣:operator()(const class_decl&)
const): Return zero only for class declarations that are not
resolved.
* tests/data/test-read-write/test20.xml: Fix the output to make a
class definition to reference its declaration, when there was a
forward declaration for it.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
|
||
Dodji Seketeli
|
b9fa3b7fd1 |
18166 - Abidiff fails with internal on Libtirpc ABI in XML format
It turns out the support for reading the native libabigail XML format is falling short since the work on (late) type canonicalizing. The type ID -> XML node map is wrongly considered as being per corpus data while it should be per translation unit data; type IDs are unique only for a given translation unit. The code to walk a XML sub-tree to perform the ID -> node mapping is wrongly walking all the XML node *after* the sub-tree node too; that is, it walks the entire corpus file starting from the XML sub-tree node it's given. It should only walk the sub-tree it's given. These two issues normally solve the crash reported here. But then there are other related issues too. The native XML format reader doesn't populate the set of exported declarations for the current corpus it's building. This patch addresses all these issues and makes tests/test-abidiff.cc supports corpus files for a new regression test. * src/abg-reader.cc (read_context::m_exported_decls_builder_): New data member. (read_context::read_context): Initialize it. (read_context::{type_is_from_translation_unit, get_exported_decls_builder, set_exported_decls_builder, maybe_add_fn_to_exported_decls, maybe_add_fn_to_exported_decls, type_id_new_in_translation_unit}): New member functions. (read_context::clear_per_translation_unit_data): Clear id->xml node map here ... (read_context::clear_per_corpus_data): ... not here. (read_context::walk_xml_node_to_map_type_ids): Only walk the sub-tree we are asked to walk. (read_translation_unit_from_input): Cleanup. (read_corpus_from_input): Wire populating of exported declarations of the current corpus. (build_function_decl, build_var_decl): Populate exported declarations of the current corpus here. (build_type_decl, build_qualified_type_decl) (build_pointer_type_def, build_reference_type_def) (build_array_type_def, build_enum_type_decl, build_type_decl) (build_template_tparameter): Adjust assert on ID to make sure it's the first type it's being defined in the current translation unit. * tests/data/test-abidiff/test-corpus0-report0.txt: New test reference output. * tests/data/test-abidiff/test-corpus0-v{0,1}.so.abi: New test input. * tests/test-abidiff.cc (specs): Add the test inputs above to the list of inputs over which to run the test harness. (main): Support reading corpora too, as this test harness was reading just translation units before. (tests/data/Makefile.am): Add test material above to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b041bc9cf0 |
Fix redundancy propagation on node with filtered local changes
Until now, if a diff node N has a local change, even if all of its children nodes are redundant, N is not considered as being redundant. This is an issue if the local changes of N are filtered out; in that case, N should be considered redundant. This patch fixes that. It introduces a second category bitmap on the diff node that stores the categorization of the diff node that does *NOT* take in account the categories inherited from its children nodes. That way, it's possible to know if the *local changes* of a given node have been filtered out. * include/abg-comparison.h (diff::{get_local_category, add_to_local_category, add_to_local_and_inherited_categories, remove_from_local_category, set_local_category, is_filtered_out_wrt_non_inherited_categories, has_local_changes_to_be_reported}): Declare new member functions. * src/abg-comp-filter.cc ({harmless, harmful}_filter::{visit, visit_end}): Update local category too. * src/abg-comparison.cc (diff::priv::local_category_): Add new data member. (diff::priv::priv): Initialize it. (diff::priv::is_filtered_out): Add new member function. This is factorized out of diff::is_filtered_out(). (diff::is_filtered_out): Re-write in terms of diff::priv::is_filtered_out(). (diff::{get_local_category, add_to_local_category, add_to_local_and_inherited_categories, remove_from_local_category, set_local_category, is_filtered_out_wrt_non_inherited_categories, has_local_changes_to_be_reported}): Define new member functions. (suppression_categorization_visitor::visit_begin): Update local categories too. (redundancy_marking_visitor::visit_end): If all of the children nodes of the a diff node N are redundant and if N has filtered-out local changes, then N is redundant too. * tests/data/test-diff-filter/libtest28-redundant-and-filtered-children-nodes-v{1,2}.so: New binary test inputs. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-v{0,1}.cc: Source code for the binary test inputs above. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-{0,1}.txt: New test output references. * tests/test-diff-filter.cc (in_out_specs): Add the test inputs above to the set of inputs this test harness has to run over. * tests/data/Makefile.am: Add the test materials above to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
635e5fa6b2 |
Delay non-complete class type resolution up to end of corpus reading
From the DWARF emitted by GCC 4.4.7 for libstdc++ we encountered an
interesting construct.
A non-complete version of std::runtime_error is declared in
libstdc++-v3/src/functexcept.cc and is represented in DWARF as:
[ 37344] class_type
name (strp) "runtime_error"
declaration (flag)
Then a bit later, that *non-complete* class is used as a base class
for a class, *without* being fully defined! This shouldn't happen
but, well, it does:
[ 3b3a1] class_type
specification (ref4) [ 3733e]
byte_size (data1) 16
decl_file (data1) 5
decl_line (data1) 141
containing_type (ref4) [ 3734a]
sibling (ref4) [3b405]
[ 3b3b1] inheritance
type (ref4) [ 37344] <---- here.
The thing is that, later, in another translation unit
(libstdc++-v3/src/stdexcept.cc), that same class is defined fully:
[ 7e9f9] class_type
name (strp) "runtime_error"
declaration (flag)
[...]
[ 80c95] class_type
specification (ref4) [ 7e9f9]
byte_size (data1) 16
decl_file (data1) 4
decl_line (data1) 108
containing_type (ref4) [ 7e9ff]
sibling (ref4) [ 80d2b]
[...] <---------- and the definition goes here.
But then you see that the DIE offset of the "version" of the
runtime_error class that is "defined" libstdc++-v3/src/stdexcept.cc in
is different from the version that is only declared in
libstdc++-v3/src/functexcept.cc. But virtue of the "One Definition
Rule", we can assume that they designate the same type. But still,
runtime_error should have been defined in
libstdc++-v3/src/stdexcept.cc. Anyhow, libabigail needs to be able to
handle this. That is, it needs to wait until the entire ABI corpus is
loaded from DWARF, then lookup the definition of all the non-complete
types we have encountered.
And then only after that non-complete type resolution has taken place,
we can proceed with type canonicalizing, rather than doing it after
the loading of each translation unit like what we were doing
previously.
This is what this patch does.
* include/abg-fwd.h (lookup_type_in_corpus): Declare new function.
* src/abg-corpus.cc (lookup_type_in_corpus): Define new function
here.
* include/abg-ir.h (function_types_type): Declare new typedef.
(translation_unit::get_canonical_function_type): Remove member function.
(translation_unit::bind_function_type_life_time): Declare new
member function.
(classes_type): New typedef.
* src/abg-ir.cc
(translation_unit::priv::canonical_function_types_): Remove data
member.
(translation_unit::priv::function_types): New data member.
(translation_unit::get_canonical_function_type): Remove this
function definition.
(translation_unit::bind_function_type_life_time): New function
definition.
(lookup_node_in_scope): Ensure that the type returned is
complete.
* src/abg-dwarf-reader.cc (string_classes_map): New typedef.
(read_context::decl_only_classes_map_): New data member.
(read_context::declaration_only_classes): New accessor.
(read_context::{maybe_schedule_declaration_only_class_for_resolution,
is_decl_only_class_scheduled_for_resolution,
resolve_declaration_only_classes, current_elf_file_is_executable,
current_elf_file_is_dso}): Define new member functions.
(read_context::clear_per_translation_unit_data): Do not clear the
data structures that associate DIEs to decls/types or that contain
the types to canonicalize here. Rather, clear them ...
(read_context::clear_per_corpus_data): ... here instead.
(read_context::build_translation_unit_and_add_to_ir): Do not
perform late type canonicalizing here. Rather, do it ...
(read_debug_info_into_corpus): ... here instead. And before that,
call read_context::clear_per_corpus_data() and the new
read_context::resolve_declaration_only_classes() here.
(build_class_type_and_add_to_ir): Schedule the non-complete types
for resolution to complete types. Assert that base classes that
are non-complete are scheduled to be completed.
(build_function_decl): Do not try to canonicalize function types
this early, systematically. Now, all the non-complete types needs
to be completed before starting canonicalizing. So let function
types go through the normal processes of deciding when to
canonicalize them. But then, bind the life time of the function
type to the life time of the current translation unit.
(maybe_canonicalize_type): If a class type is non-complete,
schedule it for late canonicalizing.
* src/abg-hash.cc (class_decl:#️⃣:operator()(const class_decl&)
const): During hashing, a base class should be complete.
* src/abg-reader.cc
(read_context::clear_per_translation_unit_data): Do not clear
id/xml node, and type maps here. Rather, clear it ...
(read_context::clear_per_corpus_data): ... here instead.
(read_translation_unit_from_input): Do not perform late
canonicalizing here. Rather, do it ...
(read_corpus_from_input): ... here. Also, call the new
read_context::clear_per_corpus_data() here.
(build_function_decl): Do not canonicalize function types here so
early. Rather, bind the life time of the function type to the
life time of the translation unit.
* src/abg-writer.cc (write_translation_unit): Do not clear the
type/ID map here.
* tests/data/test-read-dwarf/test2.so.abi: Adjust test input.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
|
||
Dodji Seketeli
|
5244794279 |
Fix redundancy categorization propagation
Propagating redundancy categorization is broken for cases where there is a diff node that has children nodes carrying changes that are all filtered out. In that case, if among those children changes there is a redundant change, normally the parent diff node we are look at should be marked redundant too. The bug is that it's not marked as redundant at the moment. This patch fixes that. * src/abg-comparison.cc (redundancy_marking_visitor::visit_end): Consider the cases of changes that are a filtered out. * tests/data/test-diff-filter/libtest27-redundant-and-filtered-children-nodes-v{0,1}.so: New test binaries to use as test input. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-{0,1,2}.txt: New test result baselines. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-v{0,1}.cc: Source code for the test input binaries above. * tests/test-diff-filter.cc (in_out_spec): Add the binaries to the test inputs used for this test harness. * tests/data/Makefile.am: Add the new test material above to the distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
dbe88f1103 |
Fix the new regression test for type canonicalizing
* tests/runtestcanonicalizetypes.sh.in (binaries): Refer to abg-tools-utils, not abg-tools-utils.o; the extension is computed automatically, depending on the underlying platform. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
8b28d171c3 |
Canonicalize types either early or late after TU reading
While trying to diff two identical files (abidiff foo.so foo.so) it appeared that canonicalizing types during e.g, the DWARF reading process was leading to subtle errors because it's extremely hard to know when a type is complete. That is, during the building of a class type C, a pointer to C can be built before C is complete. Worse, even after reading the DIE (from DWARF) of class C, there can be DIE seen later in the translation unit that modifies type C. In these late cases, one needs to wait -- not only until C is fully built, but also sometimes, after the translation unit is fully built -- to canonicalize C and then the pointer to C. This kind of things. So now there are two possible points in time when canonicalization of a type can happen. It can happen early, when the type is built. This is the case for basic types and composite types for which all sub-types are canonicalized already. It can happen late, right after we've finished reading the debug info for the current translation unit. So this patch fixes the IR traversal and uses that to walk the translation unit (or even types) after it's built. It does away with the first attempt to perform early canonicalizing only. The patch also handles type canonicalizing while reading xml-abi format. * include/abg-fwd.h (is_class_type) (type_has_non_canonicalized_subtype): Declare new functions. (is_member_type): Remove the overload that takes a decl_base_sptr. It's superfluous. We just need the one that takes a type_base_sptr. * include/abg-ir.h (translation_unit::{is_constructed, set_is_constructed}): Add new methods. (class_decl::has_virtual_member_functions): Likewise. (class decl_base): Makes it virtually inherit ir_traversable_base. (class type_base): Make this virtually inherit traversable_base too. (type_base::canonicalize): Renamed enable_canonical_equality into this. (type_base::traverse): Declare new virtual method. (canonicalize): Renamed enable_canonical_equality into this. (scope_type_decl::traverse): Declare new virtual method. (namespace_decl::get_pretty_representation): Declare new virtual method. (function_type::traverse): Likewise. (class_decl::base_spec::traverse): Likewise. (ir_node_visitor::visit): Remove the overloads and replace each of them with a pair of ... (ir_node_visitor::{visit_begin, visit_end}): ... of these. * include/abg-traverse.h (traversable_base::visiting): New method. (traversable_base::visiting_): New data member. (traversable_base::traversable_base): New constructor. * src/abg-ir.cc ({scope_decl, type_decl, namespace_decl, qualified_type_def, pointer_type_def, reference_type_def, array_type_def, enum_type_decl, typedef_decl, var_decl, function_decl, function_decl::parameter, class_decl, class_decl::member_function_template, class_decl::member_class_template, function_tdecl, class_tdecl}::traverse): Fix this to properly set the traversable_base::visiting_ flag and to reflect the new signatures of the ir_node_visitor methods. ({type_base, scope_type_decl, function_type, class_decl::base_spec}::traverse): New method. (type_base::get_canonical_type_for): Handle the case of the type already having a canonical type. Properly hash the type using the dynamic type hasher. Look through declaration-only classes to consider the definition of the class instead. Fix logic to have a single pointer of return, to ease debugging. (canonicalize): Renamed enable_canonical_equality into this. (namespace_decl::get_pretty_representation): Define new method. (ir_node_visitor::visit): Replace each of these overloads with a pair of visit_begin/visit_end ones. (translation_unit::priv::is_constructed_): New data member. (translation_unit::priv::priv): Initialize it. (translation_unit::{is_constructed, set_is_constructed}): Define new methods. (is_member_type(const decl_base_sptr)): Remove. (is_class_type(decl_base *d)): Define new function. (class_decl::has_virtual_member_functions): Define new method. (equals(const class_decl&, const class_decl&, change_kind*)): If the containing translation unit is not constructed yet, do not take virtual member functions in account when comparing the classes. This is because when reading from DWARF, there can be DIEs that change the number of virtual member functions after the DIE of the class. So one needs to start taking virtual members into account only after the translation unit has been constructed. (class non_canonicalized_subtype_detector): Define new type. (type_has_non_canonicalized_subtype): Define new function. * src/abg-corpus.cc (symtab_build_visitor_type::visit): Renamed this into symtab_build_visitor_type::visit_end. * src/abg-dwarf-reader.cc (die_type_map_type): New typedef. (die_class_map_type): This is now a typedef on a map of Dwarf_Off/class_decl_sptr. (read_context::{die_type_map_, alternate_die_type_map_, types_to_canonicalize_, alt_types_to_canonicalize_}): New data members. (read_context::{associate_die_to_decl, associate_die_to_decl_primary}): Make these methods public. (read_context::{associate_die_to_type, lookup_type_from_die_offset, is_wip_class_die_offset, types_to_canonicalize, schedule_type_for_canonicalization}): Define new methods. (build_type_decl, build_enum_type) (build_class_type_and_add_to_ir, build_qualified_type) (build_pointer_type_def, build_reference_type, build_array_type) (build_typedef_type, build_function_decl): Do not canonicalize types here. (maybe_canonicalize_type): Define new function. (build_ir_node_from_die): Take a new flag that says if the ir node is a member type/function or not. Early-canonicalize base types. Canonicalize composite types that have only canonicalized sub-types. Schedule the other types for late canonicalizing. For class types, early canonicalize those that are non-member types, that are fully constructed and that have only canonicalized sub-types. Adjust to the new signature of build_ir_node_from_die. (get_scope_for_die, build_namespace_decl_and_add_to_ir) (build_qualified_type, build_pointer_type_def) (build_reference_type, build_array_type, build_typedef_type) (build_var_decl, build_function_decl): Adjust for the new signature of build_ir_node_from_die. (build_translation_unit_and_add_to_ir): Likewise. Perform the late canonicalizing of the types that have been scheduled for that. (build_class_type_and_add_to_ir): Return a class_decl_sptr, not a decl_base_sptr. Adjust for the new signature of build_ir_node_from_die. Early canonicalize member types that are created and added to a given class, or schedule them for late canonicalizing. * src/abg-reader.cc (class read_context::{m_wip_classes_map, m_types_to_canonicalize}): New data members. (read_context::{clear_types_to_canonicalize, clear_wip_classes_map, mark_class_as_wip, unmark_class_as_wip, is_wip_class, maybe_canonicalize_type, schedule_type_for_late_canonicalizing, perform_late_type_canonicalizing}): Add new method definitions. (read_context::clear_per_translation_unit_data): Call read_context::clear_types_to_canonicalize(). (read_translation_unit_from_input): Call read_context::perform_late_type_canonicalizing() at the end of the function. (build_function_decl): Fix the function type canonicalizing (per translation) that was already in place. Do the canonicalizing of these only when the type is fully built. Oops. This was really brokend. Also, when the function type is constructed, consider it for type canonicalizing. (build_type_decl): Early canonicalize basic types. (build_qualified_type_decl, build_pointer_type_def) (build_pointer_type_def, build_reference_type_def) (build_array_type_def, build_enum_type_decl, build_typedef_decl): Handle the canonicalizing for these composite types: either early or late. (build_class_decl): Likewise. Also, mark this class a 'being built' until it's fully built. This helps the canonicalizing code to know that it should leave a class alone until it's fully built. * tests/test-ir-walker.cc (struct name_printing_visitor): Adjust to the visitor methods naming change. * configure.ac: Generate the tests/runtestcanonicalizetypes.sh testing script from tests/runtestcanonicalizetypes.sh.in. * tests/runtestcanonicalizetypes.sh.in: Add the template for the new runtestcanonicalizetypes.sh script that test for type canonicalizing. * tests/Makefile.am: Add the new runtestcanonicalizetypes.sh regression testing script to the build system. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3b3dbf6643 |
Rename diff::length() into diff::has_changes()
Since it turned out that the length of the changes carried by a diff node has never been used in the algorithms of the comparison engine, the diff::length() feels wrong. What we want is rather a name like diff::has_changes() so this is what this patch does. * include/abg-comparison.h (*::has_changes): Rename the ::length() method of all the diff types that inherit the diff class into this, in the class declarations. * src/abg-comparison.cc (*::has_changes): Do the same as in the declarations, in the definitions. (diff::to_be_reported, distinct_diff::has_local_changes) (distinct_diff::report, distinct_diff::, array_diff::has_changes) (reference_diff::has_changes, qualified_type_diff::has_changes) (enum_diff::has_changes, translation_unit_diff::has_changes) (suppression_categorization_visitor::visit_end) (redundancy_marking_visitor::visit_begin): Adjust. * tests/test-diff-dwarf.cc (main): Adjust. * tools/abidiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a00ed6bf41 |
Hand-code the string representation of GElf_Ehdr::e_machine
I was using elfutils/libebl.h to get a string representation of the marchine architecture of the elf file. It appears elfutils/libebl.h is an internal header not meant to be used by client code of elfutils. So this patch hand-codes the string representation of the value of the GElf_Ehdr data member and does away with the need of the elfutils/libebl.h header as with libebl. * configure.ac: Do not check for elfutils/libebl.h and libebl.a anymore. * src/abg-dwarf-reader.cc: Do not include elfutils/libebl.h anymore. (e_machine_to_string): Define new static function. (read_context::::load_elf_architecture): Use the new e_machine_to_string() function rather than ebl_backend_name() and ebl_openbackend(). * tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
29bc673dc0 |
Fix chaining of descendant node of qualified type diff node
While looking at the abidiff report emitted for two versions of the TBB library, I noticed that some diff nodes were not marked as redundant as they should be. As a result, they were being reported as having "been reported earlier", which seems to be an acceptable cruft to me especially now that the comparison IR can do proper redundancy detection and marking. I tracked that down and it's because the child node of a qualified_type_diff is just the underlying type diff node, whereas during reporting, we report about the leaf underlying type diff node, which can be different from the just the underlying type diff node because the later is always non-qualified. The fix is to make the child node of qualified_type_diff be the leaf underlying type diff node, so that diff tree walking (for the purpose of redundancy detection) and reporting are all looking at the same tree. * include/abg-comparison.h (qualified_type_diff::leaf_underlying_type_diff): Declare new accessor. * src/abg-comparison.cc (get_leaf_type): Forward declare this static function. (qualified_type_diff::priv::leaf_underlying_type_diff): Define new data member. (qualified_type_diff::leaf_underlying_type_diff): Define this new accessor. (qualified_type_diff::chain_into_hierarchy): Call leaf_underlying_type_diff() here rather than underlying_type_diff(). (qualified_type_diff::report): Use leaf_underlying_type_diff() rather than re-computing the diff between the two leaf underlying type diff nodes. * libtest26-qualified-redundant-node-v{0,1}.so: New binary test input files. * tests/data/test-diff-filter/test26-qualified-redundant-node-v{0,1}.cc: Source code for the binary test inputs above. * tests/test-diff-filter.cc (int_out_spec): Add the new test input to the vector of test input data over which to run this test harness. * tests/data/test-diff-filter/test26-qualified-redundant-node-report-{0,1.txt: New test input file. * tests/data/Makefile.am: Add the new test input data to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ddfb37ab17 |
Recognize cyclic diff tree nodes as being redundant
Okay I need to introduce some vocabulary here. Suppose we have the version 1 of a library named library-v1.so which source code is: struct S { int m0; struct S* m2; }; int foo(struct S* ptr) { return ptr; } And now suppose we have a version 2 of that library named library-v2.so which source code is modified so that a new data member is inserted into struct S: struct S { int m0; char m1; /* <--- a new data member is inserted here. */ struct S* m2; }; int foo(struct S* ptr) { return ptr; } struct S is said to be a cyclic type because it contains a (data) member which type refers to struct S itself, namely, the type of the data member S::m2 is struct S*, which refers to struct S. So, by analogy, the diff node tree that represents the changes of struct S is also said to be cyclic, for similar reasons: the diff node of the change of S::m2 refers to the diff node of the change of the type of S::m2, namely the diff node of struct S*, which refers to the diff node for the change of struct S itself. Now let's talk about redundancy. When walking the diff node tree of struct S in a depth-first manner, at some point, we look at the diff node for the data member S::m2, and we end up looking at the diff node of its type which is the diff node for struct S*; we keep walking and eventually we look the diff node of the change of the underlying type of struct S, which is the diff node of struct S, and hah! that is a redundant node because it's the first node that we visited when visiting the diff node of ... struct S! So the diff tree node for the change of struct S is not only a cyclic node, it's a redundant diff node as well, and its second occurrence is located at the point of appearance of data member S::m2. Hence the wording "cyclic redundant diff tree node". There! We have our vocabulary all set now. This patch enhances the code of the comparison engine so that a cyclic diff tree node is marked as redundant from the point of its second occurrence, onward. First the patch separates the notion of visiting a diff node from the notion of traversing it. Now traversing a diff node means visiting it and visiting its children nodes. So one can visit a node without traversing it, but one can not traverse a node without visiting it. So, when walking diff node trees, we need to avoid ending up in infinite loop in presence of cyclic nodes. This is why re-traversing a node that is already being traversed is forbidden by this patch, but visiting a node that is being visited is allowed. Before this patch, the notions of visiting and traversing were conflated in one and were not very clear; and one couldn't visit a node that was currently being visited. As a result, in presence of a cyclic node, its redundant nature wasn't being recognized, and so the diff tree node was not being flagged as being redundant. Diff reports were then cluttered by redundant references to changes involving cyclic types. * include/abg-comparison.h (enum visiting_kind): Rename enumerator DO_NOT_MARK_VISITED_NODES_AS_TRAVERSED into DO_NOT_MARK_VISITED_NODES_AS_VISITED. (diff_context::diff_has_been_visited): Rename diff_context::diff_has_been_traversed into this. (diff_context::mark_diff_as_visited): Rename diff_context::mark_diff_as_traversed into this. (diff_context::forget_visited_diffs): Rename diff_context::forget_traversed_diffs into this. (diff_context::forbid_visiting_a_node_twice): Rename diff_context::forbid_traversing_a_node_twice into this. (diff_context::visiting_a_node_twice_is_forbidden): Rename diff_context::traversing_a_node_twice_is_forbidden into this. (diff::is_traversing): Move this from protected to public. * src/abg-comparison.cc (diff_context::priv::visited_diff_nodes_): Rename diff_context::priv::traversed_diff_nodes_ into this. (diff_context::priv::forbid_visiting_a_node_twice_): Rename diff_context::priv::forbid_traversing_a_node_twice_ into this. (diff_context::priv::priv): Adjust. (diff_context::diff_has_been_visited): Rename diff_context::diff_has_been_traversed into this. Adjust. (diff_context::mark_diff_as_visited): Rename diff_context::mark_diff_as_traversed into this. Adjust. (diff_context::forget_visited_diffs): Rename diff_context::forget_traversed_diffs into this. Adjust. (diff_context::forbid_visiting_a_node_twice): Rename diff_context::forbid_traversing_a_node_twice into this. (diff_context::visiting_a_node_twice_is_forbidden): Rename diff_context::traversing_a_node_twice_is_forbidden into this. (diff_context::maybe_apply_filters): Adjust. (diff::end_traversing): Remove the 'mark_as_traversed' parameter of this. Remove the visited-marking code. (diff::traverse): This is the crux of the changes of this patch. Avoid traversing a node that is being traversed, but one can visit a node being visited. Also, traversing a node means visiting it and visiting its children nodes. (diff::is_filtered_out): Simplify logic for filtering redundant code. Basically all nodes that are redundant are filtered. All the complicated logic that was due when diff nodes were shared is not relevant anymore. (corpus_diff::priv::categorize_redundant_changed_sub_nodes) (propagate_categories, apply_suppressions) (diff_node_printer::diff_node_printer, print_diff_tree) (categorize_redundant_changed_sub_nodes) (clear_redundancy_categorization) (clear_redundancy_categorization): Adjust. (redundancy_marking_visitor::visit_begin): Adjust. Also, if the current diff node is already being traversed (that's a clyclic node) then mark it as redundant. * src/abg-comp-filter.cc (apply_filter): Adjust. * tests/data/test-diff-filter/test16-report-2.txt: New test input data. * tests/data/test-diff-filter/libtest25-cyclic-type-v{0,1}.so: New test input binaries. * tests/data/test-diff-filter/test25-cyclic-type-v{0,1}.cc: Source code for the test input binaries. * tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: New test input data. * tests/data/test-diff-filter/test25-cyclic-type-report-1.txt: Likewise. * tests/test-diff-filter.cc (in_out_specs): Add the new test inputs above to the list of test input data over which to run this test harness. * tests/data/Makefile.am: Add the new test files above to source distribution. * tests/data/test-diff-filter/test16-report.txt: Adjust. * tests/data/test-diff-filter/test17-0-report.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
af0923b1b0 |
Fix the output of the array diff report
While working on something else, I realized the report of the array diff change wasn't referring to the pretty representation of the array when talking about the changes of array element type; rather it was just referring to the array name. I think referring to the pretty representation of the array is more helpful. This patch does just that. * src/abg-comparison.cc (array_diff::report): Refer to the pretty representation of the array when talking about changes of the array element type. * src/abg-ir.cc (equals): In the overload for array_type, use the equality operator that knows how to handle null pointers to element type. This avoids crashes when the pointer to element type is null. * tests/data/test-diff-dwarf/test10-report.txt: Adjust. * tests/data/test-diff-filter/test24-compatible-vars-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b25f1bd7e7 |
Adjust archive-related code for the recent addition of tools_utils::*
What was in the abigail::tools namespace got recently moved in the abigail::tools_unit namespace. I forgot to adjust the client code related to the archive support because that code is now compiled by default on my main hacking box. This patch fixes that. * tests/Makefile.am: tools/libtoolsutils.la is no more. * tests/test-write-read-archive.cc (main): Adjust. * tools/abiar.cc (extract_tus_from_archive): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
19013fd110 |
Sort functions & variables diff nodes in the diff tree
Since the work on un-sharing diff tree nodes, it looks like some reports of regression tests on i686 order functions and variables in different orders, leading to test failures on 32 bits platforms because they are different fromthe 64 bits platforms that we use as a reference. This patch sorts (lexicographically) the children diff nodes of a given diff node in general, and also sorts the set of diff nodes for functions and variables that have sub-type changes, in a given corpus_diff. That way, the result of the diff report should be sorted the same way, whatever the platform. * include/abg-comparison.h (function_decl_diff_sptrs_type) (var_diff_sptrs_type): New typedefs. (corpus_diff::{changed_functions, changed_variables}): Declare new methods. * src/abg-comparison.cc (sort_string_function_decl_diff_sptr_map) (sort_string_var_diff_sptr_map): Forward declare these static functions there were already defined later. (struct diff_less_than_functor): Define new comparison functor. (diff::append_child_node): Sort the children diff nodes of a given diff node. (corpus_diff::priv::changed_fns_map_): Renamed the data member corpus_diff::priv::changed_fns_ into this. (corpus_diff::priv::changed_fns_): New data member that is a sorted vector of changed functions. (corpus_diff::priv::{lookup_tables_empty, clear_lookup_tables}): Adjust changed_fns_ -> changed_fns_map_ and changed_vars_ -> changed_vars_map_. (corpus_diff::priv::ensure_lookup_tables_populated): Likewise. Sort the changed functions and changed variables. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Adjust changed_fns_ -> changed_fns_map_ and changed_vars_ -> changed_vars_map_. Also, walk the changed functions and variables diff nodes in their sorted order. (corpus_diff::priv::{categorize_redundant_changed_sub_nodes, clear_redundancy_categorization, maybe_dump_diff_tree}): Walk the changed functions and variables diff nodes in their sorted order. * include/abg-ir.h (function_decl::get_pretty_representation_of_declarator): Declarenew method. * src/abg-ir.cc (function_decl::get_pretty_representation_of_declarator): Define new function. Its content got split out of ... (function_decl::get_pretty_representation): ... this one. * src/abg-comparison.cc (corpus_diff::chain_into_hierarchy): Consider the sorted the children nodes of a diff tree node. (corpus_diff::append_child_node): Keep the children nodes of a diff tree node sorted. (corpus_diff::{changed_functions, changed_variables, length, report}): Adjust. (corpus_diff::{changed_functions_sorted, changed_variables_sorted}): Define new functions. (function_comp::operator()): First compare the qualified function names along with the parameter declarations, then the rest. (sort_string_function_decl_diff_sptr_map) (sort_string_var_diff_sptr_map): Adjust. * tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust. * tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7c2a0940e2 |
Update copyright year for tests/test-abicompat.cc
* tests/test-abicompat.cc: Update copyright year. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
322b0e7769 |
Expose a new libabigail::tools_utils namespace
The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
76837d1cbf |
Update copyright years
* include/abg-comp-filter.h: Update copyright years. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-writer.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-diff-utils.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ini.cc: Likewise. * src/abg-ir.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-libzip-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-traverse.cc: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tests/test-write-read-archive.cc: Likewise. * tools/abg-tools-utils.cc: Likewise. * tools/abg-tools-utils.h: Likewise. * tools/abiar.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
929db0a880 |
Detect and report changes in ELF architecture
Libabigail does not take in account the architecture of the ELF file it reads. This patch changes that to represent the ELF architecture as a string, detect when that architecture changes accross two corpora being compared and emit a report about that change. * configure.ac: Detect the presence of libebl.a and add it to the list of library we depend on to build libabigail. Report when libelf.so is not found. * include/abg-comparison.h: (diff_context::show_architecture_change): Declare new accessors. (corpus_diff::architecture_changed): Declare new method. * include/abg-corpus.h (corpus::{get,set}_architecture_name): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_architecture_change_): New data member. (diff_context::priv::priv): Initialize it. (diff_context::show_architecture_change): Define new accessors. (function_decl_diff::report): Report when the size/alignment of the function address changes. (corpus_diff::priv::architectures_equal_): New data member. (corpus_diff::priv::priv): Initialize it. (corpus_diff::priv::emit_diff_stats): Take in account changes of architecture. (corpus_diff::architecture_changed): Define new method. (corpus_diff::length): Take in account changes of architecture. (corpus_diff::report): Report about changes of architecture. (compute_diff): In the overload for corpus_diff_sptr, detect changes fo architecture. * src/abg-corpus.cc (corpus_priv::architecture_name): Define new data member. (corpus::{get,set}_architecture_name): Define new method. * src/abg-dwarf-reader.cc: Include elfutils/libebl.h to use ebl_openbackend() and ebl_backend_name() (read_context::elf_architecture_): Define new data member. (read_context::elf_architecture): Define new accessor. (read_context::{load_elf_architecture, load_remaining_elf_data}): Define new methods. (read_corpus_from_elf): Use ctxt.load_remaining_elf_data() in lieu of ctxt.load_dt_soname_and_needed. Stick the architecture into the corpus. * src/abg-reader.cc (read_corpus_from_input): Read the 'architecture' XML property. * src/abg-writer.cc (write_corpus_to_native_xml): Write the 'architecture' XML property. * tests/data/test-diff-dwarf/libtest-23-diff-arch-v0-32.so: New test input file. * tests/data/test-diff-dwarf/libtest-23-diff-arch-v0-64.so: Likewise. * tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test-23-diff-arch-v0.cc: Source code for the binary test input files above. * tests/data/Makefile.am: Add the new test input files to the source distribution. * tests/test-diff-dwarf.cc (in_out_specs): Add the new test input data to the set of input data to run this test harness over. * tests/test-read-dwarf.cc (main): Do not take the architecture in account during comparisons. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1e82b98af2 |
Do not mark sibling structurally identical nodes as redundant
Consider the C code below: int foo(int a, int b) { } that is changed as: float foo(float a, float b) { } In this case, we want the 'abidiff' tool to report the three occurrences of the 'int' -> 'float' change (in the return type and in the two parameter changes of the function foo). In the current code, the comparison engine only reports the first occurrence of the change and consider the two other occurrences as being redundant. So, by default, it only reports the first occurrence of the change. This patch modifies the comparison engine to make it *NOT* mark the two later occurrences of change as redundant because the three occurrences of changes happen at the same logical level: they are all children of the function diff node in the diff tree. * include/abg-comparison.h (diff::parent_node): Declare new accessor. * src/abg-comparison.cc (diff::priv::parent_): New data member. (diff::priv::priv): Initialize it. (diff::parent_node): Define new accessor. (diff::append_child_node): Set the diff::priv::parent_ data member of the added child node. (redundancy_marking_visitor::visit_begin): If two (logical) sibbling nodes are structurally equivalent, do not mark them as being redundant. * tests/data/test-diff-suppr/libtest10-changed-parm-c-v0.so: New test input binary. * tests/data/test-diff-suppr/libtest10-changed-parm-c-v1.so: Likewise. * tests/data/test-diff-suppr/test10-changed-parm-c-report-0.txt: New test input data. * tests/data/test-diff-suppr/test10-changed-parm-c-v0.c: Source code for the binary input above. * tests/data/test-diff-suppr/test10-changed-parm-c-v1.c: Likewise. * tests/data/Makefile.am: Add the new test files to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test input to the vector of test inputs to run this harness over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
817aa5555e |
Un-share diff nodes in the comparison IR
Until now, the diff nodes of the comparison IR were shared. That is,
two diffs about the same subjects were represented by the same diff
node that would appear twice in the tree.
This was preventing us from spotting e.g, the first occurrence of a
diff node that would later (in the tree) turn to be redundant because
all redundant diff nodes are represented by the same diff node
pointer.
This patch now makes each diff node be different, as far of pointer
comparison is concerned. But it introduces the concept of canonical
diff node to ease the comparison between two diff nodes. Two diff
nodes that are equal have the same canonical diff node.
With this facility, it's now possible to tell the difference between
diff nodes that are (structurally) equal. It's not possible to say
things like "this is the first or second occurrence of the redundant
diff node foo'.
* include/abg-ir.h: Prefix the doc string with "///", rather than
writing it inside a /**/ comment.
* include/abg-comparison.h (function_decl_diff)
(function_decl_diff_sptr, fn_parm_diff, fn_parm_diff_sptr)
(var_diff_sptr, base_diff, class_diff, class_diff_sptr): Move
these class & typedef decls to the top of the file.
(string_changed_base_map, string_changed_parm_map)
(unsigned_changed_parm_map, changed_function_ptr)
(string_changed_function_ptr_map): Remove these typedefs.
(string_base_diff_sptr_map, string_fn_parm_diff_sptr_map)
(unsigned_fn_parm_diff_sptr_map, string_var_diff_sptr_map)
(unsigned_var_diff_sptr_map, string_function_decl_diff_sptr_map)
(string_var_diff_ptr_map): New typedefs.
(diff_context::{has_diff_for,add_diff}): Make these member
functions private.
(diff_context::{set_canonical_diff_for,
set_or_get_canonical_diff_for}): Declare new private member
functions.
(diff_context::{get_canonical_diff_for,
initialize_canonical_diff}): New public member functions.
(diff_context::maybe_apply_filters): Set the default value of the
'traverse_nodes_once' parameter to false.
(compute_diff): Make the overload for class_decl_sptr friend of
the diff_context class.
(class diff): Make the diff_context class a friend of this one.
(diff::set_canonical_diff): Declare new private member function.
(diff::get_canonical_diff): Declare new public member function.
(diff::children_nodes): Make this return a vector<diff_sptr>, rather
than a vector<diff*>.
(diff::append_child_node): Make this take a diff_sptr rather than
a diff*.
(class fn_parm_diff): Declare new type.
(compute_diff): Declare new overload for the new
function_decl::parameter_sptr.
(function_decl_diff::subtype_changed_parms): Return a
string_fn_parm_diff_sptr_map rather than a string_changed_parm.
(function_decl_diff::children_nodes): Return a vector<diff_sptr>.
(function_decl_diff::append_child_node): Take a diff_sptr.
(function_decl_diff::changed_functions): Return a
string_function_decl_diff_sptr_map.
(function_decl_diff::changed_variables): Return a
string_var_diff_sptr.
(class function_decl::parameter): Make this a pimpled class.
Also, make it inherit decl_base.
(equals): New overload for function_decl::parameter.
(struct function_decl::parameter::hash): Declare this.
(ir_node_visitor::visit): Declare new overload for
function_decl::parameter.
* src/abg-comparison.cc: Add doc-string about the internal
representation of the comparison engine and also about the concept
of canonical diff of the comparison engine.
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER2)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER3): Consider the
canonical diff when trying to know if the current node was
reported earlier.
(diff_context::priv::canonical_diffs): New data member.
(diff_context::{get_canonical_diff_for, set_canonical_diff_for,
set_or_get_canonical_diff_for, initialize_canonical_diff}): Define
new member functions.
(diff_context::{diff_has_been_traversed, mark_diff_as_traversed):
Consider canonical diff for these tests and actions.
(diff::priv::children_): Change the type of this to
vector<diff_sptr>.
(diff::canonical_diff_): New data member.
(diff::diff): Initialize the diff::canonical_diff_ data member.
(diff::begin_traversing): Mark the canonical diff node too.
(diff::is_traversing): Consider the canonical diff node in this
test.
(diff::end_traversing): Make the canonical diff node too. Also
mark the current node as having been traversed.
(diff::children_nodes): Return a vector<diff_sptr> type.
(diff::{get_canonical_diff, set_canonical_diff}): Define new
member functions.
(diff::append_child_node): Take a diff_sptr type parameter.
(diff::{reported_once, currently_reporting}): Flag the canonical
diff node too. And consider the canonical diff node when checking
the flag.
(diff::traverse): No need to mark the node as being traversed
because the diff::end_traversing() function does it now. Adjust
the code because diff::children_nodes() now returns
vector<diff_sptr>.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff, class_diff,
base_diff, scope_diff, function_decl_diff, typedef_diff,
corpus_diff}::chain_into_hierarchy): Adjust to the new type that
diff::append_child_node() takes. Also, take into account that the
diff nodes are now un-shared.
(compute_diff_for_distinct_kinds, compute_diff_for_types)
(compute_diff): Do not share diff nodes anymore. Initialize the
canonical diff node for the new created node.
(represent): Take a var_diff_sptr rather than two var_decl_sptr.
Adjust. Also take in account the fact that diff nodes are not
shared anymore, and that they do have canonical diffs.
(var_diff::type_diff): Make the computation of the type_diff of
the var_diff be lazy. This avoids infinite (recursive) creation
of diff nodes when a class diff node has a sub-type of data member
that is a class diff node too.
(var_diff::report): Detect redundant reporting of this kind of
diff node.
(class_diff::priv::changed_bases_): Change the type of this to
string_base_diff_sptr_map.
(class_diff::priv::subtype_changed_dm_): Change the type of this
to string_var_diff_sptr_map.
(class_diff::priv::changed_dm_): Change the type of this to
unsigned_var_diff_sptr_map.
(class_diff::priv::{count_filtered_subtype_changed_dm,
count_filtered_bases}): Do not take a diff_context_sptr anymore.
(class_diff::ensure_lookup_tables_populated): changed_bases_
subtype_changed_dm_ and changed_dm_ are now *NOT* shared diff
nodes anymore.
(class_diff::priv::base_has_changed): Adjust.
(class_diff::priv::subtype_changed_dm): Adjust.
(class_diff::priv::count_filtered_bases): Adjust as changed_bases_
is now a map of un-shared diff nodes.
(class_diff::priv::count_filtered_subtype_changed_dm): Adjust as
subtype_changed_dm_ is now a map of un-shared diff nodes.
(class_diff::priv::{count_filtered_changed_mem_fns,
count_filtered_inserted_mem_fns, count_filtered_deleted_mem_fns,
}): Adjust for change of the default parameter value of
diff_context::maybe_apply_filters().
(class_diff::~class_diff): New destructor.
(class_diff::changed_bases): Return a string_base_diff_sptr_map&
type.
(class_diff::{inserted_data_members, deleted_data_members,
changed_member_fns}): Add doc strings.
(struct changed_data_member_comp): Remove.
(struct var_diff_comp): New comparison functor.
(sort_changed_data_members): Remove.
(sort_var_diffs): Define new sorting function.
(class_diff::report): Adjust.
(fn_parm_diff::*): Define member types and functions of the new
fn_parm_diff type.
(function_decl_diff::priv::{subtype_changed_parms_,
changed_parms_by_id_}): Make these take a map of fn_parm_diff_sptr
nodes.
(function_decl_diff::ensure_lookup_tables_populated): Adjust to
the fact that priv_->subtype_changed_parms_ and
priv_->priv_->changed_parms_by_id_ now are maps of un-shared
fn_parm_diff_sptr nodes.
(function_decl_diff::subtype_changed_parms): Adjust.
(struct changed_parm_comp): Remove.
(struct fn_parm_diff_comp): New comparison functor.
(sort_changed_parm_map): Remove.
(sort_string_fn_parm_diff_sptr_map): New sorting function.
(function_decl_diff::report): Adjust.
(corpus_diff::priv::children_): Change the type of this to
vector<diff_sptr>.
(corpus_diff::priv::changed_fns_): Changed the type of this to
string_function_decl_diff_sptr_map.
(corpus_diff::priv::changed_vars_): Changed the type of this to
string_var_diff_sptr_map.
(corpus_diff::priv::ensure_lookup_tables_populated): Adjust.
(corpus_diff::priv::apply_filters_and_compute_diff_stats}):
Adjust. Do not need to clear redundancy categorization anymore
because the diff nodes are not shared anymore.
(corpus_diff::priv::categorize_redundant_changed_sub_nodes):
Adjust.
(corpus_diff::priv::clear_redundancy_categorization): Adjust.
(corpus_diff::changed_variables): Adjust.
(struct changed_function_ptr_comp): Remove.
(struct function_decl_diff_comp): New comparison functor.
(sort_string_changed_function_ptr_map): Remove.
(sort_string_function_decl_diff_sptr_map): Define new sorting
function.
(struct changed_vars_comp): Remove.
(struct var_diff_sptr_comp): New comparison functor.
(sort_changed_vars): Remove.
(sort_string_var_diff_sptr_map): Define new sorting function.
(corpus_diff::report): Adjust.
(corpus_diff::traverse): Adjust.
({category_propagation_visitor,
suppression_categorization_visitor}::visit_end): Adjust.
(clear_redundancy_categorization): Adjust.
* src/abg-hash.cc (function_decl::parameter:#️⃣:operator):
Adjust.
* src/abg-ir.cc (struct function_decl::parameter::priv): Define
here as part of pimpl-ifying the function_decl::parameter type.
(function_decl::parameter::*): Define here the member functions as
part of pimpl-ifying the function_decl::parameter type.
(equals): Define the overload for function_decl::parameter here
too.
(ir_node_visitor::visit(function_decl::parameter*)): Define this.
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust.
* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust.
* tests/data/test-diff-dwarf/libtest21-redundant-fn-v0.so: New
test input data.
* tests/data/test-diff-dwarf/libtest21-redundant-fn-v1.so:
Likewise.
* tests/data/test-diff-dwarf/test21-redundant-fn-v0.cc: Source
code for test input binary above.
* tests/data/test-diff-dwarf/test21-redundant-fn-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: New
test input data.
* tests/data/test-diff-dwarf/libtest22-changed-parm-c-v0.so: New
test input data.
* tests/data/test-diff-dwarf/libtest22-changed-parm-c-v1.so:
Likewise.
* tests/data/test-diff-dwarf/test22-changed-parm-c-v0.c: Source
code for test input binary above.
* tests/data/test-diff-dwarf/test22-changed-parm-c-v1.c: Likewise.
* tests/test-diff-dwarf.cc (in_out_spec): Add the new test input
data to the vector the test inputs to run this harness over.
* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: New
test input data.
* tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/libtest8-redundant-fn-v0.so: New test
input binary.
* tests/data/test-diff-suppr/libtest8-redundant-fn-v1.so: Likewise.
* tests/data/test-diff-suppr/test8-redundant-fn-v0.cc: Source code
code for binary test input above.
* tests/data/test-diff-suppr/test8-redundant-fn-v1.cc: Likewise.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt:
New test input data.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/libtest9-changed-parm-c-v0.so: New
test input binary.
* tests/data/test-diff-suppr/libtest9-changed-parm-c-v1.so: New
test input binary.
* tests/data/test-diff-suppr/test9-changed-parm-c-v0.c: Source
code for binary test input above.
* tests/data/test-diff-suppr/test9-changed-parm-c-v1.c: Likewise.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
data to the vector the test inputs to run this harness over.
* tests/data/Makefile.am: Add the new files to the source
distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
|
||
Dodji Seketeli
|
8879d00538 |
Extend detection of compatible types to arrays
* include/abg-fwd.h (is_array_type): Renamed is_array_type_def() into this for consistency. * src/abg-comparison.cc (type_suppression::suppresses_diff): Adjust. * src/abg-dwarf-reader.cc (build_array_type): Remove useless code that was trying to read a DW_AT_byte_size attribute from the DIE of the array, but then wasn't doing anything with the value. But then if the attribute was not present, the array type wouldn't be built. * src/abg-ir.cc (strip_typedef): Strip typedefs from sub-types of array types too. (is_array_type): Rename is_array_def() to this, for consistency. (var_decl::get_pretty_representation): Adjust. * tests/data/test-diff-filter/libtest24-compatible-vars-v0.so: New test input data. * tests/data/test-diff-filter/libtest24-compatible-vars-v1.so: Likewise. * tests/data/test-diff-filter/test24-compatible-vars-report-0.txt: Likewise. * tests/data/test-diff-filter/test24-compatible-vars-v0.c: Source code for the first binary above. * tests/data/test-diff-filter/test24-compatible-vars-v1.c: Source code for the second binary above. * tests/data/Makefile.am: Add the new test input data to source distribution. * tests/test-diff-filter.cc (in_out_specs): Add the new test input data to the list of input to run this test harness over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
8f994b5e29 |
Temporarily disable redundant diff report elimination
So, this is all about problem report https://sourceware.org/bugzilla/show_bug.cgi?id=17693. When redundant diff node reporting is enabled and when a diff node appears twice in a diff tree, we detect that and the second occurrence of the diff node is flagged as being redundant. Later at diff tree node reporting time, the redundant diff node is not reported. The problem is that diff nodes are canonicalized. That is, when the same change is present twice in a diff, the same diff node is going to be present twice. So flagging the second occurrence as being redundant amounts as flagging the first occurrence as being redundant too! So at reporting time, the diff tree visitor that walks the diff tree nodes will avoid reporting the two occurrences of diff tree nodes altogether. This is what happens in the example of the bug above. I am reproducing the example here for convenience: So suppose we have a first version of a library named lib-v0.so which is made of this C code: int add(int a, int b) { } Then suppose that code was changed in a subsequent version of the library named lib-v1.so, leading to the following code: int add(float a, float b) { } So, the diff tree node for the 'add' function is going to have several child diff tree nodes, among which, one that carries the change for the first parameter (int a becoming float a) and the one carrying the change for the second parameter (int b becoming float b). The diff tree node for the second parameter is going to be same diff tree node as the one for the first parameter because what counts is the change in the *type* of the parameter. Thus, the diff tree node for the second parameter is going to be marked as being redundant; and so is the first parameter. So abidiff lib-v0.so lib-v1.so yields: Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable You can see that even the function 'add' is not mentioned in the report. This is because it has also been considered as being redundant because of a phenomenon named 'propagation'. The redundant-ness of the children nodes of the diff tree node of the 'add' function is propagated to the diff tree node of the add function itself because that add function diff tree node has no child but redundant diff children nodes. This categorization behaviour is correct. What is not correct is that only the second child node of the add function diff tree node should have been marked redundant. I am going to tackle this issue a bit later. For now, I am temporarily disabling redundancy categorization for diff tree nodes by default. Hence this patch. With this patch, abidiff lib-v0.so lib-v1.so yields: Functions changes summary: 0 Removed, 1 Changed, 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 1 function with some indirect sub-type change: [C]'function int add(int, int)' has some indirect sub-type changes: parameter 0 of type 'int' changed: name changed from 'int' to 'float' parameter 1 of type 'int' changed: name changed from 'int' to 'float' Note how the change on the second parameter appears equal to the change on the first. * src/abg-comparison.cc (diff_context::priv::priv): Show redundant changes by default. (categorize_redundancy): Do not categorize redundancy if the diff_context says that we shouldn't. * tools/abicompat.cc (options::show_redundant): New data member. (options::options): Initialize to true. (display_usage): Add new help string for new --no-redundant and --redundant options. (parse_command_line): Parse new --no-redundant and --redundant command line options. (main): Initialize the diff context with respect to the options::show_redundant property. * tools/abidiff.cc (options::options): Initialize the show_redundant_changes data member to true. (display_usage): Show new help string for the new --no-redundant command line option. (parse_command_line): Parse the new --no-redundant command line option. * tests/data/test-diff-filter/libtest23-redundant-fn-parm-change-v0.so: New test data input. * tests/data/test-diff-filter/libtest23-redundant-fn-parm-change-v1.so: Likewise. * tests/data/test-diff-filter/test23-redundant-fn-parm-change-report-0.txt: Likewise. * tests/data/test-diff-filter/test23-redundant-fn-parm-change-v0.c: Source code for the first binary above. * tests/data/test-diff-filter/test23-redundant-fn-parm-change-v1.c: Source code for the second binary above. * tests/data/Makefile.am: Add the new test data input to source distribution. * tests/test-abicompat.cc (in_out_specs): Add --no-redundant to abicompat when we don't want it to show redundant diff reports. * test-diff-filter.cc (in_out_specs): Likewise for abidiff. * test-diff-suppr.cc (in_out_specs): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Jan Engelhardt
|
112432bbd2 |
Fix conditional build wrt zip archives and cx11
Revert
|
||
Dodji Seketeli
|
1b75fd3eac |
Make determining of compatible types complete
Until now, two types that are different were considered compatible if one type is a typedef of the other. This is useful because two different types, if compatible, are not ABI-incompatible. This patch extends the concept of compatible types to types which might have sub-types that are typedefs of each others, including function types. Note implementing this required that I fixed various other things left and right. Like style fixes, crash avoiding fixes, etc. * include/abg-fwd.h (is_reference_type, is_function_type) (is_method_type): Declare new predicates. * include/abg-ir.h (class qualified_type_def): Pimpl this class. (qualified_type_def::qualified_type_def): Use the convenience type_base_sptr typedef. (qualified_type_def::{get_cv_quals, set_cv_quals}): Use the qualified_type_def::CV type rather than char. (qualified_type_def::get_underlying_type): Use the convenience type_base_sptr typedef. (pointer_type_def::pointer_type_def): Likewise. (function_decl::parameter::parameter): Add a new constructor. * src/abg-ir.cc (is_reference_type, is_function_type) (is_method_type): Define new predicates. (class qualified_type_def::priv): Define this new private type, for the purpose of Pimpl-ifying the qualified_type_def class. (qualified_type_def::{qualified_type_def, build_name, get_cv_quals_string_prefix, get_underlying_type}): Adjust for the purpose of Pimpl-ifying the qualified_type_def class. (equals): In the qualified_type_def, reference_type_def overloads, trust the fact that we have operator== overload for the type_base_sptr. This avoids crashes for when the (possible) underlying type is null. (pointer_type_def::operator==): Likewise. (strip_typedef): Make this recursively strip typedefs from sub-types. (types_are_compatible): Handle null types. (qualified_type_def::{get_cv_quals, set_cv_quals}): Handle qualified_type_def::CV rather than char. (pointer_type_def::pointer_type_def): Use the convenience type_base_sptr typedef. * include/abg-comparison.h (distinct_diff::compatible_child_diff): Declare new member function. * src/abg-comparison.cc (distinct_diff::compatible_child_diff): Define new member function. (distinct_diff::chain_into_hierarchy): Chain the compatible child diff node that might be present. (distinct_diff::report): Now when a distinct diff carries a compatible change, mention it in the report. * src/abg-comp-filter.cc (is_compatible_change): A compatible change can now involve types that are not typedefs. Only their sub-types need to be involved with typedef-ness. * tests/data/test-diff-dwarf/test{2,4,5}-report.txt: Adjust. * tests/data/test-diff-filter/libtest21-compatible-vars-v0.so: New test data input. * tests/data/test-diff-filter/libtest21-compatible-vars-v1.so: Likewise. * tests/data/test-diff-filter/test21-compatible-vars-report-0.txt Likewise. * tests/data/test-diff-filter/test21-compatible-vars-report-1.txt Likewise. * tests/data/test-diff-filter/test21-compatible-vars-v0.cc: Source code for the first data input binary above. * tests/data/test-diff-filter/test21-compatible-vars-v1.cc: Source code for the second data input binary above. * tests/data/test-diff-filter/libtest22-compatible-fns-v0.so: New test data input. * tests/data/test-diff-filter/libtest22-compatible-fns-v1.so Likewise. * tests/data/test-diff-filter/test22-compatible-fns-report-0.txt: New test data input. * tests/data/test-diff-filter/test22-compatible-fns-report-1.txt: Likewise. * tests/data/test-diff-filter/test22-compatible-fns-v0.c: Source code for the first test data input binary above. * tests/data/test-diff-filter/test22-compatible-fns-v1.c: Source code for the second test data input binary above. * tests/data/Makefile.am: Add the new test input data to source distribution. * tests/test-diff-filter.cc (in_out_specs): Add the new test data input above to the list of test data this harness has to be run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
eecf5f87df |
Fix classification of parameter addition in C
The comparison engine classifies an addition or removal of parameter from a C function as harmless. This is a mistake that impacts abidiff and abicompat. Fixed thus. * src/abg-comp-filter.cc (function_name_changed_but_not_symbol): Compare the fully qualified name of the functions; not their pretty representation. * tests/data/test-diff-dwarf/libtest20-add-fn-parm-v0.so: New test data intput. * tests/data/test-diff-dwarf/libtest20-add-fn-parm-v1.so: Likewise. * tests/data/test-diff-dwarf/test20-add-fn-parm-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test20-add-fn-parm-v0.c: Source code for the first shared library above. * tests/data/test-diff-dwarf/test20-add-fn-parm-v1.c: Source code for the second shared library above. * tests/test-diff-dwarf.cc (in_out_specs): Add the test input data above to the list of test input the harness must run over. * Makefile.am: Add the new files above to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
775cfcde0c |
Wire the soname check into abicompat
Now that the comparison engine knows how to take SONAMEs into account during ABI abi comparison, it's feasible to make abicompat leverage that capability. This patch does just that. * include/abg-comparison.h (corpus_diff::soname_changed): Declare new member function. * src/abg-comparison.cc (corpus_diff::soname_changed): Define new member function. (corpus_diff::length): Use the new corpus_diff::soname_changed() method. * tests/data/test-abicompat/libtest4-soname-changed-v0.so: New test input data. * tests/data/test-abicompat/libtest4-soname-changed-v1.so: Likewise. * tests/data/test-abicompat/test4-soname-changed-app: Likewise. * tests/data/test-abicompat/test4-soname-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test4-soname-changed-app.cc: Source code for one of the binaries above. * tests/data/test-abicompat/test4-soname-changed-v0.cc: Likewise. * tests/data/test-abicompat/test4-soname-changed-v1.cc: Likewise. * tests/test-abicompat.cc (in_out_specs): Add the new test input data to the list of input data to run this harness over. (main): Take the soname change in account to determine if the change is ABI incompatible. * tests/data/Makefile.am: Add the new test input data above to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ae98acdb90 |
Fixup messed up old runtestdiffdwarf input tests
While working on supporting the comparison of sonames I realized that the runtestdiffdwarf test harness was missing some input data. This patch addresses that. * tests/data/test-diff-dwarf/test17-non-refed-syms-report-0.txt: Add this missing reference test output. * tests/data/Makefile.am: Add the new reference test output to source distribution. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Fix this output to avoid emitting symbol alias information in it. * tests/test-diff-dwarf.cc (in_out_specs): Add two missing test input data to the list of input data this harness is supposed to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
721728e7de |
Support reading and comparing soname from ELF files
Libabigail's DWARF reader doesn't read the DT_SONAME tag from the .dynamic section. The abigail::corpus type doesn't have a property for that tag either. And the comparison engine doesn't take that tag in when comparing corpora. This patch modifies the DWARF reader to read the DT_SONAME and DT_NEEDED tags from the .dynamic section. The value of DT_SONAME tag is then saved in the new corpus property accessed by the new abigail::corpus::get_soname() accessor. The comparison engine has also been modified to compare the sonames of two corpora being compared. Note that the value of the DT_NEEDED elf tag is saved in a new corpus property that is accessed via the new abigail::corpus::get_needed() getter. This property is not used yet. This patch also adds a unit test for this new feature. * include/abg-corpus.h (corpus::{get_needed, set_needed, get_soname, set_soname}): Declare new accessors. * src/abg-corpus.cc (corpus::priv::{needed, soname}): New data members. (corpus::{get_needed, set_needed, get_soname, set_soname}): Define new accessors. (corpus::is_empty): Take dt_needed and dt_soname in account in computing empty-ness. * src/abg-dwarf-reader.cc (read_context::{dt_needed_, dt_soname_}): New data members. (read_context::{dt_needed, dt_soname}): New accessors. (read_context::load_dt_soname_and_needed): New member function. (read_corpus_from_elf): Call the new read_context::load_dt_soname_and_needed() to read the dt_soname and dt_needed tags. Set them to the corpus. * include/abg-comparison.h (diff_context::show_soname_change): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_soname_change_): New data member. (diff_context::priv::priv): Initialize the new data member diff_context::priv::show_soname_change_. (diff_context::show_soname_change): Define new accessors. (corpus_diff::priv::sonames_equal_): New data member. (corpus_diff::priv::priv): Initialize the new data member corpus_diff::priv::sonames_equal_. (corpus_diff::length): Take the new priv_->sonames_equals_ data member in account. (corpus_diff::{report, priv::emit_diff_stats}): If the sonames changed and we are allowed to report it, then report it. (compute_diff): In the variant for corpus_diff, do not forget to compare the sonames. * src/abg-reader.cc (build_needed, read_elf_needed_from_input): Define new static functions. (read_corpus_from_input): Read the 'soname' attribute from the 'abi-corpus' xml element node. * src/abg-writer.cc (write_elf_needed): Define new static function. (write_corpus_to_native_xml): Write a new 'elf-needed' xml element node that contains one xml 'dependency' element node per dependency to emit. This uses the new write_elf_needed() function above. * tests/data/test-diff-dwarf/libtest19-soname-v0.so: New test input data. * tests/data/test-diff-dwarf/libtest19-soname-v1.so: Likewise. * tests/data/test-diff-dwarf/test19-soname-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test19-soname-v0.c: Source code of the first binary above. * tests/data/test-diff-dwarf/test19-soname-v1.c: Source code of the second binary above. * tests/test-diff-dwarf.cc (in_out_specs): Add the test input above to the list of test input to run this harness on. * tests/data/Makefile.am: Add the new test input data above. * tests/data/test-read-dwarf/test{0,1}.abi: Adjust. * tests/data/test-read-dwarf/test{2,3,4,6,}.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
c0a31b48c7 |
Fix a crash while writing symbol information
While working on something else, I noticed that the abilint tool would crash when trying to write information relative to some symbol information. It turned out that invoking corpus::get_fun_symbol_map() or corpus::get_var_symbol_map() on a corpus that has an empty function (or variable) symbol map yields a crash. This patch fixes that. To test the fix I had to extend the test-read-write.cc test harness to teach it to load corpus files too; up to now it was only loading simple translation unit files (named Binary Instrumentation files). I then created a native xml corpus file using the abidw tool on a simple shared library I created. That corpus file does have an empty variable symbol section which triggers the crash on a non-fixed tree. * src/abg-corpus.cc (corpus::{get_fun_symbol_map_sptr, get_var_symbol_map_sptr}): Make sure the symbol map is always constructed, even if it's empty. * tests/data/test-read-write/test26.xml: New test input data. * tests/test-read-write.cc (in_out_spec): Add this new test input data to the list of input data to run the harness on. (main): Support reading and writing corpus files alongside translation unit files that we were handling already. * tests/data/Makefile.am: Add the new test input data to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ef7e71febf |
Initial implementation of the abicompat tool
Given an application A that links to a shared library L of version V denoted L(V) and a subsequent version of that library denoted L(V+P), the 'abicompat' tool tells the user if L(V+P) is still ABI compatible with L(V+P). And if it is not, abicompat gives a reports that shows the differences between L(V) and L(V+P) that makes L(V+P) ABI-incompatible with A. The source code of this tool is in the tools/abicompat.cc source file. To support this new tool, this commit changes the comparison engine to optionally avoid showing added symbols that were not referenced by any debug info. It changes the ABI corpus type to allow the specification of a list of variables and functions symbols to keep (and drop all other functions and variables which have other symbols on the floor even before starting to compare the two libraries). This is how the abicompat tool itself works. It basically compares L(V) and L(V+P) but it only looks at their exported functions and variables which symbols are undefined in application A. If the list of exported and defined variables and functions of L(V) whose symbols are undefined in A equals that of L(V+P) (including the sub-types of these variables and functions) A is still compatible with L(V+P). Otherwise, they might not be compatible depending on the kind of differences that are found. * include/abg-comparison.h (diff_context::show_added_symbols_unreferenced_by_debug_info): Declare new accessors. (corpus_diff::{deleted_variables, deleted_unrefed_function_symbols, deleted_unrefed_variable_symbols, apply_filters_and_suppressions_before_reporting}): Declare new methods. (corpus_diff::diff_stats): Declare this new type. Actually this was previously corpus_diff::priv::diff_stats, which was a hidden internal type.. We are moving it here, in the external API so that client code can have more information about changes statistics. Change all the previously publicly accessible data members into accessor functions. * src/abg-comparison.cc (class corpus_diff::diff_stats::priv): New type. (diff_context::priv::show_added_syms_unreferenced_by_di_): New data member. (diff_context::priv::priv): Adjust. (diff_context::show_added_symbols_unreferenced_by_debug_info): Define this new method. (corpus_diff::priv::emit_diff_stats): Do not show the diff stat if the only changes is added function or variables symbols and if we were instructed to not show added symbols. (corpus_diff::priv::{diff_stats_, filters_and_suppr_applied_}): New data members. (corpus_diff::priv::priv): Initialize the filters_and_suppr_applied_ data member. (corpus_diff::priv::diff_stats): Move this type to corpus_diff::diff_stats. (corpus_diff::priv::{apply_filters_and_compute_diff_stats, emit_diff_stats}): Adjust. (corpus_diff::apply_filters_and_suppressions_before_reporting): Define new member function. (corpus_diff::report): Use the new apply_filters_and_suppressions_before_reporting() function, rather than applying the filters and suppressions by ourselves. Also adjust to the use the accessors of the new corpus_diff::diff_stats type. (corpus_diff::{deleted_variables, deleted_unrefed_function_symbols, deleted_unrefed_variable_symbols}): Define new accessors. (corpus_diff::diff_stats::{diff_stats, num_func_removed, num_func_added, num_func_changed, num_func_filtered_out, net_num_func_changed, num_vars_removed, num_vars_added, num_vars_changed, num_vars_filtered_out, net_num_vars_changed, num_func_sym_removed, num_func_syms_added, num_var_syms_removed, num_var_syms_added}): Define new member functions. * include/abg-corpus.h (corpus::{get_sym_ids_of_fns_to_keep, get_sym_ids_of_vars_to_keep}): Declare new methods. * src/abg-corpus.cc (corpus::priv::{sym_id_fns_to_keep, sym_id_vars_to_keep}): Added data members. (symtab_build_visitor_type::{unrefed_fun_symbols, unrefed_var_symbols, sym_id_fns_to_keep, sym_id_vars_to_keep}): Added new data members. (symtab_build_visitor_type::symtab_build_visitor_type): Take two additional parameters for the function and variable symbol ids to keep. (symtab_build_visitor_type::add_fn_to_wip_fns): Take the function symbols to keep in account when building the exported symbol table. (symtab_build_visitor_type::add_var_to_wip_vars): Likewise, take the variable symbols to keep in account when building the exported symbol table. (corpus::priv::build_public_decl_table): Adjust the initialization of the visitor that walks the ABI artifacts to build the exported symbol table to know take a list of function/variable symbols to keep. (corpus::priv::build_unreferenced_symbols_tables): Ensure that the public table of functions/variables is built before doing the work of this function. Also, if a list of variable/function symbols to keep is given, drop all symbols that are not in that list on the floor. (corpus::{get_sym_ids_of_fns_to_keep, get_sym_ids_of_vars_to_keep}): Define new accessors. * tools/abicompat.cc: New abicompat tool. * doc/manuals/abicompat.rst: New documentation source for abicompat. * doc/manuals/libabigail-tools.rst: Add an entry for the abicompat doc. * tests/test-abicompat.cc: New test harness for the 'abicompat' tool. * tests/Makefile.am: Build the runtestabicompat test harness and add it to the list of tests harnesses that are run by make check. * tests/data/test-abicompat/libtest0-fn-changed-libapp-v0.so: New test input. * tests/data/test-abicompat/libtest0-fn-changed-libapp-v1.so: Likewise. * tests/data/test-abicompat/test0-fn-changed-app: Likewise. * tests/data/test-abicompat/test0-fn-changed-0.suppr: Likewise * tests/data/test-abicompat/test0-fn-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test0-fn-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test0-fn-changed-app.cc: Likewise. * tests/data/test-abicompat/test0-fn-changed-libapp.h: Likewise. * tests/data/test-abicompat/test0-fn-changed-libapp-v0.cc: Likewise. * tests/data/test-abicompat/test0-fn-changed-libapp-v1.cc: Likewise. * tests/data/test-abicompat/libtest1-fn-removed-v0.so: Likewise. * tests/data/test-abicompat/libtest1-fn-removed-v1.so: Likewise. * tests/data/test-abicompat/test1-fn-removed-app: Likewise. * tests/data/test-abicompat/test1-fn-removed-app.cc: Likewise. * tests/data/test-abicompat/test1-fn-removed-report-0.txt: Likewise. * tests/data/test-abicompat/test1-fn-removed-v0.cc: Likewise. * tests/data/test-abicompat/test1-fn-removed-v1.cc: Likewise. * tests/data/test-abicompat/libtest2-var-removed-v0.so: Likewise. * tests/data/test-abicompat/libtest2-var-removed-v1.so: Likewise. * tests/data/test-abicompat/test2-var-removed-app: Likewise. * tests/data/test-abicompat/test2-var-removed-app.cc: Likewise. * tests/data/test-abicompat/test2-var-removed-report-0.txt: Likewise. * tests/data/test-abicompat/test2-var-removed-v0.cc: Likewise. * tests/data/test-abicompat/test2-var-removed-v1.cc: Likewise. * tests/data/test-abicompat/libtest3-fn-removed-v0.so: Likewise. * tests/data/test-abicompat/libtest3-fn-removed-v1.so: Likewise. * tests/data/test-abicompat/test3-fn-removed-app: Likewise. * tests/data/test-abicompat/test3-fn-removed-app.cc: Likewise. * tests/data/test-abicompat/test3-fn-removed-report-0.txt: Likewise. * tests/data/test-abicompat/test3-fn-removed-v0.cc: Likewise. * tests/data/test-abicompat/test3-fn-removed-v1.cc: Likewise. * tests/data/test-abicompat/test3-fn-removed-version-script-0 Likewise.: * tests/data/test-abicompat/test3-fn-removed-version-script-1: Likewise. * tests/data/Makefile.am: Add the new test inputs above to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5c19aa1061 |
Make tests/data directory have its own Makefile
On RHEL 6, make distcheck was trying to compile the C++ files that are in tests/data. Having a dedicated tests/data Makefile.am which only put the data files into an EXTRA_DIST variable fixes that. * configure.ac(AC_CONFIG_FILE): Generate a new tests/data/Makefile file. * tests/Makefile.am: Link the data/ sub-directory from here. Move the EXTRA_DIST definition to ... * tests/data/Makefile.am: ... this new file here. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d259f37ca3 |
Hmh, finally EXTRA_DIST was just fine
* tests/Makefile.am: Put EXTRA_DIST back. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a6422da0a2 |
Make sure we don't try to build test data
* tests/Makefile.am: Replace EXTRA_DIST with noinst_DATA. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d09799377a |
Add loads of forgotten test data files to source distribution
* tests/Makefile.am: Add lots of test data file that were forgotten and then revealed by running make distcheck. Also fix some wrong paths to test data files. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1e55a1245e |
Make the alt dwarf debug file *not* be a symlink
* tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug: Make this be a real file, no more a symlink to ../../../test0-common-dwz.debug. * tests/data/test-alt-dwarf-file/test0-report.txt: Now that the file above is no more a symlink the message emitted by the test changes. It now says that the file found is the base name of the real file. So change the reference report accordingly. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1b4e3844e9 |
Nested automake conditionals don't work
* configure.ac (ENABLE_ZIP_ARCHIVE_AND_CXX11): Define this automake condition variable that is true if both the zip archive and c++11 features are enabled. This is important to know if the test runtestdot is going to be compiled. That test needs both c++11 and the zip archive features. * tests/Makefile.am: Do not nest automake conditional statements. It does not work. Rather, use the new ENABLE_ZIP_ARCHIVE_AND_CXX11 condition variable. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
c134ed84c7 |
If c++11 is disable do not execute the runtestdot test
* tests/Makefile.am: runtestdot should not be executed if c++11 is disabled. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3be48230b7 |
Sort reported changed declarations & types in a given scope
* src/abg-comparison.cc (struct changed_type_or_decl_comp, struct changed_vars_comp): New comparison functors. (sort_changed_type_or_decl, sort_changed_vars): New static functions. (scope_diff::report): Use the above to sort changed declarations, and types in a given scope. (corpus_diff::report): Likewise for the changed variables. * tests/data/test-abidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
0dd5f64279 |
Sort elf symbols before serializing them
* include/abg-corpus.h (corpus::{get_sorted_fun_symbols, get_sorted_var_symbols}): Declare new member functions. * src/abg-corpus.cc (corpus_priv::{sorted_var_symbols, sorted_fun_symbols}): New data members. (struct elf_symbol_comp_functor): Define new comparison functor. (corpus::{get_sorted_fun_symbols, get_sorted_var_symbols}): Define new member functions. * src/abg-writer.cc (write_elf_symbols_table): Take a sorted vector of symbols in parameters, rather than an unsorted map. (write_corpus_to_native_xml): Write a sorted vector of symbols, rather than an unsorted map of symbols. * tests/data/test-read-dwarf/test0.abi: Adjust. * 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/test6.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d3b188f859 |
Fix template parameter hashing: make it know about enclosing template
* include/abg-ir.h (template_parameter_sptr, template_decl_sptr) (template_decl_wptr): Declare new typedefs. (class template_decl): Make this virtually inherit decl_base and pimpl-ify it. (class template_parameter): Pimpl-ify this. Make the constructor take the enclosing template parameter. (struct template_decl::hash): Declare this here, rather than in src/abg-hash.cc (class type_tparameter, non_type_tparameter, template_tparameter) (class type_composition, function_tdecl, class_tdecl): Pimpl-ify this. * src/abg-hash.cc (template_parameter:#️⃣:operator()): Hash the enclosing template parameter. Avoid infinite recursion due to the loop hash parameter -> hash template -> hash parameter. (template_decl:#️⃣:operator()) Define this here, now that it's declared in abg-ir.h. Also, avoid infinite recursion here; this is complementary to what is done in the hashing for template_parameter. ({type_tparameter, template_tparameter, }:#️⃣:operator()): Cache the calculated hash just as what is done for other types hashed. (template_decl::priv): Define this new type. (template_decl::{add_template_parameter, get_template_parameters, ~template_decl}): Define these here to pimpl-ify template_decl. (template_parameter::priv): Define this new type. (template_parameter::template_parameter): Define this here to pimpl-ify template_parameter. Note also that this now takes the enclosing template decl. (template_parameter::{get_index, get_enclosing_template_decl, get_hashing_has_started, set_hashing_has_started, operator::==}): Define these here to pimpl-ify template_parameter. (type_tparameter::priv): Define this new type. (type_tparameter::type_tparameter): Define this here to pimpl-ify type_tparameter. Also, not that this constructor now takes the enclosing template decl. (class non_type_tparameter::priv): Define new type. (non_type_tparameter::{non_type_tparameter, get_type}): Define these here to pimpl-ify non_type_tparameter. The constructor now takes the enclosing template. (template_tparameter::priv): Define new type. (template_tparameter::template_tparameter): Define this here to pimpl-ify template_tparameter. This constructor now takes the enclosing template. (class type_composition::priv): New type. (type_composition::{type_composition, get_composed_type, set_composed_type}): Define these here to pimpl-ify type_composition. The constructor now takes the enclosing template decl. (class function_tdecl::priv): Define new type. (function_tdecl::{function_tdecl, set_pattern, get_pattern, get_binding}): Define this here to pimpl-ify function_tdecl. (class class_tdecl::priv): Define this new type. (class_tdecl::class_tdecl): Define this here to pimpl-ify class_tdecl. (class_tdecl::set_pattern): Adjust to pimpl-ify. (class_tdecl::get_pattern): Define new pimpl-ified getter. * src/abg-reader.cc (build_function_tdecl, build_class_tdecl): Cleanup. Pass the enclosing template to the template parameters that are built. (build_type_tparameter, build_type_composition) (build_non_type_tparameter, build_template_tparameter) (build_template_parameter): Take the enclosing template declaration and pass it to the template parameter being created. * tests/data/test-read-write/test12.xml: Fix and Adjust. * tests/data/test-read-write/test13.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a206dd881d |
Pass -std=gnu++11 to the compiler when --enable-cxx11 for tests
* tests/Makefile.am: Pass -std=gnu++11 to the compiler when --enable-cxx11 has been used. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1082520383 |
Make the use of a C++-11 compiler optional
* configure.ac: Define a new --enable-cxx11 switch to control the use of the C++-11 compiler. Define a WITH_CXX11 C macro and an automake ENABLE_CXX11 variable. * config.h.in: Initialize the new WITH_CXX11 C macro. * src/Makefile.am: Include the files coded in C++-11 only if the ENABLE_CXX11 automake variable is defined. * tests/Makefile.am: Likewise, build the runtestsvg test program only if C++-11 usage is enabled. * include/abg-diff-utils.h (class d_path_vec): Remove useless usage of the 'typename' keyword. * include/abg-fwd.h (is_enum_type): Renamed is_enum into this, because of a name clash with a tr1 function when not using C++-11. (is_pointer_type): Likewise, renamed is_pointer into this because of a name clash with a tr1 function when not using C++-11. * src/abg-comp-filter.cc (has_harmless_name_change): Adjust for the is_enum -> is_enum_type change. * src/abg-comparison.cc (type_suppression::suppresses_diff): Likewise. (class function_suppression::priv): Add a missing "class" keyword in friend declaration. (diff_context::diff_has_been_traversed) (diff_context::mark_diff_as_traversed): Do not use the C++-11 specific type uintptr_t. * src/abg-dwarf-reader.cc (create_default_dwfl): Do not use designated initializers. Sigh. This is handy though. (expr_result::abs): Cast the argument of std::abs to avoid ambiguous call. (finish_member_function_reading): Adjust for the is_pointer -> is_pointer_type renaming. * src/abg-hash.cc (scope_decl:#️⃣:operator) (class_decl::base_spec:#️⃣:operator) (type_composition:#️⃣:operator): Use std::tr1::hash string, rather than the C++-11 specific std::hash function. * src/abg-ini.cc (read_sections, write_sections): Make std::ifstream constructor take a const char* rather than a string. * src/abg-ir.cc (is_enum_type, is_pointer_type): Renamed is_enum into is_enum_type and is_pointer into is_pointer_type. * src/abg-writer.cc (write_translation_unit): Remove useless typename keyword. Make ofstream take a const char* rather than a string. (write_namespace_decl): Remove useless typename keyword. (write_corpus_to_native_xml_file): Make ofstream take a const char* rather than a string. * tests/test-abidiff.cc (main): Make ofstream take a const char* rather than a string. * tests/test-diff-dwarf.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2e896ce107 |
Initial support for variable suppressions
* include/abg-comparison.h (variable_suppression_sptr) (variable_suppressions_type): New convenience typedefs. (class variable_suppression): Declare new type. * src/abg-comparison.cc (is_var_diff): New predicate. (read_variable_suppression): Define new static function. (class variable_suppression::priv): Define type for the private data of the variable_suppression type. (variable_suppression::{variable_suppression, ~variable_suppression, get_name, set_name, get_name_regex_str, set_name_regex_str, get_symbol_name, set_symbol_name, get_symbol_name_regex_str, set_symbol_name_regex_str, get_symbol_version, set_symbol_version, get_symbol_version_regex_str, set_symbol_version_regex_str, get_type_name, set_type_name, get_type_name_regex_str, set_type_name_regex_str, suppresses_diff}): Define new member functions for the variable_suppression type. * tests/data/test-diff-suppr/libtest7-var-suppr-v0.so: Add new test input. * tests/data/test-diff-suppr/libtest7-var-suppr-v1.so: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-1.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-2.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-3.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-4.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-5.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-6.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-7.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-8.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-6.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-version-script: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-v0.cc: Source code for the librairie above. * tests/data/test-diff-suppr/test7-var-suppr-v1.cc: Source code for the librairie above. * tests/Makefile.am: Add the new test input data to the source distribution. * tests/test-diff-suppr.cc: Update to make this harness to run over the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
6ebf695323 |
Spit and polish variables presentation in diff report
* src/abg-comparison.cc (corpus_diff::report): Show the full representation of the variable, rather than just its name. Also, show the new representation of the variable only if it has changed. * tests/data/test-diff-dwarf/test9-report.txt: Adjust test. * tests/data/test-diff-filter/test15-0-report.txt: Likewise. * tests/data/test-diff-filter/test15-1-report.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
59324daa61 |
Separate alias targets with a comma
* src/abg-ir.cc (elf_symbol::get_aliases_id_string): Separate alias targets by a comma. * tests/data/test-diff-dwarf/test18-alias-sym-v1.cc: Update test to add more than one alias to a given symbol. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
23772b3f8d |
Initial support for function suppressions
* include/abg-comparison.h (enum visiting_kind): Change the meaning of this. It was to determine if traversal was to be done in a pre or post manner. But with the recent addition of diff_node_visitor::visit_{begin,end}() notifiers, the pre/post handling is taken care of in a different way. So now the meaning of this enum is changed to handle whether diff node children should be visited or not. So the enumerators are now DEFAULT_VISITING_KIND, and SKIP_CHILDREN_VISITING_KIND. And it's a bit-field. (operator{&,~}): Declare more bit manipulation operators for the enum visiting_kind. (function_suppression_sptr, function_suppressions_type): New typedefs. (function_suppression, function_suppression::parameter_spec): Declare new types. (read_function_suppressions): Declare new function. (diff_node_visitor::diff_node_visitor): Adjust for the enum visiting_kind change. Value-initialize the visiting_kind_ data member. * src/abg-comparison.cc (operator{&,~}): Define these operators for enum visiting_kind. (read_type_suppressions): Forward declare this static function. (read_function_suppression, read_parameter_spec_from_string): Define new static functions. (read_suppressions): Update to read function suppressions too, using the new read_function_suppression function above. (class function_suppression::parameter_spec::priv): Define new type. (function_suppression::parameter_spec::*): Define the member functions of the new function_suppression::parameter_spec type. (class function_suppression::priv): Define new type. (function_suppression::*): Define the member functions of the new function_suppression type. (diff::traverse): There is no more {PRE,POST}_VISITING_KIND enumerator. So nuke the code that was dealing with it. (redundancy_marking_visitor::skip_children_nodes_): New data member flag. (redundancy_marking_visitor::visit_begin): If the current diff node is not be reported (is filtered out), do not bother visit its children nodes for the purpose of marking redundant nodes. So use the new skip_children_nodes_ flag above to know we are in that case. (redundancy_marking_visitor::visit_end): Unset the new skip_children_nodes_ flag above when appropriate. * include/abg-fwd.h (is_function_decl): Declare new function. * include/abg-ir.h (function_type::get_parm_at_index_from_first_non_implicit_parm): Declare new member function. * src/abg-ir.cc (is_function_decl): Define new function. (function_type::get_parm_at_index_from_first_non_implicit_parm): Define new member function. * src/abg-comp-filter.cc (apply_filter): Adjust for the enum visiting_kind change. No need to set it for filters anymore * doc/suppr-doc.txt: Update examples of function suppression. * doc/manuals/libabigail-concepts.rst: Update the manual for the function suppression addition. * tests/data/test-diff-suppr/libtest5-fn-suppr-v0.so: New test input. * tests/data/test-diff-suppr/libtest5-fn-suppr-v1.so: New test input. * tests/data/test-diff-suppr/libtest6-fn-suppr-v0.so: New test input. * tests/data/test-diff-suppr/libtest6-fn-suppr-v1.so: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-1.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-2.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-4.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-v0.cc: Source code for new test input. * tests/data/test-diff-suppr/test5-fn-suppr-v1.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-1.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-2.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-v0.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-v1.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-version-script: New test input. * tests/Makefile.am: Add the new files above to source the distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the test inputs above to the list of tests to be run by this harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f44110b326 |
Support comparing symbols not referenced by debug info
* doc/manuals/abidiff.rst: Adjust intro to mention that w/o debug info, abidiff now works but just report about added/removed symbols. Add documentation about the new --no-unreferenced-symbols option. * include/abg-comparison.h (string_elf_symbol_map): New typedef. (diff_context::show_symbols_unreferenced_by_debug_info): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_syms_unreferenced_by_di_): New data member. (diff_context::priv::priv): Adjust. (diff_context::show_symbols_unreferenced_by_debug_info): Implement these accessors. (corpus_diff::priv::{unrefed_fn_syms_edit_script_, unrefed_var_syms_edit_script_, added_unrefed_fn_syms_, deleted_unrefed_fn_syms_, added_unrefed_var_syms_, deleted_unrefed_var_syms_}): New data members. (corpus_diff::priv::diff_stats::{num_func_syms_removed, num_func_syms_added, num_var_syms_removed, num_var_syms_added}): New data members. (corpus_diff::priv::diff_stats::diff_stats): Adjust. (corpus_diff::ensure_lookup_tables_populated): Populate lookup tables for added/removed symbols that are not referenced by any debug info. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute stats for the added/removed symbols not referenced by any debug info. (corpus_diff::priv::emit_diff_stats): Emit stats about added/removed symbols that are not referenced by any debug info. (corpus_diff::length): Adjust to take in account added/removed symbols not referenced by any debug info. (show_linkage_name_and_aliases): New static function. (corpus_diff::report): When emitting a symbol name, emit its version too, and tell if it aliases other symbols. Avoid emitted extra new lines. Report added/removed symbols not referenced by any debug info. (compute_diff): In the overload for corpus_sptr, compute the diffs for symbols not referenced by debug info. * include/abg-corpus.h (corpus::get_unreferenced_{function,variable}_symbols): Declare new member functions. * src/abg-corpus.cc (corpus_priv::{unrefed_fun_symbols, unrefed_var_symbols}): New data members. (corpus_priv::build_unreferenced_symbols_tables): Define new member function. (struct comp_elf_symbols_functor): New functor. (corpus::is_empty): Adjust to take in account added/removed symbols not referenced by debug info. (corpus::{get_unreferenced_function_symbols, corpus::get_unreferenced_variable_symbols}): Define these accessors. * include/abg-dwarf-reader.h (enum status): Transform this into bitfields. Add a STATUS_UNKNOWN value that has the value 0. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): New bit-wise operators to manipulate instances of the status bit-field. * src/abg-dwarf-reader.cc (get_version_for_symbol): Fix this to avoid returning garbage version sometimes. (read_debug_info_into_corpus): Fix this to return a non-null but empty corpus_sptr when there is no debug info available. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): Define these new bitwise operators to manipulate instances of the status bit-field. (read_corpus_from_elf): Now that the abigail::dwarf_reader::status is a bit-field, set it to reflect if debug info and/or symbol tables have been found. Do not bail out if debug info hasn't been found. Rather, keep going, and go look for symbols-only; this is a kind of operating in degraded mode. * include/abg-ir.h (elf_symbol::get_aliases_id_string): Add a flag that says if the current instance of elf_symbol should be included in the list of aliases or not. * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define it. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.o: New test input. * tools/abidiff.cc (options::show_symbols_not_referenced_by_debug_info): New data member. (options:options): Adjust. (display_usage): Add an info string for the new --no-unreferenced-symbols command line option. (parse_command_line): Parse the new --no-unreferenced-symbols command line. (set_diff_context_from_opts): Set the diff_context according to the presence of --no-unreferenced-symbols. (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field. * tools/abilint.cc (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field.. (): * tests/data/test-diff-dwarf/test16-syms-only-report.txt: New test reference output. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.o: New test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.cc: New source code for test input. * tests/data/test-diff-dwarf/libtest18-alias-sym-v{0,1}.so: New test input. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Reference output for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-version-script: Source code for new test input. * tests/Makefile.am: Add the new test materials to the source distribution. * tests/test-diff-dwarf.cc(in_out_specs): Add the new input tests above to the array of tests to run by this harness. (main): Emit empty reports for empty resulting diffs. * tests/data/test-diff-dwarf/test{0,8,9,12,14-inline-report,}-report.txt: Adjust. * tests/data/test-diff-filter/test{0,01,2,4,5,7,8,9,10,12,13,15-0,15-1}-report.txt: Likewise. * tests/data/test-diff-filter/test{19-enum,20-inline,}-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-{1,2}.txt: Likewise. * tests/data/test-diff-suppr/test{1,2}-typedef-suppr-report-1.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
70cb9ba1ae |
Yet another fix to the DWARF method "static-ness" detection heuristic
* include/abg-fwd.h (is_pointer, is_qualified_type): Declare new functions. * src/abg-ir.cc (is_pointer, is_qualified_type): Implement these new functions. * src/abg-dwarf-reader.cc (finish_member_function_reading): Sometimes, the this pointer of a non-static method can point to a *qualified* version of its containing type. I am seeing that when comparing libstdc++.so from RHEL 6.5 and RHEL 7. Take that in account when trying to detect that the first parameter of a member function is the this pointer, and thus detect that the function is a non static member function. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: New test input. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so: New test input. * tests/data/test-read-dwarf/test8-qualified-this-pointer.cc: Source code of new test input. * tests/test-read-dwarf.cc: Update copyright year. (in_out_spec): Add the new test inputs to this array, so that this test harness runs on them. * tests/Makefile.am: Add the new test inputs to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
4e07799f42 |
Properly propagate {REDUNDANT, SUPPRESSED}_CATEGORY wrt local changes
* src/abg-comparison.cc (suppression_categorization_visitor::visit_end): If a diff node carries local changes, then, even if all of its children node have been suppressed, this diff node shall not be categorized as suppressed by way of propagation. (redundancy_marking_visitor::visit_end): If a diff node carries local changes, then, even if all of its children nodes are redundant, this diff node shall not be categorized as being redundant by way of propagation. * tests/data/test-diff-suppr/libtest4-local-suppr-v{0,1}.so: New test inputs. * tests/data/test-diff-suppr/test4-local-suppr-0.suppr: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-v{0,1}.{c,h}: Source code of the new tests inputs. * tests/Makefile.am: Add the new test material to the source distribution. * tests/test-diff-suppr.cc (in_out_spec): Run this test harness over the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7a897fd723 |
Fix struct type kind suppression support
* src/abg-comparison.cc (type_suppression::suppresses_diff): Do not crash on diff nodes that are not about struct/classes, when "type_kind = struct" has been specified. * tests/data/test-diff-suppr/test2-struct-suppr-{0,1}.suppr: New test input. * tests/data/test-diff-suppr/test2-struct-suppr-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test2-struct-suppr-v{0,1}.o: Likewise * tests/data/test-diff-suppr/test2-struct-suppr-v{1,0}.cc: Source code for binary test input. * tests/test-diff-suppr.cc (in_out_spec): Run this harness on the new test input above. * tests/Makefile.am: Add the new test input files to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ed12dd4b6a |
Replace is_typedef by type_kind property in type suppressions
* doc/suppr-doc.txt: Add type_kind property "documentation" in the type suppression. * include/abg-comparison.h (type_suppression::type_kind): New enum. (type_suppression::{get_consider_typedefness, set_consider_typedefness, get_is_typedef, set_is_typedef}): Remove. (type_suppression::{get_consider_type_kind, set_consider_type_kind, get_type_kind, set_type_kind}): Declare new methods. * Include/abg-fwd.h (is_type_decl): Declare new function. (is_enum): Declare new overload that takes a type_base_sptr. * src/abg-comparison.cc (type_suppression::priv::{consider_typedefness_, is_typedef_}): Remove these data members. (type_suppression::priv::{consider_type_kind_, type_kind_}): New data members. (type_suppression::priv::priv): Adjust. (type_suppression::{get_consider_typedefness, set_consider_typedefness, get_is_typedef, set_is_typedef}): Remove these member functions. (type_suppression::{get_consider_type_kind, set_consider_type_kind, get_type_kind, set_type_kind}): Define these new member functions. (type_suppression::suppresses_diff): Adjust to consider the kind of types more generally than just considering typedef-ness. (read_type_kind_string): New static function. (read_type_suppression): Use the above to parse the value of the new type_kind property. Adjust the creation of the resulting type_suppression object. * src/abg-ir.cc (is_type_decl): Define new function. * tests/data/test-diff-suppr/test1-typedef-suppr-0.suppr: Adjust. * tests/data/test-diff-suppr/test1-typedef-suppr-1.suppr: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
feea5df3fe |
Initial support for type suppressions
* include/abg-comparison.h (diff_category::SUPPRESSED_CATEGORY): New enumerator. (diff_category::{SIZE_OR_OFFSET_CHANGE_CATEGORY, VIRTUAL_MEMBER_CHANGE_CATEGORY): Update the enumerator values for these. (diff::EVERYTHING_CATEGORY): Adjust. (suppression_base, type_suppression): Declare new types. (suppression_ptr, suppressions_type, type_suppression_sptr) (type_suppressions_type): New typedefs. (read_type_suppressions, read_suppressions): Declare new functions. (diff_context::{suppressions, add_suppression, add_suppressions}): Declare new methods. (diff::is_suppressed): Declare new member function. (apply_suppressions): Declare new function & overloads. * src/abg-comparison.cc (is_type_diff): Define new static function. ({suppression_base, type_suppression}::priv): Define new types. ({suppression_base, type_suppression}::*): Define the methods of the new suppression_base, type_suppressions types. (read_type_suppression, read_type_suppressions, read_suppressions) (read_type_suppressions): Define new static functions. (diff_context::priv::supprssions_): New data member. (diff_context::{suppressions, add_suppression, add_suppressions}): New methods. (diff::is_filtered_out): Consider that a diff node that is in the SUPPRESSED_CATEGORY is filtered out. (diff::is_suppressed): Define new member function. (operator<<(ostream& o, diff_category c)): Support the SUPPRESSED_CATEGORY category. (corpus_diff::report): Apply suppressions before reporting anything. (category_propagation_visitor::visit_end): Do not propagate SUPPRESSED_CATEGORY. This is just like what we do for REDUNDANT_CATEGORY. (struct suppression_categorization_visitor): New visitor. (apply_suppressions): Define function & overloads. * include/abg-ini.h (config::section::find_property): New method. (config::section): Fix end of class comment. * src/abg-ini.cc (config::section::find_property): Define new method. * tests/data/test-diff-suppr/test0-type-suppr-{0,1,2}.suppr: New test input files. * tests/data/test-diff-suppr/test0-type-suppr-report-{0,1,2,3}.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.o: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.o: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr.h: Source code for new test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.c: Likewise * tests/data/test-diff-suppr/test1-typedef-suppr-{0,1}.suppr: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise. * tests/test-diff-suppr.cc: New test harness to run type suppression tests using the input files above. * tests/data/test-diff-suppr/test3-struct-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test3-struct-suppr-1.suppr: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.o: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.o: Likewise. * tests/Makefile.am: Build the new runtestdiffsuppr test harness from the test-diff-filter.cc file. Add the new test files to the build system and source distribution. * tools/bidiff.cc (options::suppressions): New data member. (display_usage): Add a help string for the new --suppressions command line switch. (parse_command_line): Parse the --suppressions command line switch. (set_diff_context_from_opts): Read the suppressions provided by the --suppression command line switch and stuff them into the diff context. |
||
Dodji Seketeli
|
2a77bead11 |
Implement generic diff tree walking and port categorization over it
* include/abg-comp-filter.h (apply_filter): Declare new overload that takes a corpus_diff_sptr ... * src/abg-comp-filter.cc (apply_filter): ... and define it. On the existing overload for diff_sptr, make sure to traverse all diff nodes, even those that have already been traversed. * include/abg-comparison.h (enum diff_category): Remove NOT_REDUNDANT_CATEGORY, add REDUNDANT_CATEGORY. (operator&=, +operator<<): Declare new operators for enum diff_category. (diff_context::{forbid_traversing_a_node_twice, traversing_a_node_twice_is_forbidden): (diff_context::categorizing_redundancy): Remove this declaration. (diff_context::maybe_apply_filters): Declare a new overload that takes a corpus_diff_sptr. And a take a new flag that says if it should visit all nodes including those that have already been visited. (diff::priv_): Make this data member protected. (diff::{begin_traversing, is_traversing, end_traversing, finish_diff_type, children_nodes, append_child_node, get_pretty_representation, chain_into_hierarchy, traverse}): Declare new member functions. (distinct_diff::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Likewise. (distinct_diff::traverse): Remove. (pointer_diff::pointer_diff): Take the underlying type diff in parameter. (pointer_diff::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. (pointer_diff::traverse): Remove. (reference_type_def::reference_type_def): Take the underlying type diff in parameter. ({array_type_def, reference_type_def}::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({array_type_diff, reference_type_def}::traverse): Remove. (qualified_type_diff::qualified_type_diff): Take the underlying type diff in parameter. ({enum_diff, qualified_type_diff, class_diff}::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({enum_diff, qualified_type_diff, class_diff}::traverse): Remove. (is_class_diff): Declare new function. (base_diff::base_diff): Take the underlying type diff in parameter. ({scope_diff, base_diff}::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({scope_diff, base_diff}::traverse): Remove. (function_decl_diff::function_decl_diff): Take the return type diff as parameter. ({function_decl_diff, type_decl_diff}::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({function_decl_diff, type_decl_diff}::traverse): Remove. (typedef_diff::typedef_diff): Take the underlying type diff as parameter. (typedef::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({typedef, translation_unit_diff}::traverse): Remove member function. (corpus_diff::{finish_diff_type, children_nodes, append_child_node, changed_variables, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. (class diff_node_visitor::{visit_begin, visit_end}): Declare new member functions. (propagate_categories, print_diff_tree, categorizing_redundancy) (clear_redundancy_categorization, apply_filters): New functions and function overloads. * src/abg-comparison.cc (TRY_PRE_VISIT, TRY_PRE_VISIT_CLASS_DIFF) (TRY_POST_VISIT, TRY_POST_VISIT_CLASS_DIFF) (CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE) (UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE) (TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY) (TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY) (TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY) (ENSURE_DIFF_NODE_TRAVERSED_ONCE) (ENSURE_MEM_DIFF_NODE_TRAVERSED_ONCE): Remove these macros. Hurrah. (diff_context::priv::categorizing_redundancy_): Remove. (diff_context::priv::forbid_traversing_a_node_twice_): Add new data member. (diff_context::priv::priv): Adjust. (diff_context::{forbid_traversing_a_node_twice, traversing_a_node_twice_is_forbidden}): Define new member functions. (diff_context::maybe_apply_filters): Once filters are applied (and categories are set to the relevant diff tree nodes, run a pass over the diff tree to propagate the categories to the relevant diff tree parent nodes. Add an overload for corpus_diff_sptr. (diff_context::categorizing_redundancy): Remove member function. (diff_context::maybe_apply_filters): Define a new overload for corpus_diff_sptr (struct diff::priv::{finished_, traversing_, children_, pretty_representation_}): New data members. (diff::priv::priv): Adjust. (diff::{begin_traversing, is_traversing, end_traversing, finish_diff_type, children_nodes, append_child_node, traverse, set_category, get_pretty_representation, chain_into_hierarchy}): Define new member functions. (diff::is_filtered_out): Do not refer to NOT_REDUNDANT_CATEGORY anymore. Rather, use the new REDUNDANT_CATEGORY. ({distinct_diff, var_diff, pointer_diff, array_diff, reference_diff, qualified_type_diff, enum_diff, class_diff, base_diff, scope_diff, function_decl_diff, type_decl_diff, typedef_diff}::{get_pretty_representation, chain_into_hierarchy, finish_diff_type}): Define new member functions. ({distinct_diff, var_diff, pointer_diff, array_diff, reference_diff, qualified_type_diff, enum_diff, class_diff, base_diff, scope_diff, function_decl_diff, type_decl_diff, typedef_diff, translation_unit_diff}::traverse): Remove member functions. (operator&=, operator<<): Define new operators for diff_category. ({function_decl_diff, typedef_diff}::priv::priv): Add a new constructor. (pointer_diff::{priv::priv, pointer_diff}) (reference_diff::{priv::priv, reference_diff}) (qualified_type_diff::{priv::priv, qualified_type_diff}) (enum_diff::{priv::priv, enum_diff}, base_diff::{priv::priv, base_diff}, function_decl_diff::function_decl_diff): Take the underlying type diff in parameter. (compute_diff): Adjust the pointer_diff, reference_diff, qualified_type_diff, base_diff, function_decl_diff overloads. (class_diff::priv::{count_filtered_bases, count_filtered_subtype_changed_dm, count_filtered_changed_dm, count_filtered_changed_mem_fns, count_filtered_inserted_mem_fns, count_filtered_deleted_mem_fns}): Adjust for the call to diff_context::maybe_apply_filters. (corpus_diff::priv::{finished_, pretty_representation_}): New data member. (corpus_diff::priv::priv): New constructor. (corpus_diff::priv::clear_redundancy_categorization): Define new member function. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Adjust for call to diff_context::maybe_apply_filters. Also, call clear_redundancy_categorization at the end. (corpus_diff::priv::categorize_redundant_changed_sub_nodes): Revisit logic. (corpus_diff::{chain_into_hierarchy, finish_diff_type, children_nodes, append_child_node, changed_variables, get_pretty_representation}): Define new member functions. (corpus_diff::report): Categorize redundancy for every top level function/variable diff. (corpus_diff::traverse): Adjust to the new traversing interface. (diff_node_visitor::{visit_begin, visit_end}): Define new member functions. (struct category_propagation_visitor, struct diff_node_printer) (struct redundancy_marking_visitor, struct redundancy_clearing_visitor): New diff tree node visitors. (propagate_categories, print_diff_tree, categorize_redundancy) (clear_redundancy_categorization, apply_filters): Define new functions. * tests/Makefile.am: Add the new tests/print-diff-tree.cc to the source distribution. Build it into a tests/printdifftree binary. * tools/abidiff.cc (print_diff_tree): Add debugging functions to call from within the debugger. By default, this function and its overloads are not compiled. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5ebc8bf5dd |
Update copyright notice for tests/test-diff2.cc
* tests/test-diff2.cc: Update copyright year. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
4bed1e9b2c |
Avoid broken output for virtual member fns w/o symbols
* src/abg-comparison.cc (represent): When a virtual member function has no associated elf symbol, do not emit garbage in lieu of the linkage name. Just emit no linkage name; * tests/data/test-abidiff/test-struct1-report.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ed57bfdf08 |
Sort added/removed/changed functions reported by the comparison engine
* src/abg-comparison.cc (struct function_comp, struct changed_function_ptr_comp): New comparison functors. (sort_string_function_ptr_map) (sort_string_changed_function_ptr_map): Define new static functions. (corpus_diff::report): Sort the added/removed/changed functions that are reported. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. * tests/data/test-diff-filter/test01-report.txt: Adjust. * tests/data/test-diff-filter/test2-report.txt: Adjust. * tests/data/test-diff-filter/test9-report.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
0161504b68 |
Mention virtual-ness of member function in their pretty representation
* include/abg-fwd.h (get_member_function_is_virtual): Declare new overload for pointers. * src/abg-ir.cc (get_member_function_is_virtual): Define it. (function_decl::get_pretty_representation): Print virtual-ness of the function_decl being pretty printed. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
cbf1debeab |
Fix reading several clones of the same member function from DWARF
* include/abg-fwd.h (set_member_function_is_ctor) (set_member_function_is_dtor, set_member_function_is_const) (set_member_function_vtable_offset): Declare new functions. * include/abg-ir.h (class_decl::sort_virtual_mem_fns): Declare new member function. (mem_fn_context_rel::{vtable_offset, is_constructor is_destructor, is_const}): Add these setters. (set_member_function_is_ctor, set_member_function_is_dtor) (set_member_function_is_static, set_member_function_is_const) (set_member_function_vtable_offset) (set_member_function_is_virtual): Declare these new friend function to class class_decl::method_decl. * src/abg-dwarf-reader.cc (finish_member_function_reading): Split this out from build_class_type_and_add_to_ir. Use the new setters for member functions properties introduced above. (build_class_type_and_add_to_ir): Factorize the creation of member function by using build_ir_node_from_die. Once that function has created the member function in a rather generic way, use the new finish_member_function_reading to set the remaining specific properties for member functions. (build_function_decl): When called to read additional properties of a function_decl, allow this to read and update the elf symbol properties too. This is useful for building a clone of a function that already has an elf symbol. (build_ir_node_from_die): When building a function decl, consider the case of a DIE that has both DW_AT_specification and DW_AT_abstract_origin set. That is, DW_AT_abstract_origin is set, and the origin has DW_AT_specification set. This is basically a clone of a function that implements an interface (this happens for destructors, for instance). In this case, really do the cloning of the interface implementation. If the cloned function happens to be member function, use finish_member_function_reading to read the properties relevant to its method-ness. * src/abg-ir.cc (set_member_function_is_ctor) (set_member_function_is_dtor, set_member_function_is_const) (set_member_function_vtable_offset) (class_decl::sort_virtual_mem_fns): Define new functions. (sort_virtual_member_functions): Define new static function. (struct virtual_member_function_less_than): New functor. (class_decl::add_member_function): Keep virtual member functions vector sorted. * data/test-read-dwarf/test1.abi: Adjust. Now, both the cdtor specification and all the clones that implements the different are emitted. * data/test-read-dwarf/test2.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d041c1f5dd |
Rename bi* tools to abi* tools
* tests/data/test-bidiff: Rename this directory to tests/data/test-abidiff. * tests/test-bidiff.cc: Renamed this to tests/test-abidiff.cc. * tools/biar.cc: Renamed to tools/abiar.cc * tools/bidiff.cc: Renamed to tools/abidiff.cc * tools/bidw.cc: Renamed to tools/abidw.cc * tools/bilint.cc: Renamed to tools/abilint.cc * tools/bisym.cc: Renamed to tools/abisym.cc * tests/test-alt-dwarf-file.cc: Renamed references to bidw* to abidw*. * tests/test-diff-filter.cc: Renamed references to bidiff to abidiff. * tests/test-lookup-syms.cc: Renamed references to bisym to abisym. * tools/Makefile.am: Adjust. * tests/Makefile.am: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fde3436568 |
Better support for inline related diffs
* include/abg-comparison.h (diff_category::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY): New enumerator. (diff_category::EVERYTHING_CATEGORY): Adjust. * include/abg-ir.h (elf_symbol::get_aliases_id_string) (elf_symbol::does_alias, elf_symbols_alias) (compute_aliases_for_elf_symbol): Declare new functions ... * src/abg-ir.cc (elf_symbol::get_aliases_id_string) (elf_symbol::does_alias, elf_symbols_alias) (compute_aliases_for_elf_symbol): ... and define them. (function_decl::operator==): Take in account elf symbol aliases. * src/abg-comp-filter.cc (function_name_changed_but_not_symbol): Define new static functions. (harmless_filter::visit): Categorize function name changes that n doesn't impact underlying elf symbols (or the fact that two symbols were aliases and are not anymore) as harmless. * src/abg-comparison.cc (function_decl_diff::report): Properly report function name changes, or symbol aliases changes for that matter. Also report inline-ness declaration changes. * src/abg-dwarf-reader.cc (die_is_declared_inline): New static function. (build_function_decl): Use the above. * tools/bidiff.cc (set_diff_context_from_opts): Add abigail::comparison::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY into the harmless change camp. * tests/data/test-diff-dwarf/test14-inline-report.txt: New test input. * tests/data/test-diff-dwarf/test14-inline-v0.o: Likewise. * tests/data/test-diff-dwarf/test14-inline-v1.o: Likewise. * tests/data/test-diff-dwarf/test14-inline-v0.cc: Source code for test input. * tests/data/test-diff-dwarf/test14-inline-v1.cc: Source code for test input. * tests/test-diff-dwarf.cc: Run this test harness over the new input above. * tests/data/test-diff-filter/test20-inline-report-0.txt: Likewise. * tests/data/test-diff-filter/test20-inline-report-1.txt: Likewise. * tests/data/test-diff-filter/test20-inline-v0.o: New test input. * tests/data/test-diff-filter/test20-inline-v1.o: New test input. * tests/data/test-diff-filter/test20-inline-v0.cc: Source code for test input. * tests/data/test-diff-filter/test20-inline-v1.cc: Likewise. * tests/test-diff-filter.cc: Run this test harness over the new input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ba487a2cd9 |
Better support for enum diffs
* include/abg-comparison.h (changed_enumerator_type): New typedef. (diff_category::{HARMLESS_ENUM_CHANGE_CATEGORY}): New enumerator. * src/abg-comp-filter.cc (has_type_size_change) (has_enumerator_insertion, has_enumerator_removal_or_change) (has_harmful_enum_change): New functions. (harmless_filter::visit): Categorize enumerator insertions that don't change the size of the type into HARMLESS_ENUM_CHANGE_CATEGORY. (harmful_filter::visit): Categorize enumerator removal or any enum change that changes the size of the type into SIZE_OR_OFFSET_CHANGE_CATEGORY. * src/abg-comparison.cc (enumerator_value_comp) (changed_enumerator_comp): New types. (sort_enumerators, sort_changed_enumerators): New static functions. (enum_diff::report): Sort enum related reports by the value of the enumerators. * src/abg-dwarf-reader.cc (build_enum_type): Name anonymous enums as __anonymous_enum__. * tools/bidiff.cc (set_diff_context_from_opts): Add abigail::comparison::HARMLESS_ENUM_CHANGE_CATEGORY into the harmless stuff camp. * tests/data/test-diff-dwarf/test15-enum-report.txt: New test input. * tests/data/test-diff-dwarf/test15-enum-v1.o: Likewise. * tests/data/test-diff-dwarf/test15-enum-v0.o: Likewise. * tests/data/test-diff-dwarf/test15-enum-v0.cc: Source code for test input. * tests/data/test-diff-dwarf/test15-enum-v1.cc: Likewise. * tests/data/test-diff-filter/test19-enum-report-0.txt: New test input. * tests/data/test-diff-filter/test19-enum-report-1.txt: Likewise. * tests/data/test-diff-filter/test19-enum-v0.o: Likewise. * tests/data/test-diff-filter/test19-enum-v1.o: Likewise. * tests/data/test-diff-filter/test19-enum-v0.cc: Source code for test input. * tests/data/test-diff-filter/test19-enum-v1.cc: Likewise. * tests/test-diff-dwarf.cc: Run this test harness on the new test inputs above. * tests/test-diff-filter.cc: Likewise. * tests/Makefile.am: Add the new files above to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Jan Engelhardt
|
aa7fc67119 |
Set automake options globally
* configure.ac(AM_INIT_AUTOMAKE): Set the subdir-object option here .. * src/Makefile.am: ... not here. * tests/Makefile.am: Likewise. * tools/Makefile.am: Likewise. Signed-off-by: Jan Engelhardt <jengelh@inai.de> |
||
Dodji Seketeli
|
b7030c5511 |
Adjust copyright year
* tests/test-diff-dwarf.cc: Adjust year in copyright notice. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d38b2216a4 |
Sort reported changed data members by increasing offset
* include/abg-comparison.h (changed_type_or_decl_vector): New typedef. * include/abg-fwd.h (is_data_member): Change the overload that takes a decl_base_sptr to make it return the real var_decl_sptr rather than just a bool. * src/abg-comparison.cc (ChangedDataMemberComp, DataMemberComp): New comparison functors. (sort_changed_data_members, sort_data_members): Sorting functions for changed data members and data members. (class_diff::report): Sort reports for deleted, inserted and change data members by the increasing value of the offsets of said data members. * src/abg-ir.cc (is_data_member): Change the overload that takes a decl_base_sptr to make it return the real var_decl_sptr rather than just a bool. * tests/data/test-bidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-dwarf/test13-report.txt: New test input. * tests/data/test-diff-dwarf/test13-v0.cc: Source code for new test input. * tests/data/test-diff-dwarf/test13-v0.o: New test input. * tests/data/test-diff-dwarf/test13-v1.cc: Source code for new test input. * tests/data/test-diff-dwarf/test13-v1.o: New test input. * tests/Makefile.am: Add the new test inputs above to the source distribution. * tests/test-diff-dwarf.cc: Run this test harness on the new test input. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b75a020fb1 |
Do not filter out diff nodes that are only in NOT_REDUNDANT_CATEGORY
* src/abg-comparison.cc (diff::is_filtered_out): If a diff not is only in the NOT_REDUNDANT_CATEGORY category consider it as not being filtered. * tests/data/test-diff-filter/test18-report.txt: New test input. * tests/data/test-diff-filter/test18-v0.cc: Source code for new test input. * tests/data/test-diff-filter/test18-v0.o: New test input. * tests/data/test-diff-filter/test18-v1.cc: Source code for new test input. * tests/data/test-diff-filter/test18-v1.o: New test input. * tests/Makefile.am: Add the new test inputs to the source distribution. * tests/test-diff-filter.cc: Run this test harness on the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
8aa76764ec |
Remove useless new line from comparison engine's report
* src/abg-comparison.cc (class_diff::report): Do not emit new lines after reporting about inserted data members. * tests/data/test-bidiff/test-qual-type0-report.txt: Adjust. * tests/data/test-bidiff/test-struct0-report.txt: Adjust. * tests/data/test-bidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. * tests/data/test-diff-dwarf/test1-report.txt: Adjust. * tests/data/test-diff-dwarf/test3-report.txt: Adjust. * tests/data/test-diff-dwarf/test7-report.txt: Adjust. * tests/data/test-diff-filter/test0-report.txt: Adjust. * tests/data/test-diff-filter/test01-report.txt: Adjust. * tests/data/test-diff-filter/test1-report.txt: Adjust. * tests/data/test-diff-filter/test11-report.txt: Adjust. * tests/data/test-diff-filter/test14-0-report.txt: Adjust. * tests/data/test-diff-filter/test14-1-report.txt: Adjust. * tests/data/test-diff-filter/test15-0-report.txt: Adjust. * tests/data/test-diff-filter/test15-1-report.txt: Adjust. * tests/data/test-diff-filter/test16-report.txt: Adjust. * tests/data/test-diff-filter/test17-0-report.txt: Adjust. * tests/data/test-diff-filter/test17-1-report.txt: Adjust. * tests/data/test-diff-filter/test2-report.txt: Adjust. * tests/data/test-diff-filter/test3-report.txt: Adjust. * tests/data/test-diff-filter/test9-report.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f1e79c86fe |
Factorize basic redundancy detection in diff report
* src/abg-comparison.cc (RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER) (RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER{2,3}): New macros. ({pointer_diff, array_diff, reference_diff, qualified_type_diff, class_diff, typedef_diff}::report): Use the new macros above. * tests/data/test-bidiff/test-qual-type0-report.txt: Adjust because type pretty representation are now always quoted. * tests/data/test-bidiff/test-struct1-report.txt: Adjust likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
36ed6e0583 |
Make zip archive support optional
* configure.ac: Support a new --enable-zip-archive option. By default its value is set to the 'auto', meaning that if libzip is installed, that turns the option on -- just like if --enable-zip-archive was called with the value 'yes'; if libzip is not installed, that turns the option off -- just like if --enable-zip-archive was called with the value 'no'. If libzip is detected, the pre-processor macro HAVE_LIBZIP is set to 1. If --enable-zip-archive is turned on, the pre-processor macro WITH_ZIP_ARCHIVE is set to 1. * config.h.in (HAVE_LIBZIP, WITH_ZIP): New define. * src/abg-corpus.cc: Include config.h. Guard the inclusion of abg-libzip-utils.h with the WITH_ZIP_ARCHIVE macro. Likewise for the use of declarations coming from abg-libzip-utils.h. * src/abg-libzip-utils.cc: Include config.h. Guard the file's content with the WITH_ZIP_ARCHIVE macro. * src/abg-reader.cc: Include config.h. Guard the inclusion of abg-libzip-utils.h with the WITH_ZIP_ARCHIVE. Likewise for the use of declarations coming from abg-libzip-utils.h. * src/abg-writer.cc: Likewise. * tests/Makefile.am: Build runtestwritereadarchive and runtestdot only if zip archives are supported. * tools/Makefile.am: The biar program is built only if zip archives are supported. * tools/bidiff.cc: Handle zip archives only if the WITH_ZIP_ARCHIVE macros is defined. * tools/bilint.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
bc7694e14c |
During redundancy marking start with the current node as non redundant
* src/abg-comparison.cc (ENSURE_DIFF_NODE_TRAVERSED_ONCE): If the diff node is being traversed for the first time, mark it as being in the NOT_REDUNDANT_CATEGORY. I don't know why I was doing this only for classes and basic types. Update comments. * tests/data/test-diff-filter/test16-report.txt: New test input. * tests/data/test-diff-filter/test16-v0.cc: Source code of new test input. * tests/data/test-diff-filter/test16-v0.o: New test input. * tests/data/test-diff-filter/test16-v1.cc: Source code of new test input. * tests/data/test-diff-filter/test16-v1.o: New test input. * tests/data/test-diff-filter/test17-0-report.txt: Likewise. * tests/data/test-diff-filter/test17-1-report.txt: Likewise. * tests/data/test-diff-filter/test17-v0.cc: Source code of new test input. * tests/data/test-diff-filter/test17-v0.o: Likewise. * tests/data/test-diff-filter/test17-v1.cc: Source code of new test input. * tests/data/test-diff-filter/test17-v1.o: Likewise. * tests/Makefile.am: Add the new files to the source distribution. * tests/test-diff-filter.cc (in_out_spec): Run this test harness over the new test inputs. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
83ed508010 |
In bidiff, change --no-linkage-names to --no-linkage-name
* tools/bidiff.cc (display_usage): Change--no-linkage-names -o --no-linkage-name in the help string. (parse_command_line): Adjust the command line parsing accordingly. * tests/test-diff-filter.cc (in_out_specs): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
97cabc1248 |
In diff reports, fns & members add/remove at the top, changes later.
* src/abg-comparison.cc (class_diff::report): Put virtual member function adding/removal/change first, then data members add/removal, then the rest (including data members changes). (corpus_diff::report): Put function adding/removal first, then function changes. Likewise for variables. * tests/data/test-bidiff/test-struct0-report.txt: Adjust. * tests/data/test-bidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. * tests/data/test-diff-dwarf/test1-report.txt: Adjust. * tests/data/test-diff-dwarf/test12-report.txt: Adjust. * tests/data/test-diff-dwarf/test8-report.txt: Adjust. * tests/data/test-diff-dwarf/test9-report.txt: Adjust. * tests/data/test-diff-filter/test0-report.txt: Adjust. * tests/data/test-diff-filter/test01-report.txt: Adjust. * tests/data/test-diff-filter/test1-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/test3-report.txt: Adjust. * tests/data/test-diff-filter/test9-report.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b13345fd86 |
Take symbol versions in account when computing added/removed decls
* include/abg-corpus.h (corpus::lookup_{function,variable}_symbol): Add an overload declaration that takes the version of the symbol to lookup. * src/abg-comparison.cc (corpus_diff::priv::ensure_lookup_tables_populated): So when looking up the corpora for symbols, take their versions in account. * src/abg-corpus.cc (corpus::lookup_{function,variable}_symbol): Add an overload definition that takes the version of the symbol to lookup. (symtab_build_visitor_type::build_id): New member functions. (corpus::priv::build_public_decl_table): Use the new member functions above. * src/abg-ir.cc (elf_symbol::version::operator==): Do not take the is_default flag in account when comparing two symbol versions. * libtest12-v{0,1}.so: New test input files. * libtest12-v{0,1}.c: Source code for the test input files. * test12-version-script: Version script to build the files above. * test12-report.txt: Test input file. * tests/Makefile.am: Add the new test input files above to the source distribution. * tests/test-diff-dwarf.cc (in_out_specs[]): Add an entry to this table for the new test input files. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b6d7fcc515 |
A builtin type name change is not harmless - fix that
* include/abg-comp-filter.h (has_harmless_name_change): New function declaration. * include/abg-comparison.h (diff_category::DECL_NAME_CHANGE_CATEGORY): Renamed this into HARMLESS_DECL_NAME_CHANGE_CATEGORY. (diff_category::EVERYTHING_CATEGORY): Update. * include/abg-fwd.h (is_enum): New function declaration. (is_var_decl): Return the shared_ptr<var_decl> rather than a bool. (is_data_member): New overload that takes a shared_ptr<decl_base>. * src/abg-comp-filter.cc (decl_name_changed): Consider the qualified name here. (has_harmless_name_change): Define new function declaration. (harmless_filter::visit): Use the new has_harmless_name_change function. * src/abg-comparison.cc (represent) (report_name_size_and_alignment_changes, enum_diff::report) (typedef_diff::report, is_data_member): Use the new filtering::has_harmless_name_change function to simplify logic of emitting the name change related diff * tools/bidiff.cc (set_diff_context_from_opts): Adjust DECL_NAME_CHANGE_CATEGORY -> HARMLESS_DECL_NAME_CHANGE_CATEGORY. * src/abg-ir.cc (is_data_member, is_enum): New function definitions. (is_var_decl): Return the var_decl_sptr rather than just a bool. * tests/data/test-diff-filter/test13-report.txt: Adjust. * tests/data/test-diff-filter/test6-report.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Ondrej Oprala
|
055a789abe |
Support C and C++ array type.
* include/abg-comparison.h (array_diff): Declare new class. (array_diff_sptr): Shared pointer to type array_diff. (compute_diff): Overload the function to take type array_diff_sptr as the first two arguments. * include/abg-fwd.h (array_type_def): Declare new class. (subrange_type): Likewise. (is_array_def): Declare new function. * include/abg-ir.h (array_type_def_sptr): Shared pointer to type array_type_def. (array_type_def): Declare new class. (ir_node_visitor::visit): Declare a new virtual function taking a pointer to type array_type_def as an argument. * src/abg-comparison.cc (compute_diff_for_types): Add try_to_diff for two instances of type array_type_def. (array_diff::priv): declare struct for holding private members of type array_diff. (array_diff::array_diff): Define constructor. (array_diff::{first,second}_array):Define new member functions. (array_diff::element_type_diff): Likewise. (array_diff::{length,report,traverse}): Likewise. (compute_diff): Define function overloaded in include/abg-comparison.h. * src/abg-dwarf-reader.cc (build_array_type): Define new function. Handle DW_TAG_array_type and DW_TAG_subrange type. (build_ir_node_from_die): Amend case DW_TAG_array_type with a call to build_array_type. * src/abg-hash.cc (array_type_def::hash): Declare new struct. (type_base::dynamic_hash::operator()): Attempt to dynamic_cast the argument to type array_type_def as well. (array_type_def::hash): Declare new struct. * src/abg-ir.cc (array_type_def::array_type_def): Define constructors. (array_type_def::priv): declare struct for holding private members of type array_type_def. (array_type_def::operator==(const decl_base&): Define new operator. (array_type_def::operator==(const type_base&): Likewise. (array_type_def::append_subrange{,s}): Define new functions. (array_type_def::{set,get}_size_in_bits): Likewise. (array_type_def::get_dimension_count): Likewise. (array_type_def::get_qualified_name): Likewise. (array_type_def::get_pretty_representation): Likewise. (array_type_def::get_subrange_representation): Likewise. (array_type_def::traverse): Likewise. (array_type_def::get_{element_type,location,subranges}): Likewise. (array_type_def::is_infinite): Likewise. (array_type_def::~array_type_def): Define destructor. (ir_node_visitor::visit): Define function, taking pointer to array_type_def as an argument. * src/abg-reader.cc (map_id_and_node): Check if node is an array. (is_array_def): Check if object is an array. (handle_element_node): Handle array_type_def as well. (build_subrange_type): Define new function. (build_array_type_def): Likewise. (build_type): Build type array_type_def as well. (build_type_composition): Likewise. (handle_array_type_def): Define new function. * src/abg-writer.cc: (write_decl): Output arrays as well. (write_member_type): Likewise. (write_type_composition): Likewise. (write_array_type_def): Define new function. * tests/data/test-diff-dwarf/test{10,11}-v{0,1}.{cc,o}: New test source files * tests/data/test-diff-dwarf/test{10,11}-report.txt: Likewise. * tests/data/test-diff-dwarf/test10-report.txt: New test input. * tests/data/test-read-dwarf/test7.cc: New test source file. * tests/data/test-read-dwarf/test7.so: New input binary to read. * tests/data/test-read-dwarf/test7.so.abi: New reference test to compare against. * tests/data/test-read-write/test25.xml: New test source file. * tests/test-diff-dwarf.cc: Adjust to launch the new test. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * test/Makefile.am: Add the new test inputs to the source distribution. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d08e5181f2 |
Support TLS variables
* src/abg-ir.cc (elf_symbol::is_variable): Accept TLS objects as variables too. * src/abg-dwarf-reader.cc (eval_last_constant_dwarf_sub_expr) (die_location_address): Add an output parameter to say if the resulting constant value is a tls address or not. (lookup_public_variable_symbol_from_elf): Use the proper elf_symbol::is_variable() method, rather than trying to figure out the low levels of what a variable is here. Also, cleanup the condition. (read_context::load_symbol_maps): Consider symbols of type STT_TLS, when loading symbols for variables. Also, to avoir symbols that are for versions, filter out symbols of type STT_OBJECT and with a SHN_ABS section index. (read_context::get_variable_address): If the address is for a tls variable, do no try to adjust the address to arrange for things like prelink. As that doesn't seem to affect TLS variables. (dwarf_expr_eval_context::set_tls_addr): New data member. (dwarf_expr_eval_context::dwarf_expr_eval_context): Initialize it. (dwarf_expr_eval_context::set_tls_address): New accessors. (dwarf_expr_eval_context::op_manipulates_stack): Handle DW_OP_GNU_push_tls_address, a bit like DW_OP_form_tls_address, but then, its result is a constant. Set the dwarf_expr_eval_context::set_tls_addr flag when these two OPs are run. (die_member_offset): Adjust to the new signature of eval_last_constant_dwarf_sub_expr. * tests/data/test-diff-dwarf/libtest9-v0.so: New test input. * tests/data/test-diff-dwarf/libtest9-v1.so: Likewise. * tests/data/test-diff-dwarf/test9-report.txt: Likewise * tests/data/test-diff-dwarf/test9-v0.cc: Source code for the first input. * tests/data/test-diff-dwarf/test9-v1.cc: Source code for the second input. * tests/test-diff-dwarf.cc: Run this harness on the two new inputs above. * tests/Makefile.am: Add the new inputs to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1bd8dcf173 |
Make the link to the alt debug info file relative
* tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug: Make this link be relative. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
da4f096bb9 |
White space fix
* tests/test-lookup-syms.cc: Remove useless white space. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7fa9c3ca04 |
Update copyright notice
* tests/test-lookup-syms.cc: Update year in copyright notice. * tools/bidw.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7b126c03a0 |
Support alternate debug info sections
ABGBZ#17193 * include/abg-dwarf-reader.h (class read_context) (typedef read_context_sptr, create_read_context) (has_alt_debug_info): Declare these. (read_corpus_from_elf): Declare new overload. * src/abg-dwarf-reader.cc (find_alt_debug_info) (is_die_attribute_resolved_through_gnu_ref_alt) (build_primary_die_parent_relations_under) (build_alternate_die_parent_relations_under): Define new static functions. (read_context::{alt_dwarf_, alt_debug_info_path_, alternate_die_decl_map_, alternate_die_parent_map_}): New data members. (read_context::{alt_dwarf, alt_debug_info_path, alternate_die_decl_map, associate_die_to_decl_primary, associate_die_to_decl_alternate, associate_die_to_decl, lookup_decl_from_die_offset_primary, lookup_decl_from_die_offset_alternate, lookup_decl_from_die_offset, alternate_die_parent_map}): New member functions. (read_context::load_debug_info): Painfully Get a handle on the alternate debug info section too. We shouldn't have to do all this work; we could use the new dwarf_getalt() function from libdw, but we cannot as we want to support supports that predate that api. When a version of elfutils gets released with that api though, we should conditionally use that instead. (build_ir_node_from_die, get_parent_die, get_scope_for_die) (build_namespace_decl_and_add_to_ir) (build_class_type_and_add_to_ir, build_qualified_type) (build_pointer_type_def, build_reference_type, build_typedef_type) (build_var_decl, build_function_decl): Take a new parameter that tells if the input DIE is from alternate debug info. Adjust their code accordingly. (die_die_attribute): Take a new output parameter that tells if the resolved DIE is from alternate debug info. Also take a new parameter that tells if the input DIE is from alternate debug info sections. (build_die_parent_relations_under): Take the DIE -> parent map to act upon. Also, add a new overload that takes a flag saying if the DIE is from alternate debug info or not, and act upon that. (build_die_parent_maps): Renamed build_die_parent_map into this and make it build DIE -> parent DIE relationship for the alternate debug info file as well. (find_last_import_unit_point_before_die, ): Adjust to use the information about if the relevant DIEs are in alternate debug info or not. (build_translation_unit_and_add_to_ir): Clear the alternate DIE -> decl map, that is per TU just as the primary DIE -> decl map. Adjust to use the information about if the relevant DIEs are in alternate debug info or not. (read_debug_info_into_corpus): Build the two DIE -> DIE parent maps (one for the primary debug info and one for the alternate debug info). (create_read_context, has_alt_debug_info): Define new public entry points. (read_corpus_from_elf): New entry point overload that takes a read_context. * tools/bidw.cc (options::{check_alt_debug_info_path, show_base_name_alt_debug_info_path}): New data members. (display_usage): Update for the two new options --check-alternate-debug-info and check-alternate-debug-info-base-name. (parse_command_line): Parse the two options above. (main) Handle the two new options above. * tests/Makefile.am: Build the new runtestaltdwarf test. Add the new data/test-alt-dwarf-file/* files to the build system. * tests/test-alt-dwarf-file.cc: New test driver. * tests/data/test-alt-dwarf-file/test0-common.cc: New test input files. * tests/data/test-alt-dwarf-file/libtest0-common.so: Likewise. * tests/data/test-alt-dwarf-file/test0.cc: Likewise. * tests/data/test-alt-dwarf-file/libtest0.so: Likewise. * tests/data/test-alt-dwarf-file/test0.h: Likewise. * tests/data/test-alt-dwarf-file/test0-common-dwz.debug: Likewise. * tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug: Likewise. * tests/data/test-alt-dwarf-file/test0-debug-dir/test0-common-dwz.debug: Likewise. * tests/data/test-read-dwarf/test1.abi: Adjust. bidw doesn't emit an abstract constructor/destructor anymore. It emits just the functions matching the cdtor symbols found in the binary. * tests/data/test-read-dwarf/test2.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3b6d0ec0a9 |
Correctly write the name of a const reference type
* src/abg-dwarf-reader.cc (maybe_strip_qualification): Define new function. (build_ir_node_from_die): Use the maybe_strip_qualification when building a qualified type. * src/abg-ir.cc (qualified_type_def::build_name): Fix the representation of the name of a reference that is const. * tests/data/test-read-dwarf/test1.abi: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Likewise. * tests/data/test-diff-dwarf/test1-report.txt: Likewise. * tests/data/test-diff-dwarf/test6-report.txt: Likewise. * tests/data/test-diff-dwarf/test7-report.txt: Likewise. * tests/data/test-diff-dwarf/test8-report.txt: Likewise. * tests/data/test-diff-filter/test0-report.txt: Likewise. * tests/data/test-diff-filter/test01-report.txt: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test3-report.txt: Likewise. * tests/data/test-diff-filter/test9-report.txt: Likewise. * tests/data/test-diff-filter/test10-report.txt: Likewise. * tests/data/test-diff-filter/test13-report.txt: Likewise. * tests/data/test-diff-filter/test14-0-report.txt: Likewise. * tests/data/test-diff-filter/test14-1-report.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Sinny Kumari
|
fe6b9fb61b |
Consider symbols with STB_GNU_UNIQUE binding as public
* src/abg-ir.cc (is_public): Change in function to consider symbols with STB_GNU_UNIQUE binding as public * tests/data/test-read-dwarf/test6.cc: Test file to generate STB_GNU_UNIQUE binding symbols * tests/data/test-read-dwarf/test6.so: Test shared library having STB_GNU_UNIQUE binding symbols * tests/data/test-read-dwarf/test6.so.abi: XML file containing dwarf information from test6.so * tests/test-read-dwarf.cc (in_out_specs): Add the new test above * tests/Makefile.am: Add tests/data/test-read-dwarf/test6.cc, tests/data/test-read-dwarf/test6.so and tests/data/test-read-dwarf/test6.so.abi to the distribution Signed-off-by: Sinny Kumari <skumari@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a11912d964 |
Add comment to test-read-write.cc
* tests/test-read-write.cc: Update copyright notice and add a meaningful comment for the file. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
01cd814bbc |
Support reading void* type from DWARF
* include/abg-ir.h (type_decl::get_void_type_decl): Declare new static method. * src/abg-ir.cc (type_decl::get_void_type_decl): Define it. * src/abg-dwarf-reader.cc (build_ir_node_for_void_type): Define new static function. (build_pointer_type_def): Support void* type nodes here. * tests/data/test-read-dwarf/test5.cc: Source code for new test input. * tests/data/test-read-dwarf/test5.o: New test input. * tests/data/test-read-dwarf/test5.o.abi: Likewise. * tests/Makefile.am: Add the above to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Mark Wielaard
|
453ed93d01 |
Handle C99 restrict qualifier and DWARFv3 DW_TAG_restrict_type.
* src/abg-dwarf-reader.cc (build_qualified_type): Handle DW_TAG_restrict_type by adding CV_RESTRICT. (build_ir_node_from_die): Call build_qualified_type for DW_TAG_restrict_type. * src/abg-reader.cc (build_qualified_type_decl): Handle "restrict" attribute by adding CV_RESTRICT. * src/abg-writer.cc (write_qualified_type_def): Output "restrict" attribute for CV_RESTRICT. * tests/data/test-read-dwarf/test4.c: New test file. * tests/data/test-read-dwarf/test4.so: Likewise. * tests/data/test-read-dwarf/test4.so.abi: Likewise. * tests/data/test-read-write/test24.xml: Likewise. * tests/test-read-dwarf.cc (in_out_specs): Add test4. * tests/test-read-write.cc (in_out_specs): Add test24.xml. Signed-off-by: Mark Wielaard <mjw@redhat.com> |