mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-19 00:14:33 +00:00
0af65e6364
445 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Dodji Seketeli
|
0af65e6364 |
Fix performance regression while analyzing libjvm.so
abidiff libjvm.so libjvm.so is taking forever in the master branch these days. At some point it was taking ~ 15 minutes and 15GB of RAM on a non-optimized build. Profiling of CPU usage showed that sorting virtual member functions of a class whenever a new virtual member function is added was the hot spot. This patch now sorts virtual member functions once right after the type was canonicalized. The patch adds a virtual function type_base::on_canonical_type_set() that is invoked right after the canonical type is set for a given type. class_decl gets its own version of that virtual function: class_decl::on_canonical_type_set. In that function, the patch does sort the virtual member functions of the current class_decl. Now with this patch, abidiff is still taking around 15 minutes but it consumes less than 12GB of ram. This means the memory consumption was reduced by 20%. abipkgdiff performs on 16:30 minutes and in less than 12GB of RAM as well. All these times are measured on a non-optimized build. * include/abg-ir.h ({type_base, class_decl}::on_canonical_type_set): Declare new virtual member function. * src/abg-ir.cc (type_base::on_canonical_type_set): Define new virtual member function that does nothing. (class_decl::on_canonical_type_set): Define new virtual member function that sorts the virtual member functions of class_decl. (canonicalize): Invoke type_base::on_canonical_type_set when the canonical type is set. (fixup_virtual_member_function): Don't sort virtual member functions here. * src/abg-dwarf-reader.cc (finish_member_function_reading): Do not sort virtual member functions here. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Adjust. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9dc07f5534 |
Update copyright notice for abg-fwd.h, abg-ir.h and test-abidiff.cc
* include/abg-fwd.h: Adjust copyright. * include/abg-ir.h: Likewise. * tests/test-abidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
08e760221b |
Support Linux Kernel ABI whitelist files
Enterprise Linux (at least) kernels come with ABI whitelist files that list the names of the set of functions to be considered when looking at the ABI exposed by the kernel to its modules. This patch adds a new --linux-kernel-abi-whitelist option to abidiff so that it drops changes that relate to functions that are *NOT* defined in the whitelist. The patch reads the whitelist file and generates one or several instances of function_suppression that are applied when the two binaries are loaded. * include/abg-suppression.h (function_suppression::function_suppression): Make the declaration of the default constructor public. * src/abg-suppression-priv.h (function_suppression::priv::priv): Declare a default constructor. * src/abg-suppression.cc (function_suppression::function_suppression): Define default constructor. * include/abg-tools-utils.h (gen_suppr_spec_from_kernel_abi_whitelist): Declare new function. * src/abg-tools-utils.cc (gen_suppr_spec_from_kernel_abi_whitelist): Define new function. * tools/abidiff.cc (options::kernel_abi_whitelist_paths): (display_usage): Display a help string for the new --linux-kernel-abi-whitelist option. (parse_command_line): Parse the --linux-kernel-abi-whitelist from the command line. (maybe_check_suppression_files): Check the presence of the kernel abi whitelist files. (set_suppressions): Generate suppression specifications from the whitelist files. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fadfa1a6f6 |
Support Linux Kernel binaries
This patch teaches the ELF/DWARF reader of libabigail to load special ELF sections that are specific to Linux Kernel binaries (either vmlinux or linux kernel modules). The patch creates a new flag that tells the ELF reader that it needs to consider the input binary as a Linux Kernel binary. This is the new 'Linux Kernel mode'. In this linux kernel mode, the reader expects sections that are named __ksymtab and/or __ksymtab_gpl sections. Those sections contain indexes (of ELF symbols described in the normal ELF symbol table) of exported ELF symbols that are specifically marked by developers using EXPORT_SYMBOL or EXPORT_SYMBOL_GPL macros. These are symbols of global variables and functions defined and meant to be used by kernel modules. They constitute the interface exported by the Linux Kernel to its modules. So the patch only exports the publicly defined and exported ELF symbols that are also listed in __ksymtab and __ksymtab_gpl sections. The patch also fixes and re-organizes things left and right so that this new mode works in a well integrated manner with the other parts of the reader: - The load address of the binary is no more assumed to be the load address specified by the program header that is at offset zero. This is usually the case for user-space programs. To handle Linux Kernel binaries, the load address is now the one specified by the program header that is at the smallest offset. - The patch now tries to populate the various symbol maps only when necessary. That way, the new symbol maps defined for the ksymtab and ksymtab_gpl section are also loaded only when necessary; that is, when in Linux Kernel mode. - The patch (more) agressively suppresses non-member functions or variables that are not declarations and that have no associated ELF symbol. The patch knows how to recognize and read relevant ELF symbol information from __ksymtab and __ksymtab_gpl sections. The patch makes abidiff and abidw detect that a binary is a Linux Kernel binary (either a vmlinux or a module). It does this by detecting the presence of the speciall __ksymtab_strings section. If it detects that a binary is a Linux Kernel binary then it only considers functions and variables which are defined and exported in the sense of ELF *AND* which ELF symbols are listed in the __ksymtab and __ksymtab_gpl sections. If users want abidiff and abidw to consider their input binaries as normal ELF binaries then they can use the option --no-linux-kernel-mode. * include/abg-dwarf-reader.h (create_read_context): Take a new flag to say if the context is to read an ELF binary in linux kernel mode. * src/abg-dwarf-reader.cc (typedef address_set_type) (address_set_sptr): New typedefs. (get_binary_load_address): The load address of the binary is the load address specified by the program header that is at the smallest offset; not by the program header that is at offset zero. (read_context::{ksymtab_section_, ksymtab_gpl_section_, linux_exported_fn_syms_, linux_exported_var_syms_, linux_exported_gpl_fn_syms_, linux_exported_gpl_var_syms_, load_in_linux_kernel_mode_}): New data members. (read_context::read_context): Initialize ksymtab_section_, ksymtab_gpl_section_ and load_in_linux_kernel_mode_. (read_context::{find_symbol_table_section, find_opd_section, lookup_elf_fn_symbol_from_address, lookup_elf_var_symbol_from_address, get_function_address, get_variable_address}): Make these const. (read_context::{find_ksymtab_section, find_ksymtab_gpl_section, lookup_elf_symbol_from_address, function_symbol_is_exported, variable_symbol_is_exported, linux_exported_fn_syms, create_or_get_linux_exported_fn_syms, linux_exported_var_syms, create_or_get_linux_exported_var_syms, linux_exported_gpl_fn_syms, linux_exported_gpl_var_syms, create_or_get_linux_exported_gpl_fn_syms, linux_exported_gpl_var_syms, create_or_get_linux_exported_gpl_var_syms, architecture_word_size, load_kernel_symbol_table, load_ksymtab_symbols, load_ksymtab_gpl_symbols, load_linux_specific_exported_symbol_maps, load_in_linux_kernel_mode}): New member functions. (read_context::read_int_from_array_of_bytes): Factorize this new member function out of ... (read_context::{lookup_ppc64_elf_fn_entry_point_address}): ... this. Make this function const too. (read_context::read_uint64_from_array_of_bytes): New function. Uses read_int_from_array_of_bytes above. (read_context::{fun_entry_addr_sym_map_sptr}): Try to load symbol maps only when it's necessary. (read_context::elf_architecture_is_big_endian): Fix logic. (read_context::{var_addr_sym_map}): Express the const variant in terms of the non-const one. In the non-const one, load the map only when necessary. (read_context::load_symbol_maps_from_symtab_section): Renamed load_symbol_maps into this. (read_context::is_linux_kernel_binary): Define new member function. (read_context::{function, variable}_symbol_is_exported): If we are not prevented from considering loading in linux kernel mode, then just looking at a linux kernel binary makes us consider the special kernel sections. (read_debug_info_into_corpus): Likewise. (build_ir_node_from_die): Take a new flag that says if the ir node is a declaration required by another concrete IR node. (enum read_context::kernel_symbol_table_kind): New enum. (read_context::load_symbol_maps): Support loading linux kernel specific sections too. (build_var_decl): Use the new read_context::variable_symbol_is_exported. (function_is_suppressed): Suppress non-member functions or variables that are not declarations and that have no symbol. (variable_is_suppressed, build_var_decl_if_not_suppressed): Take a new flag that says if the variable is a declaration required by a concrete variable. If non member variable that is a declaration is not the specification of another concrete variable, then it's suppressed. (add_fn_symbols_to_map, add_var_symbols_to_map): New function definitions. (read_debug_info_into_corpus): If we are reading linux kernel or linux kernel modules, only set explicitely exported symbols (in the linux kernel binary sense) as exported function or variable symbols. (create_read_context): Take a new flag to say if the context is to read an ELF binary in linux kernel mode. * tools/abidiff.cc (options::options): Initialize options::linux_kernel_mode to true. (display_usage): Display usage of the --no-linux-kernel-mode option. (parse_command_line): Parse the --no-linux-kernel-mode option. * tools/abidw.cc (options::options): Initialize options::linux_kernel_mode to true. (display_usage): Display usage of --no-linux-kernel-mode option. (parse_command_line): Parse the --no-linux-kernel-mode option. * doc/manuals/abidiff.rst: Document the new --no-linux-kernel-mode options. * doc/manuals/abidw.rst: Likewise. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: 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: Likewise. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d198b27b64 |
Update copyright year on a bunch of files
* include/abg-corpus.h: Update copyright year to 2017. * src/abg-dwarf-reader.cc: Likewise. * src/abg-ir.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-writer.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidw.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
4063dfe487 |
Misc style fixes
* include/abg-corpus.h: Remove corpus_sptr typedef. It's in abg-fwd.h now. * src/abg-ir.cc: Remove some unnecessary vertical space. * src/abg-reader.cc (build_function_decl): Cleanup some asserts. * src/abg-writer.cc (write_function_type): Each the inspection of the type id from within the debugger. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
c495a5c5f0 |
Handle per translation unit and per corpus types maps
Today, whenever a type is added to its scope, a map that associates the qualified type name to the type is updated. There is only one such map in a given ABI corpus. So whenever a type is looked up from its name, it's that per-corpus type map that is used. This setup makes libabigail type lookup be tailored only for binaries that respect the One Definition Rule of C++[1] (aka ODR) which basically says that there should be only one type of a given name in an ABI corpus. It turns out that many binaries, especically C binaries, don't respect the ODR. So a type "struct foo" can be defined in a file a.c and another *different* type "struct foo" can also be defined in b.c. What a useful and safe feature! Not. For those binaries, just having one type map doesn't work. We need to have one type map per translation unit, and one map per-corpus map. This is the strategy implemented by this patch. With this patch, whenever a type is added to its scope, a per translation unit type map is updated. The per corpus map is updated as well. If there are more than one type of a given name, the entry in the per corpus type map for that type is left empty. Type lookup now potentially becomes a two phases lookup. Whenever a type is looked up from its name, the per corpus type map is looked at first. If the type is not in that per corpus type map, then the per translation unit type maps are lookup up, in sequence. The patch thus re-visits the type maps updating and lookup routines to adapt them to the new scheme. The patch also updates the clients of the type map updating and lookup code. Note that this patch is part of a series of patches which aims to move libabigails away from its ODR-centric organization to make it work well also on binary where the ODR is not relevant. As such, the patch doesn't assure that "make check" passes. To have "make check" pass, you need to have all the patches of the series applied. [1]: https://en.wikipedia.org/wiki/One_Definition_Rule * include/abg-fwd.h (lookup_type_in_corpus): Remove. This is to be replaced by the new lookup_type below. (lookup_{basic, class, union, enum, typedef, qualified, pointer, reference, array, function, class_or_typedef, class_typedef_or_enum}_type): (lookup_class_type_through_scopes, lookup_type) (lookup_type_through_scopes, lookup_or_synthesize_fn_type) * src/abg-ir-priv.h (struct translation_unit::priv): Move this private type here, from abg-ir.h. (synthesize_type_from_translation_unit): Declare new functions. * include/abg-ir.h (class type_maps): Define new type. (translation_unit::get_function_types): Remove. (translation_unit::get_types): Now return a type_maps. (translation_unit::get_live_fn_types): Declare new type. (class decl_base): Make canonicalize be a friend of this class. * src/abg-ir.cc (struct translation_unit::priv): Move this to abg-ir-priv.h (struct type_maps::priv): Define new type. (type_maps::{basic, class, union, enum, typedef, qualified, pointer, reference, array, function}_types): Define new accessors. (translation_unit::bind_function_type_life_time): Adjust. (translation_unit::get_function_types): Remove accessor. (translation_unit::get_types, get_live_fn_types): Define new accessors. (lookup_type_in_translation_unit) (lookup_class_type_in_translation_unit) (lookup_function_type_in_translation_unit) (synthesize_type_from_translation_unit) (synthesize_function_type_from_translation_unit) (lookup_class_type_in_translation_unit) Remove function definitions. (lookup_type_in_map): Define function template. (lookup_{basic, class, union, typedef, class_or_typedef, class_typedef_or_enum, qualified, pointer, reference, array, function}_type): Define functions. (lookup_function_type, lookup_type_through_scopes) (lookup_class_type_through_scopes) (lookup_basic_type_through_translation_units) (lookup_union_type_through_translation_units) (lookup_enum_type_through_translation_units) (lookup_class_type_through_translation_units) (lookup_typedef_type_through_translation_units) (lookup_qualified_type_through_translation_units) (lookup_pointer_type_through_translation_units) (lookup_reference_type_through_translation_units) (lookup_array_type_through_translation_units) (lookup_function_type_through_translation_units) (lookup_type_through_translation_units) (lookup_or_synthesize_fn_type, lookup_type): Likewise. (maybe_update_types_lookup_map) (maybe_update_types_lookup_map<class_decl>) (maybe_update_types_lookup_map<function_type>): Define function template, specilizations and functions. (synthesize_type_from_translation_unit) (synthesize_function_type_from_translation_unit): Define functions. * include/abg-corpus.h (corpus::get_types): Declare new accessor. * src/abg-corpus.cc (corpus::priv::get_types): Define new accessor. (corpus::get_types): Likewise. (lookup_type_in_corpus, lookup_class_type_in_corpus) (lookup_type_in_corpus, lookup_function_type_in_corpus) (maybe_update_types_lookup_map) (maybe_update_types_lookup_map<class_decl>) (maybe_update_types_lookup_map<function_type>): Remove. (lookup_{basic, class, union, enum, typedef, qualified, pointer, reference, array, function, class_or_typedef, class_typedef_or_enum}_type): Likewise. * src/abg-corpus-priv.h (corpus::priv::{basic, class, union, typedef, qualified, pointer, reference, array, function}_types): Remove these data members. (corpus::priv::get_scopes): Remove member function. (corpus::priv::get_{basic, class, union, enum, typedef, qualified, pointer, reference, array, function}_types): Remove member function declarations. (corpus::priv::types_): New data member. (corpus::priv::get_types): Declare new member function. (lookup_{basic, class, enum, typedef, class_or_typedef, qualified, pointer, reference, array, function}_type): Declare new functions. * src/abg-dwarf-reader.cc (read_context::resolve_declaration_only_classes) (build_translation_unit_and_add_to_ir): Adjust use of lookup_class_type. * src/abg-reader.cc (read_context::type_is_from_translation_unit): Adjust to the use of lookup_function_type_in_translation_unit that got renamed into lookup_function_type. * src/abg-writer.cc (type_ptr_cmp::operator()): New operator implementation. (read_context::sort_type): Add new overloads. (write_translation_unit): Adjust to get the function types from the new translation_unit::get_live_fn_types and sort them. * tools/abicompat.cc (perform_compat_check_in_weak_mode): Adjust to use the new lookup_or_synthesize_fn_type, in lieu of lookup_function_type_in_corpus. Adjust to use lookup_type in lieu of lookup_type_in_corpus. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
bca3f9d163 |
Make abg-fwd.h use *_sptr typedefs
Until now, the abg-fwd.h where the necessary forward generic declarations where put didn't contain the convenience typedefs of the form foo_sptr that designate a shared pointer to type foo. This patch moves these convenience typedefs as well as the missing forward declarations from abg-ir.h to abg-fwd.h. The patch also adjusts the function declarations in abg-fwd.h to make them use these convenience typedefs. * include/abg-ir.h: Move convience typedef declarations and some necessary forward declarations to ... * include/abg-fwd.h: ... here. (is_enum_type, is_var_decl): Take a pointer to type_or_decl_base. (lookup_type_in_scope): Return a type_base_sptr. (lookup_type_through_scopes): Introduce this to later replace the overload of lookup_type_in_translation_unit that takes a list of strings. (lookup_type_in_scope): Return a type_base_sptr, not a decl_base_sptr. * src/abg-ir.cc (lookup_type_in_scope, lookup_node_in_scope) (lookup_var_decl_in_scope): Adjust. (is_enum_type, is_var_decl): Take a pointer to type_or_decl_base. (lookup_node_in_scope): Return a type_or_decl_base_sptr. (lookup_type_in_scope): Return a type_base_sptr. (lookup_node_in_translation_unit): Return a type_or_decl_base_sptr. (lookup_type_through_scopes): Replace lookup_type_in_translation_unit. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5ed0e40bfd |
Bug 20887 - Show relative change of offsets
Until now, an offset change is reported by showing the old and new offsets of the data member that changed. This patch adds the string "(by +N bits)" with 'N' being the number of bits by which the offset of the data member was increased, or "(by -N bits) if the offset of the data member was decreased of N bits. The patch also emits a string that says "size hasn't changed" if the size of the structure did not change. This can be disabled by a new --no-show-relative-offset-changes option. * doc/manuals/abidiff.rst: Document the new --no-show-relative-offset-changes. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-comparison.h (diff_context::show_relative_offset_changes): New accessors. * include/abg-ir.h ({set,get}_data_member_offset): Return uint64_t instead of the less portable size_t. * src/abg-comparison.cc (diff_context::priv::show_relative_offset_changes_): New data member. (dif_context::show_relative_offset_changes): Define accessor. (maybe_show_relative_offset_change): Define new function. (represent): In the overload for var_diff, call the new maybe_show_relative_offset_change. (report_size_and_alignment_changes): If the size of the type didn't change then say it now. * src/abg-ir.cc (set_data_member_offset, get_data_member_offset): Take or return a uint64_t instead of a size_t. * tools/abidiff.cc (options::show_relative_offset_changes): New data member. (options::options): Initialize it. (display_usage): Display help string for the new --no-show-relative-offset-changes. (parse_command_line): Parse the new --no-show-relative-offset-changes options. (set_diff_context_from_opts): Set the "show-relative-offset-changes" flag according to the new option.n * tools/abipkgdiff.cc (options::show_relative_offset_changes): New data member. (options::options): Initialize it. (display_usage): Add help string for the new --no-show-relative-offset-changes option. (set_diff_context_from_opts): Set the "show-relative-offset-changes" flag according to the new option. (parse_command_line): Parse the new command line option. * tests/data/test-diff-dwarf/test40-report-0.txt: Add new reference output. * tests/data/test-diff-dwarf/test40-v0.c: Source code of the first test binary. * tests/data/test-diff-dwarf/test40-v1.c: Source code of the second test binay. * tests/data/test-diff-dwarf/libtest40-v0.so: New first test binary. * tests/data/test-diff-dwarf/libtest40-v1.so: New second test binary. * tests/test-diff-dwarf.cc (in_out_spec): Add the new test binaries above to the set of binaries that are compared. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/data/test-abicompat/test7-fn-changed-report-0.txt: Adjust. * tests/data/test-abidiff/test-PR18791-report0.txt: Likewise. * tests/data/test-abidiff/test-enum0-report.txt: Likewise. * tests/data/test-abidiff/test-enum1-report.txt: Likewise. * tests/data/test-abidiff/test-struct1-report.txt: Likewise. * tests/data/test-diff-dwarf/test0-report.txt: Likewise. * tests/data/test-diff-dwarf/test1-report.txt: Likewise. * tests/data/test-diff-dwarf/test10-report.txt: Likewise. * tests/data/test-diff-dwarf/test11-report.txt: Likewise. * tests/data/test-diff-dwarf/test13-report.txt: Likewise. * tests/data/test-diff-dwarf/test15-enum-report.txt: Likewise. * tests/data/test-diff-dwarf/test27-local-base-diff-report.txt: Likewise. * tests/data/test-diff-dwarf/test32-fnptr-changes-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test33-fnref-changes-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test38-union-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test4-report.txt: Likewise. * tests/data/test-diff-dwarf/test5-report.txt: Likewise. * tests/data/test-diff-dwarf/test6-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/test1-report.txt: Likewise. * tests/data/test-diff-filter/test13-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/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.t: Likewise.xt * 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. * tests/data/test-diff-filter/test29-finer-redundancy-marking-report-0.txt: Likewise. * tests/data/test-diff-filter/test3-report.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: Likewise. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-7.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/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/test23-alias-filter-report-0.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-2.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test30-report-0.txt: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
72f50a16ce |
Very light speed improvements
When comparing of two kernel trees showed that for huge changesets involving highly recursive types, leaf functions used by the categorization code dominate the performance profile. This patch introduces some changes that help gain around 30 seconds (out of 14 minutes) on a non-optimized build, when comparing 4.7 nd 4.8 fedora kernels (between fedora 24 and 26). * include/abg-comp-filter.h (has_harmless_name_change): Pass smart pointers by reference. * src/abg-comp-filter.cc (access_changed) (function_name_changed_but_not_symbol) (non_static_data_member_type_size_changed) (static_data_member_type_size_changed, is_compatible_change) (decl_name_changed, has_harmless_name_change): Pass smart pointers by reference. * include/abg-ir.h (decl_base::set_context_rel): Take a bare pointer, not a smart pointer. * src/abg-ir.cc (decl_base::priv::context_): Make this data member be a naked pointer, not a smart pointer. (decl_base::priv::priv): Initialize it. (decl_base::priv::~priv): New constructor. (decl_base::{get_context_rel, set_scope}): Adjust. (class_decl::method_decl::{method_decl, set_scope}): Likewise. (equals): In the overload for var_decl, compare the type of the var first as that might be faster (to detect var_decls with different types) in the general case where types are canonicalized. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e861bd3368 |
Introduce on-the-fly type canonicalization
During canonicalization of a type T, when T is structurally compared to an already canonicalized type C, it can happen that non-canonicalized sub-types of T are structurally compared again and again to canonicalized sub-types of C. This patch introduces a new optimization or those cases: on-the-fly type canonicalized. That means, if a not-yet-canonicalized sub-type S of the type T being canonicalized structurally compares equal to a canonicalized sub-type, then the canonical type of S is said to be the canonical type of the canonicalized sub-type. So sub-type S is canonicalized, on-the-fly, during canonicalization of type T. This considerably speeds up the canonicalization process while doing "abidiff vmlinux vmlinux". It goes from taking forever to taking 45 seconds on a non-optimized build. * include/abg-ir.h (environment::do_on_the_fly_canonicalization): Declare new member functions. ({type_base, function_type}::priv_): Make this public so that static non-member functions defined in abg-ir.cc can access it. * src/abg-ir.cc (environment::priv::do_on_the_fly_canonicalization_): New data member. (environment::priv::priv): Initialize it. (environment::do_on_the_fly_canonicalization): Define new member functions. (type_base::get_canonical_type_for): Trigger on-the-fly canonicalization during comparison of the type being canonicalized and an already canonicalized type. (types_are_being_compared, maybe_propagate_canonical_type): Define new static functions. (equals): In overloads for class_decl and function_type, call maybe_propagate_canonical_type when the two types compare equal. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
bd3fe4c748 |
Fix pretty representation of array types
It turned out we were wrongly emitting the pretty representation of array types in two cases: 1/ in case of qualified array types: a const array of string type was being pretty-represented as: "const string[]" instead of "string[] const". 2/ in case of array with an empty sub-range DIE; that is a sub-range DIE with no attribute at all. For instance an array of char with an empty sub-range DIE was being represented as: "char", instead of "char[]". This patch fixes 1 and 2. It also updates numerous test reference output files. * include/abg-ir.h (array_type_def::is_infinite): Fix indentation. * src/abg-ir.cc (qualified_type_def::build_name): An empty set of sub-ranges for a vector is represented by "[]". (array_type_def::is_infinite): If a vector has no sub-range, that means it has an infinite size. Adjust comment. * tests/data/test-diff-filter/test33-report-0.txt: Adjust. * tests/data/test-read-dwarf/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: 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/test14-pr18893.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3981244c9d |
Support naming typedef and use them to speed up type canonicalization
There is a common C idiom in which an anonymous struct is named using a typedef: typedef struct {int member;} anonymous_struct_type; The typedef name "anonymous_struct_type" becomes the name of the otherwise anonymous struct. That is what a naming typedef is. So, the nice thing about naming typedefs is that an anonymous class type suddenly becomes non anymous. So that type becomes eligible to the ODR-based optimization during type canonicalization. That speeds up type canonicalization, at least for 'abidw'. This patch represents naming typedefs for class_decl types in the internal representation. The patch also changes the meaning of an anonymous class. Whenever such a class becomes named by a typedef, the class is not considered anonymous anymore, at least for the purpose of type canonicalization. * include/abg-ir.h (typedef_decl_wptr): New typedef. (class_decl::{g,s}et_naming_typedef): Declare new member functions. * src/abg-dwarf-reader.cc (build_typedef_type): When the underlying type of a typedef is an anonymous class, the class type is said to have a naming typedef. * src/abg-ir.cc (is_anonymous_type): An anonymous class that has a naming typedef is said to not be anonymous anymore. (class_decl::priv::naming_typedef): New data member. (class_decl::{g,s}et_naming_typedef): Define new member functions. (class_decl::get_pretty_representation): When called for internal purposes (e.g, for type canonicalization) compute the pretty representation of the class by using its typedef name, when class is anonymous and has a naming typedef. * src/abg-reader.cc (build_class_decl): Read the new "naming-typedef-id" attribute. * src/abg-writer.cc (write_naming_typedef): New function. (write_class_decl_opening_tag): Use the new write_naming_typedef function. * tests/data/test-read-dwarf/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
cfaa7d42b6 |
Implement de-duplication for types and decls at DWARF loading time
Many types and decls are redefined in every translation unit that make up an ELF binary. This patch detects that a DIE represents a type or decl that has already been defined in the current corpus and so will not create a new internal representation for it. The patch defines facilities to build the pretty representation of a type or decl. It's by looking at the pretty representation of a DIE that the patch detects that a different DIE has already defined the same type or decl. The patch also fixes detection of the const-ness of member functions as there were many cases where const member functions were not recognized as const. This fix makes it so that the pretty representation of the DIE of said member functions match the pretty representation of their internal representation, as far as the const-ness is concerned. One bit of infrastructure change that is used by the const-ness fix is that method_type now carries const-ness. So a method_decl that has a const method_type is going to be const itself. * include/abg-ir.h (method_type::priv_): Introduce new pimpl pointer here. (method_type::class_type_): Move this into the pimpl idiom. (method_type::method_type): Take a new is_const flag. (method_type::get_class_type): Make this method out-of-line. (method_type::{s,g}et_is_const): Declare new member functions. (get_method_type_name): Declare this function as a friend of the method_type type. * src/abg-dwarf-reader.cc: Include the new abg-ir-priv.h and abg-corpus-priv.h. (typedef die_tu_map_type): Fix comment. (typedef die_istring_map_type): New typedef. (class read_context::die_source_dependant_container_set): New class template. (read_context::{die_qualified_name_maps_, die_pretty_repr_maps_, die_pretty_type_repr_maps_}): Define new data members. (read_context::{get_die_qualified_name, get_die_qualified_name, get_die_qualified_type_name, get_die_pretty_type_representation, get_die_pretty_representation, lookup_type_artifact_from_die, lookup_artifact_from_die, lookup_artifact_from_die_representation, associate_die_to_artifact_by_repr, associate_die_to_artifact_by_repr_internal, lookup_type_from_die}): Define new member functions. (read_context::lookup_type_from_die_offset): Fix comment. (get_parent_die, get_scope_die, die_is_decl) (die_is_namespace, die_is_unspecified, die_is_void_type) (die_is_pointer_type, die_is_reference_type) (die_is_pointer_or_reference_type, die_is_class_type) (die_has_object_pointer, die_this_pointer_from_object_pointer) (die_this_pointer_is_const, is_decl_tag) (die_object_pointer_is_for_const_method, die_is_at_class_scope) (die_name, die_qualified_type_name, die_qualified_decl_name) (die_qualified_name, die_qualified_type_name_empty) (die_return_and_parm_names_from_fn_type_die) (die_function_signature, die_peel_qual_ptr) (die_function_type_is_method_type, die_pretty_print_type) (die_pretty_print_decl, die_pretty_print) (build_subranges_from_array_type_die) (build_or_get_fn_decl_if_not_suppressed) (lookup_class_or_typedef_type) (lookup_class_typedef_or_enum_type_from_corpus) (is_function_for_die_a_member_of_class) (add_or_update_member_function): Define new static functions. (read_context::associate_die_to_decl): Call associate_die_to_artifact_by_repr. (read_context::{associate_die_to_type, schedule_type_for_late_canonicalization}): Take just one "die" parameter rather than taking a die offset and a die source; adjust accordingly. (maybe_canonicalize_type): Likewise. (finish_member_function_reading): Take a const reference to function_decl_sptr. (die_loc_and_name): Use the new die_name function. (die_is_type): Rename is_type_die into this. (build_type_decl): Take a new "where_offset" parameter. Adjust. If a type of the same name as the one for the current DIE is is already present, do not create a new type; just return the already-existing one. (build_enum_type): Take a new "where_offset" parameter. Adjust. (finish_member_function_reading): Pass two smart pointers by const reference. Assert that the type of the member function is a method_type. Some light cleanups. (add_or_update_class_type): Rename build_class_type_and_add_to_ir. If a DIE defining the same class has already been seen, then return that class; don't construct any other internal representation for the same class. Better handle the updating of member data and functions. Do not duplicate member types. (build_qualified_type, build_pointer_type_def) (build_reference_type): Support de-duplication here. (build_function_type): Likewise. Support detection and building of method type. This also supports *const* method type building. (build_array_type): Use the new build_subranges_from_array_type_die. (build_type_decl): Cleanup logic. (build_or_get_var_decl_if_not_suppressed): Renamed build_var_decl_if_not_suppressed into this. Perform de-duplication for data members. (build_function_decl): Don't set an empty source location. If the function type cannot be constructed, do not construct the function decl either. Adjust. (build_ir_node_from_die): Adjust. When building a function for a DW_TAG_subroutine_type DIE, use the new build_or_get_fn_decl_if_not_suppressed. * src/abg-ir.cc (translation_unit::bind_function_type_life_time): Fix comment. (strip_typedef): Adjust. (qualified_type_def::build_name): Set the prefix name of a the name of a noop qualifier to "noop-qual", just like what is done in the new die_qualified_name function. (struct method_type::priv): New priv type for the method_type class. (method_type::method_type): Take a new 'is_const' parameter. Adjust as the method_type is now pimpl'ed. (method_type::{get_class_type, set_is_const, get_is_const}): Define new member functions. (function_decl::get_pretty_representation_of_declarator): Better detecter of const-ness. (class_decl::insert_member_decl): Better setting of the const-ness. (class_decl::method_decl::method_decl): Adjust. Deduce the const-ness of the method_decl from the const-ness of its method_type. (copy_member_function): Adjust. (set_member_is_static): Do not assume a non-nil scope anymore because member_decl can now be scope-less, at least for a little while. * src/abg-reader.cc (push_decl_to_current_scope): Adjust. (build_function_decl): Style adjustment. Adjust for method_type const-ness changes. (build_function_type): Likewise. Also, support the new "method-class-id" property that flags a function type as being a method type. * src/abg-writer.cc (write_function_decl): Style fixes. (write_function_type): Likewise. Emit a new "method-class-id" property for function type that is actually a method type. That property's value is the id of the class of the method type. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Adjust. * tests/data/test-diff-dwarf/test0-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/test30-pr18904-rvalueref-report0.txt: Adjust. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Adjust. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Adjust. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Adjust. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: Adjust. * 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: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Adjust. * tests/data/test-read-dwarf/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: 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/test13-pr18894.so.abi: Adjust. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ccdc44b3eb |
Setup per-corpus type maps indexed by type names
This patch creates per-corpus maps that associate, for a certain kind of type, the fully qualified name of the type to the type. So there is a map for class_decl, one for enum_type_decl, one for type_decl, etc. These maps are populated when a new type is added to its scope. The patch defines overloads of the function maybe_update_types_lookup_map() that update the right map, depending on the kind of type we are looking at. Note that there also is a map in each class that associates a signature string to a member functions. This is so that member functions of a given class can be looked up by signature. This is so that looking up a type becomes now much faster than having to walk all the translation units of a corpus to find one. Note that this patch is specifically part of the series of patches that implements types and declarations de-duplication while reading DWARF information. The patch might slightly change the output of abi serialization or comparison so it needs some adjustments of some test reference files. That adjustment is not done here. Rather, it's done at once in another patch of the set. * include/abg-corpus.h (corpus::priv_): Make this public so that functions from outside of the class can access it. These functions are meant to be used only by code that is *inside* libabigail.so, though. * src/abg-corpus-priv.h: New file. * src/abg-corpus.cc: Include the new abg-corpus-priv.h file. (struct regex_t_deleter): Move this to abg-sptr-utils.h. (build_sptr<regex_t>): Move the declaration of this function template specialization to abg-sptr-utils.h and its definition to abg-sptr-utils.cc. (typedef regex_t_sptrs_type, typedef str_var_ptr_map_type) (struct corpus::exported_decls_builder::priv, struct corpus::priv): Move these declarations to the new abg-corpus-priv.h. (maybe_update_types_lookup_map): Define overloads of this (one per kind of type). (lookup_{basic, class, enum, typedef, class_or_typedef, class_typedef_or_enum, qualified, pointer, reference, array, function}_type): Define new functions. * include/abg-ir.h (typedef istring_type_base_wptr_map_type) (typedef istring_type_or_decl_base_sptr_map_type): Declare new typedefs. (class_decl::find_member_function_from_signature): Declare new member function. * src/abg-ir.cc: Include the new abg-corpus-priv.h file. (maybe_update_types_lookup_map): Remove this initial function. There are now new overloads in abg-corpus.cc for it. (scope_decl::{add_member_decl, insert_member_decl}): Adjust. (class_decl::{set_is_declaration_only, find_member_function, add_member_function}): Adjust. (class_decl::find_member_function_from_signature): Define new member function. * include/abg-sptr-utils.h (struct regex_t_deleter): Declare new type. (build_sptr<regex_t>): New build function template specializations. * src/abg-sptr-utils.cc: New file. * src/Makefile.am: Add src/abg-sptr-utils.cc and src/abg-corpus-priv.h to the build system. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1b94d60780 |
Allow pretty printing function decls for internal purposes
It appears that function_decl::get_pretty_representation doesn't make the difference between internal and non-internal purposes. This patch fixes that by making the helper get_pretty_representation_of_declarator() take an "internal" flag and calls that. * include/abg-ir.h (function_decl::get_pretty_representation_of_declarator): Take an "internal" flag. * src/abg-ir.cc (function_decl::get_pretty_representation_of_declarator): Take an "internal" flag. (function_decl::get_pretty_representation): Pass the "internal" flag to the function function_decl::get_pretty_representation_of_declarator. (function_decl::parameter::get_type_name): Better handle variadic parameter type. (function_decl::parameter::get_type_pretty_representation): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e7c920edbc |
Support union types
This patch makes Libabigail understand C and C++ union types. It defines a new class abigail::ir::union_decl to represent the declaration of a union type. It also defines a new type abigail::comparison::union_diff to represent the changes between two union types. The patch then adds facilities to read union types from DWARF and abixml and also to write union types into the abixml format. As union types and class types have a lot in common, the patch tries very hard to share code between the abigail::ir::class_decl and abigail::ir::union_decl. To do so, a new class abigail::ir::class_or_union is created. It's the base class for both abigai::ir::class_decl and abigail::ir::union_decl. Its data members and methods represent the set of data and behaviour that are common to classes and unions. A lot of code and data that were initially in abigail::ir::class_decl got moved into the new abigail::ir::class_or_union class. Similary, the patch creates a new class abigail::comparison::class_or_union_diff that is a base class for both the existing class abigail::comparison::class_diff and the newly created class abigail::comparison::union_diff. The new class abigail::comparison::class_or_union_diff contains data and behaviour that are common to both union_diff and class_diff and that were previously in class_diff. The rest of the patch is mostly adjustment so that code that was supposed to work with class class_decl only can now work with class class_or_union when it makes sense. Similarly for class_diff and class_or_union_diff. The patch adds regression tests into the test suite and adjust many existing tests involving binaries that contain union types; the reference output of those tests now take union types into account. * include/abg-fwd.h (class_or_union, union_decl): Forward-declare new types. (is_class_or_union_type, is_union_type): Declare new functions. * include/abg-ir.h (method_type::class_type_): Make this be of class_or_union_wptr type. (method_type::method_type): Make the class_type parameter be of class_or_union_wptr type. (method_type::{g,s}et_class_type): Take or return a class_or_union_sptr. (member_base, method_decl, member_function_template) (member_class_template, member_base::hash) (member_function_template::hash, member_class_template::hash): Take these class types out of the class_decl scope. (is_method_decl): Adjust. (operator==, opertor!=): Adjust overloads for member_function_template_sptr and member_class_template_sptr. (class class_or_union): Declare new type. (class class_decl): Make this class inherit class_or_union class. (class_decl::{add_member_decl, insert_member_decl, remove_member_decl, set_size_in_bits, get_size_in_bits, get_alignment_in_bits, set_alignment_in_bits, get_is_declaration_only, set_is_declaration_only, set_definition_of_declaration, get_definition_of_declaration, get_earlier_declaration, set_earlier_declaration, insert_member_type, add_member_type, remove_member_type, get_member_type, find_member_type, add_data_member, get_data_members, find_data_member, get_non_static_data_members, add_member_function, get_member_functions, find_member_function, add_member_function_template, get_member_function_templates, add_member_class_template, get_member_class_templates): Move these to the parent class class_or_union. (copy_member_function, equals): Add overloads for class_or_union. (struct class_or_union::hash): Declare new type. (class union_decl): Declare new type. (equals, copy_member_function): New overloads for class union_decl type. (ir_node_visitor::visit): Add new overloads for union_decl* and class_or_union*. * src/abg-ir.cc (get_member_function_is_ctor) (set_member_function_is_ctor, get_member_function_is_dtor) (set_member_function_is_dtor, get_member_function_is_const) (set_member_function_is_const, get_member_function_vtable_offset) (set_member_function_vtable_offset) (get_member_function_is_virtual, set_member_function_is_virtual) (maybe_update_types_lookup_map, get_location) (get_method_type_name, is_at_global_scope, is_at_class_scope): Adjust. (is_class_or_union_type, is_union_type): Define new functions. (type_base::get_canonical_type_for, maybe_adjust_canonical_type) (method_type::method_type, method_type::set_class_type) (function_decl::get_pretty_representation) (function_decl::get_first_non_implicit_parm) (function_decl::clone): Adjust. (equals): Adjust the overload for function_type. (struct class_or_union::priv): Define new type. (class::priv::{declaration_, definition_of_declaration_, member_types_, data_members_, non_static_data_members_, member_functions_, mem_fns_map_, member_function_templates_, member_class_templates_, is_declaration_only_}): Move these data member into class_or_union::priv. (class_priv::{mark_as_being_compared, unmark_as_being_compared, comparison_started}): Moved these member functions to class_or_union::priv. (class_or_union::{class_or_union, traverse, ~class_or_union, add_member_decl, remove_member_decl, insert_member_type, add_member_type, get_size_in_bits, remove_member_type, get_alignment_in_bits, set_alignment_in_bits, set_size_in_bits, get_is_declaration_only, set_is_declaration_only, set_definition_of_declaration, get_definition_of_declaration, get_earlier_declaration, set_earlier_declaration, get_member_types, find_member_type, add_data_member, get_data_member, find_data_member, add_member_function, get_member_functions, find_member_function, add_member_function_template, get_member_function_templates, add_member_class_template, get_member_class_templates, has_no_member, insert_member_decl, operator==}): Define new member functions. (class_decl::{add_member_decl, remove_member_decl, insert_member_type, add_member_type, get_size_in_bits, remove_member_type, get_alignment_in_bits, set_alignment_in_bits, set_size_in_bits, get_is_declaration_only, set_is_declaration_only, set_definition_of_declaration, get_earlier_declaration, set_earlier_declaration, get_member_types, find_member_type, add_data_member, get_data_member, find_data_member, add_member_function, get_member_functions, find_member_function, add_member_function_template, get_member_function_templates, add_member_class_template, get_member_class_templates): Move these member functions into class_or_union. (class_decl::{class_decl, get_definition_of_declaration, insert_member_decl, add_member_function, has_no_base_nor_member}): Adjust. (equals, copy_member_function): Define new overloads for class_or_union. (equals): Adjust the overload for class_decl. (method_decl::{method_decl, set_linkage_name, ~method_decl, get_type, set_scope}): Remove from the class_decl scope. (member_base::operator==, member_function_template::operator==): Likewise. (member_function_template::traverse) (member_class_template::operator==) (member_class_template::traverse): Likewise. (operator==, operator!=): Adjust the overlod for member_function_template_sptr. (is_method_decl, fixup_virtual_member_function) (set_member_is_static): Adjust. (virtual_member_function_less_than::operator()): Likewise. (union_decl::{union_decl, get_pretty_representation, operator==, traverse}): Define new member functions. (equals, copy_member_function): Define new overloads for union_decl. (hash_type_or_decl): Adjust. (ir_node_visitor::visit_{begin, end}): Adjust. Add new overloads for class_or_union* and union_decl*. * include/abg-comparison.h (changed_member_function_sptr) (string_member_function_sptr_map): Adjust these typedefs. (class class_or_union_diff): Declare new type. (class_diff): Adjust to make this inherit the new class_or_union_diff type. (class_diff::{get_priv, member_types_changes, data_members_changes, inserted_data_members, deleted_data_members, member_fn_tmpls_changes, member_fn_tmpls_changes, member_class_tmpls_changes}): These member functions got moved into -- and shared with -- class_or_union_diff class. (class union_diff): Declare new type. (typedef union_diff_sptr): New typedef. (compute_diff): New overload for union_diff (is_class_diff, is_union_diff): Declare new functions. * src/abg-comparison.cc (is_class_diff, is_union_diff): Define new functions. (compute_diff_for_types): Support union_decl. (represent): Adjust. (represent_data_member): Do not show offset information for data members of unions as all union data members are at offset 0. (struct class_or_union_diff::priv): New type. (class_or_union_diff::priv::{member_type_has_changed, subtype_changed_dm, member_class_tmpl_has_changed, get_deleted_non_static_data_members_number, get_inserted_non_static_data_members_number, count_filtered_subtype_changed_dm, count_filtered_changed_dm, count_filtered_changed_mem_fns, count_filtered_inserted_mem_fns, count_filtered_deleted_mem_fns}): Define new member functions. (class_or_union_diff::{class_or_union_diff, finish_diff_type, lookup_tables_empty, lookup_tables_empty, ensure_lookup_tables_populated, allocate_priv_data, get_priv, ~class_or_union_diff, first_class_or_union, second_class_or_union, member_types_changes, member_types_changes, data_members_changes, inserted_data_members, deleted_data_members, member_fns_changes, changed_member_fns, member_fns_changes, inserted_member_fns, member_fn_tmpls_changes, member_fn_tmpls_changes, member_class_tmpls_changes, member_class_tmpls_changes, has_changes, has_local_changes, report, chain_into_hierarchy}): Define new member functions. (class_diff::priv::{member_types_changes_, data_members_changes, member_fn_tmpls_changes_, member_class_tmpls_changes_, deleted_member_types_, inserted_member_types_, changed_member_types_, sorted_changed_member_types_, deleted_data_members_, deleted_dm_by_offset_, inserted_data_members_, inserted_dm_by_offset_, subtype_changed_dm_, sorted_subtype_changed_dm_, changed_dm_, sorted_changed_dm_, deleted_member_functions_, inserted_member_functions_, changed_member_functions_, sorted_changed_member_functions_, deleted_member_class_tmpls_, inserted_member_class_tmpls_, changed_member_class_tmpls_, sorted_changed_member_class_tmpls_}): Move these data members into class_or_union_diff::priv. (class_diff::{clear_lookup_tables, lookup_tables_empty, ensure_lookup_tables_populate}): Adjust. (class_diff::allocate_priv_data): Define new function. (class_diff::priv::{count_filtered_changed_mem_fns, count_filtered_inserted_mem_fns, count_filtered_deleted_mem_fns, chain_into_hierarchy, class_diff}): Likewise. (class_diff::{member_types_changes, data_members_changes, inserted_data_members, deleted_data_members, member_fn_tmpls_changes, member_fn_tmpls_changes, member_class_tmpls_changes}): These are deleted as they got moved to class_or_union_diff. (class_diff::report): Adjust. (union_diff::{clear_lookup_tables, lookup_tables_empty, ensure_lookup_tables_populated, allocate_priv_data, union_diff, finish_diff_type, first_union_decl, second_union_decl, get_pretty_representation, report}): Define new functions. (compute_diff): Define an overload for union_decl_sptr. (function_decl_diff::report): Adjust. (corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars): Adjust. (corpus_diff::report): Adjust. * src/abg-hash.cc (member_base:#️⃣:operator) (member_function_template:#️⃣:operator) (member_class_template:#️⃣:operator): Move these out of the class_decl scope. (class_or_union:#️⃣:operator): Define new member function. (class_decl:#️⃣:operator): Adjust. (type_base::dynamic_hash::operator): Support hashing of union_decl. Adjust. * src/abg-suppression.cc (type_suppression::suppresses_diff): Adjust. * src/abg-dwarf-reader.cc (typedef die_class_or_union_map_type): Define new typedef. (read_context::{die_wip_classes_map_, alternate_die_wip_classes_map_, type_unit_die_wip_classes_map_): Make these data member have type die_class_or_union_map_type. (read_context::{lookup_type_from_die_offset, die_wip_classes_map, is_wip_class_die_offset, resolve_declaration_only_classes}): Adjust. (finish_member_function_reading, build_class_type_and_add_to_ir) (build_function_type, build_function_decl, build_reference_type) (type_is_suppressed, build_function_decl) (maybe_canonicalize_type, maybe_set_member_type_access_specifier): Adjust. (build_union_type_and_add_to_ir): Define new static function. (build_ir_node_from_die): Support DW_TAG_union_type DIE tag. * src/abg-reader.cc (handle_element_node): Handle union_decl. (build_function_decl, build_function_decl_if_not_suppressed): Adjust. (build_union_decl_if_not_suppressed, build_union_decl) (handle_union_decl): Define new functions. (build_class_decl): Adjust. * src/abg-writer.cc (record_decl_only_type_as_emitted): Adjust. (write_decl): Adjust. Support writting union_decl type. p (write_class_decl_opening_tag, write_class_decl): Adjust. Call the new write_class_or_union_is_declaration_only. (write_union_decl_opening_tag, write_union_decl): Define new static functions. (write_member_tpe): Support writting union decl. * tests/test-diff-dwarf.cc (in_out_specs): Add new tests for this union type support. * tests/data/test-diff-dwarf/libtest37-union-v0.so: New test input. * tests/data/test-diff-dwarf/libtest37-union-v1.so: Likewise. * tests/data/test-diff-dwarf/libtest38-union-v0.so: Likewise. * tests/data/test-diff-dwarf/libtest38-union-v1.so: Likewise. * tests/data/test-diff-dwarf/libtest39-union-v0.so: Likewise. * tests/data/test-diff-dwarf/libtest39-union-v1.so: Likewise. * tests/data/test-diff-dwarf/test37-union-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test38-union-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test39-union-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test37-union-v0.cc: Source code for new test input. * tests/data/test-diff-dwarf/test37-union-v1.cc: Likewise. * tests/data/test-diff-dwarf/test38-union-v0.cc: Likewise. * tests/data/test-diff-dwarf/test38-union-v1.cc: Likewise. * tests/data/test-diff-dwarf/test39-union-v0.cc: Likewise. * tests/data/test-diff-dwarf/test39-union-v1.cc: Likewise. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Update test reference. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f9ed75b8c4 |
Support empty properties in INI files
The ini file parser doesn't support parsing properties with no value. This patch adds that feature, as it turned out to be a pre-requisite for reading Linux Kernel ABI whitelist files. * include/abg-ini.h (simple_property::simple_property): Add a new constructor for empty values. (simple_property::has_empty_value): Declare new member function. * src/abg-ini.cc (simple_property::{simple_property, has_empty_value}): Define new member functions. (read_context::read_property): Support reading a property with no value. (write_property_value, write_property): Support writting a property with empty value. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b96ecbc065 |
Rename config::property_vector into config::properties_type
This renaming makes the code looks more consistent. * include/abg-ini.h (config::properties_type): Rename the typedef config::property_vector into this. (config::section::{section, get_properties, set_properties}): Adjust. * src/abg-ini.cc (config::section::priv::properties_): Adjust the name of its type. (config::section::{section, get_properties, set_properties, find_property}): Adjust. (write_section): Adjust. * src/abg-suppression.cc (read_function_suppression): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9224f40c52 |
Apply harmless and harmful filters in one pass
When comparing linux kernels with lots of changes, walking changes twice just to apply harmless and harmful change filters was dominating the performance profile. This patch performs the harmless and harmful filtering in one pass. This makes the overall comparison go from 15 minutes to 10 minutes when comparing a 4.7 kernel from fedora24 and a 4.8 kernel from fedora26. * include/abg-comp-filter.h (class harmless_harmful_filter): Decalre new class. (typedef harmless_harmful_filter_sptr): Declare new typedef. (class harmless_filter, class harmful_filter): Remove these class declarations. (typedef harmful_filter_sptr, harmless_filter_sptr): Remove these typedefs. * src/abg-comp-filter.cc (categorize_harmless_diff_node) (categorize_harmful_diff_node): Define new static functions. ({harmless, harmful}_filter::{visit, visit_end}): Remove these member functions. (harmless_harmful_filter::{visit, visit_end}): Define new member functions. * src/abg-comparison.cc (diff_context::diff_context): Register the new harmless_harmful_filter, and remove the premier harmless_filter and harmful_filter. Signed-off-by: Dodji Seketeli <dodji@redhat.com> # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch kabidiff-dedup # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: include/abg-comp-filter.h # modified: src/abg-comp-filter.cc # modified: src/abg-comparison.cc # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # diff.txt # prtests/ # tests/data/test-read-dwarf/libtest23.so.abi.conflict Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ff0b07e711 |
Factorize out string representation of array_type_def::subrange_type
As we are going to need to print names of array types from DIEs directly, we'll need to represent names of subranges. This patch factorizes the string representation of the array_type_def::subrange_type type. * src/abg-ir.cc (array_type_def::subrange_type::{as_string, vector_as_string}): Define methods. (array_type_def::get_subrange_representation): Use the new vector_as_string method. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
6c100a88b5 |
Cleanup void and variadic parameter type interfaces
While working on something else, it appeared that renaming abigail::environment::get_void_type_decl() to abigail::environment::get_void_type() and abigail::environment::get_variadic_parameter_type_decl() to abigail::environment::get_variadic_parameter_type() would be an improvement. This patch implements that. * include/abg-ir.h (environment::{get_void_type, get_variadic_parameter_type}): Renamed get_void_type_decl and get_variadic_parameter_type_decl to these. (environment::is_void_type): Remove the overload that takes a bare pointer. (environment::is_variadic_parameter_type): Declare new member function. * src/abg-ir.cc (environment::void_type_): Renamed the data member void_type_decl_ into this. (environment::variadic_marker_type_): Renamed the data member variadic_marker_type_decl_ into this. (environment::{get_void_type, get_variadic_parameter_type}): Renamed get_void_type_decl and get_variadic_parameter_type_decl to these. (environment::is_void_type): Take a smart pointer now. (environment::is_variadic_parameter_type): Define new member function. (synthesize_function_type_from_translation_unit): Adjust. (function_decl::parameter::get_pretty_representation): Likewise. * src/abg-comparison.cc (is_diff_of_variadic_parameter_type): Adjust. * src/abg-dwarf-reader.cc (build_function_type) (build_ir_node_for_void_type): Likewise. * src/abg-reader.cc (build_function_parameter) (build_function_decl, build_function_type): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
c86ffddab7 |
Cleanup some entry points in abg-fwd.h
While looking at something else I came accross some interface cleanup opportunities, as usual. This patch honours some of those opportunities. * include/abg-fwd.h (add_decl_to_scope): Pass the scope smart pointer by reference. (is_member_type): pass the type smart pointer by reference. (is_function_decl, is_pointer_type, is_reference_type) (is_qualified_type, is_function_type, is_method_type) (is_array_type): Take a type_or_decl base pointer, rather than either a decl_base or type_base pointer. * include/abg-ir.h (translation_unit::set_corpus): Take a pointer to non-const corpus. (translation_unit::get_corpus): Add a non-const overload. (type_or_decl_base::get_corpus): Likewise. (type_or_decl_base::set_translation_unit): Take a pointer to non-corpus translation_unit. (type_or_decl_base::get_translation_unit): Add a non-const overload. (scope_decl::{add_member_decl, insert_member_decl}): Pass the member smart pointer by reference. (scope_decl::remove_member_decl): Take a non-const smart pointer. (class_decl::add_member_decl): Pass the decl smart pointer by reference. (is_method_decl): Take pointer or reference to type_or_decl_base rather than function_decl. * src/abg-ir.cc (translation_unit::priv::corpus): Make this a pointer to non-const corpus. (translation_unit::set_corpus): Take a pointer to non-const corpus. (translation_unit::get_corpus): Add a non-const overload. (translation_unit::get_global_scope): Adjust. (translation_unit::bind_function_type_life_time): Adjust. (type_or_decl_base::translation_unit): Make this a pointer to non-const translation_unit. (type_or_decl_base::get_corpus): Likewise. (type_or_decl_base::set_translation_unit): Take a pointer to non-corpus translation_unit. (type_or_decl_base::get_translation_unit): Add a non-const overload. (is_member_type): pass the type smart pointer by reference. (scope_decl::{add_member_decl, insert_member_decl}): Take a reference to the member decl smart pointer. Adjust. (class_decl::add_member_decl): Likewise. (scope_decl::remove_member_decl): Take a non-const smart pointer. (add_decl_to_scope): Pass the scope smart pointer by reference. (is_decl, is_function_decl, is_pointer_type, is_reference_type) (is_qualified_type, is_function_type, is_method_type) (is_method_decl, is_array_type): Take a type_or_decl base pointer, rather than either a decl_base or type_base pointer. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
31cd5d77b8 |
Cleanup namespace importing in abg-interned-str.h
* include/abg-interned-str.h: Inject std::tr1::shared_ptr, std::string and std::ostream inside the abigail namespace. (interned_string::{interned_string, raw, operator==, operator!=, operator<): Adjust. (operator==, operator!=, operator<<, operator+): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
4324b82e99 |
Prevent infinite loops while comparing two function_type
While comparing two function types a given sub-type can itself have a sub-type that *is* the same function_type as the one we are looking at. In that case, an infinite loop appears. This patch detects those cases, similarly to what we do for class_decl and avoids the eventual infinite loop. * include/abg-ir.h (class environment): Make class function_type be a friend of this class. (class function_type): Make the equality function for function_types be a friend of this class. * src/abg-ir.cc (environment::priv::fn_types_being_compared_): New data member. (function_type::priv::{mark_as_being_compared, unmark_as_being_compared, comparison_started}): Define new member functions. (equals): In the overload for function_types, if any of the the function_type being compared is already being compared, return early saying that the two function_types are equal. This avoids Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
607dbff271 |
Define a new interned_string_set_type typedef
In order to prepare other changes to come, this patch declares an unordered set of abigail::interned_string. * include/abg-interned-str.h (interned_string_set_type): Define a new typedef for unordered_set<interned_string>. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
98c8d61684 |
Drop suppressed ABI artifacts from the IR
This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
24b418795e |
Pimplify the abigail::ir::scope_decl type
The abigail::ir::scope_decl still has its data member members be visible from its header file. This patch hides those data member using the pimpl idiom, just as what is done other types throughout the project. * include/abg-ir.h (scope_decl::{priv, priv_sptr}) Declare new types. (scope_decl::priv_): New pimpl data member. (scope_decl::{member_, member_scopes}): Move this as data member of the new scope_decl::priv type in the abg-ir.cc file. (scope_decl::{scope_decl, get_member_decls, get_member_scopes, is_empty}): Make these inline member functions be out-of-line. * src/abg-ir.cc (struct scope_decl::priv): Define new type. (scope_decl::{scope_decl, get_member_decls, get_member_scopes, is_empty}): Define these new member functions here. They were inline in the include/abg-ir.h header files before. (scope_decl::{add_member_decl, insert_member_decl, remove_member_decl}): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e73c0ed0fb |
Add new helper functions
In preparation of dropping ABI artifacts from the IR, add new generic helper functions. * include/abg-fwd.h (get_location, build_qualified_name): Declare new functions. * include/abg-ir.h (is_method_decl): Declare two new overloads of this function. * src/abg-ir.cc (get_location, build_qualified_name) (is_method_decl): Define these functions declared above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
756cdc113b |
Do not emit empty namespaces in abixml
Today The abixml writer emits namespaces even if they are empty or contain empty namespaces. This leads to abixml files that are unnecessarily big and verbose. This patch prevents that. * include/abg-ir.h (namespace_decl::is_empty_or_has_empty_sub_namespaces): Declare new function ... * src/abg-ir.cc (namespace_decl::is_empty_or_has_empty_sub_namespaces): ... and define it. * src/abg-writer.cc (write_namespace_decl): Do not write empty namespaces or namespaces containing empty namespaces. * tests/data/test-read-dwarf/test9-pr18818-clang.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/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. * tests/data/test-read-dwarf/libtest23.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b07fcbcc0d |
Cleanup is_class and is_compatible_with_class_type
There was two overloads of is_class, one for types and one for decls. Now that we have type_or_decl_base which is a common base type for both, having just one is_class function that takes a type_or_decl_base is more compact and easier to maintain. This patch does that. It also cleans up the declaration of the is_compatible_with_class_type function. * include/abg-fwd.h (is_class): Remove the overloads that take a decl_base or a type_base. Add one that takes a type_or_decl_base. (is_compatible_with_class_type): Make this take a reference to smart pointer, not just the smart pointer. * src/abg-ir.cc (is_class): Do the same as in the header file. (is_compatible_with_class_type): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5a24ffcd61 |
Add ABG_ASSERT_NOT_REACHED macro
Adding this macro to abort at places where the execution flow shouldn't take us to. Using this is more explicit (self-documented) than using abort. This patch replaces the use of abort() in abg-dwarf-reader.cc. * include/abg-tools-utils.h (ABG_ASSERT_NOT_REACHED): New macro. * src/abg-dwarf-reader.cc (stt_to_elf_symbol_type) (stb_to_elf_symbol_binding, get_elf_class_size_in_bytes) (build_ir_node_from_die): Use the new ABG_ASSERT_NOT_REACHED macro in lieu of just calling abort(). Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
93fea0667e |
Better recognize qualified void type
This fixes Bug 20329 - DW_TAG_const_type with no DW_AT_type not recognized as "const void". It appears that GCC sometimes emits "const void" types by emitting a const type DIE with no type attribute. The DWARF reader didn't recognize that construct as a qualified void type. This patch teaches the DWARF reader to recognize that construct. It also appears that "const void" and "void" are equivalent and can be emitted interchangeably by compilers (Intel and GCC) in their debug info. That can lead to spurious ABI change reports saying that a type "const void" was changed into a "void" type. This patch transforms an occurrence of "const void" type into a "void" type in the internal representation when reading DWARF. This does away with the spurious change that appears when comparing selected binaries emitted with the intel against binaries emitted with GCC. * include/abg-ir.h (environment::is_void_type): Declare new member function. * src/abg-ir.cc (environment::is_void_type): Define new member function. * src/abg-dwarf-reader.cc (maybe_strip_qualification): Strip const qualifier from const void. * tests/data/test-diff-filter/test34-libjemalloc.so.2-gcc-6.1.0: New test input. * tests/data/test-diff-filter/test34-libjemalloc.so.2-intel-16.0.3: Likewise. * tests/data/test-diff-filter/test34-report-0.txt: New reference output. * tests/data/Makefile.am: Add the new files above to the source distribution. * tests/test-diff-filter.cc (in_out_specs): Compare the two new binaries above. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Adjust. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Adjust. * tests/data/test-read-dwarf/test1.abi: 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/test13-pr18894.so.abi: Adjust. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9da7ae49d7 |
Add a new overload for is_type_decl
While working on something else, it appeared that I needed an overload for is_type_decl that takes a shared pointer to decl_base. The current is_type_decl takes a shared opinter to type_base. This patch also updates some code that unnecessarily calls is_type_decl. * include/abg-fwd.h (is_type_decl): Declare a new overload * src/abg-ir.cc (is_type_decl): Define a new overload. (function_decl::parameter::get_pretty_representation): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a1b07236bb |
Misc white space and comment cleanups
While looking at something else, I noticed some spots that need cleanup with respect to white space or comments. This patch does just that. No big deal. * include/abg-ir.h (typedef type_or_decl_base): Cleanup comment. * src/abg-ir.cc (struct type_or_decl_base::priv): Fix comment. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b36ca1501e |
Bug 20180 - Support system-wide suppression specifications
This patch adds support for loading system and user level suppression specifications for libabigail tools. At launch time, relevant libabigail tools (abidiff, abipkgdiff fedabipkgdiff for now) read the default system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_SYSTEM_SUPPRESSION_FILE, if set, or from the file $libdir/libabigail/default.abignore. Then it reads the user system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_USER_SUPPRESSION_FILE, if set, or from the file $HOME/.abignore. The content of the user system suppression file is merged with the content of default system suppression file. That content is also merged with the content of the suppression specification files that might be provided by the --suppressions command line option of the invoked tools. The resulting set of all these suppression specifications is thus used to filter the ABI change reports that are emitted. abidiff, abipkgdiff and abipkgdiff gain a --no-default-suppression option to avoid loading any of these default suppression specification files. The patch also installs a default.abignore file into $(pkglibdir). Note that on x86_64, that directory is /usr/lib64/libabigail. Now we just need to think about the content of that default.abignore file. * doc/manuals/abidiff.rst: Document the default suppression scheme, its interaction with the --supprs option and the new --no-default option. * doc/manuals/abipkgdiff.rst: Likewise. * doc/manuals/fedabipkgdiff.rst: Likewise. * configure.ac: Generate the tests/runtestdefaultsupprs.py file from the new tests/runtestdefaultsupprs.py.in template. * default.abignore: New file. * Makefile.am: Add it to source distribution. * src/Makefile.am: Define the ABIGAIL_ROOT_SYSTEM_LIBDIR preprocessor macro that is set the value of the $libdir autotools macro. * include/abg-tools-utils.h: Update copyright years. (get_system_libdir, get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Declare new functions * src/abg-tools-utils.cc (get_system_libdir) (get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Define new functions. (is_regular_file): Amend this so that it return true for symlinks to regular files too. (is_dir): Amend this so that it returns true for symlinks to directories too. * tools/abidiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (display_usage): Display a new help string for the new --no-default-suppression command line option. (parse_command_line): Parse this new command line option. (set_diff_context_from_opts): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/abipkgdiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (parse_command_line): Parse the new --no-default-suppression command line option. (main): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/fedabipkgdiff (abipkgdiff): Add --no-default-suppression to the invocation of abipkgdiff if it was provided on the command line. (build_commandline_args_parser): Parse the new --no-default-suppression command line option. * tests/runtestdefaultsupprs.py.in: New test harness template. * tests/Makefile.am: Add the new runtestdefaultsupprs.py to the set of tests. * tests/data/test-default-supprs/test0-type-suppr-0.suppr: New test input. * tests/data/test-default-supprs/test0-type-suppr-report-0.txt: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v0.o: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v1.o: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir-report-0.txt: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir1: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir2: Likewise. * tests/data/Makefile.am: Add new the new tests input above to Makefile.am. * tests/runtestcanonicalizetypes.sh.in: Pass --no-default-suppression to abidiff invocations. * tests/runtestdefaultsupprs.py.in: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e19bf5627a |
Make abi{pkg}diff filter out changes about private types
This is to address the following enhancement requests: #19588 - Add a --headers-dir1 and --headers-dir2 option to abidiff #19948 - Add --devel-pkg1 and --devel-pkg2 options to abipkgdiff When the user specifies where to find header files for two binaries (or packages) being compared, this patch generates a type suppression specification that filters out change reports about types that are defined in files that are not in the set of header files specified. The type suppression specification also suppresses change reports about changed/added/removed virtual member functions which enclosing class type matches the type suppression specification. There is a corner case that the patch handles too, and that is exhibited by the accompanying test case for abidiff. There can be a class defined by DWARF as having no source location and as being a pure declaration. This can be a class declaration that has inline virtual members only, and one or several non-defined virtual methods too. When that declaration is included in a source file, GCC generates debug info that describes that class as being a declaration-only class with no source declaration. This patch considers such a class as being non defined; you know, like a true opaque type. So it's considered being not defined in any public header file. Changes to this kind of class are thus filtered out. * include/abg-comp-filter.h: Update copyright year. * src/abg-comp-filter.cc (has_virtual_mem_fn_change): Make this static function become exported. (has_virtual_mem_fn_change): Declare new function. * include/abg-suppression.h (suppression_base::{get,set}_is_artificial): Declare new accessors. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Add a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. * src/abg-suppression.cc (suppression_base::priv::is_artificial_): New data member. (suppression_base::priv::priv): Initialize the new data member. (suppression_base::{get,set}_is_artificial): Define new accessors. (type_suppression::priv::source_locations_to_keep_): Change the vector of strings representing source file names into unordered set of string. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Define a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. (type_suppression::suppresses_diff): Make this suppress virtual member function diffs if the enclosing type of the changed virtual member is suppressed by the current type_suppression. (read_type_suppression): Adjust to use the fact that the source locations are not stored in an unordered set, not in a vector anymore. Otherwise, using a vector here make things too slow. (type_suppression::suppresses_type): Likewise. Also, If the type we are looking at has no location because it's a true opaque type and if the current suppression is an artificial suppression that is meant to suppress change reports about non-public types, then suppress the type. * include/abg-tools-utils.h (gen_suppr_spec_from_headers): Declare new public function. * src/abg-tools-utils.cc (PRIVATE_TYPES_SUPPR_SPEC_NAME): Define a new constant variable. (handle_fts_entry): Define new static function. (gen_suppr_spec_from_headers): Define new public function. * src/abg-comparison.cc (corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars): If a type suppression suppresses a given class C, make it change added/removed virtual functions whose enclosing type is C. * tools/abidiff.cc (options::{headers_dir1, headers_dir2}): New data members. (display_usage): Add help strings for --headers-dir1 and --headers-dir2. (parse_command_line): Parse the new --headers-dir1 and --headers-dir2 options. (set_diff_context_from_opts): Generate suppression specifications to filter out changes on private types, if --headers-dir1 or --headers-dir2 is given. * tools/abipkgdiff.cc (options::{devel_package1, devel_package2}): New data members. (typedef package_sptr): New typedef. (enum package::kind): New enum. (package::kind_): New data member. This replaces ... (package::is_debug_info_): ... this data member. (package::{devel_package_, private_types_suppressions_}): New data members. (package::package): Adjust. (package::get_kind): Define new member function. This replaces ... (package::is_debug_info): ... this member function overload. (package::set_kind): Define new member functin. It replaces ... (package::is_debug_info): ... this member function overload. (package::{devel_package, private_types_suppressions}): Define new accessors. (package::erase_extraction_directies): Erase the sub-directory where development packages are extracted to. (compare_args::private_types_suppr{1,2}): New data members. (compare_args::compare_args): Adjust. (display_usage): Add help strings for --devel-pkg1/--devel-pkg2. (compare): Make the overload that compares elf files take private types suppressions. Add the private types suppressions to the diff context. (pthread_routine_compare): Adjust the call to compare. (maybe_create_private_types_suppressions): Define new static function. (pthread_routine_extract_pkg_and_map_its_content): If a devel package was specified for the main package then extract it in parallel with the other package extraction. When the extraction is done, create private types suppressions by visiting the directories that contain the header files. (compare): In the overload that compares packages by scheduling comparison of individual elf files that are in the packages, pass in the private type suppressions too. (parse_command_line): Parse the new --devel-pkg{1,2} command line options. (main): Associate the devel package to the main package, if the --devel-pkg{1,2}. * doc/manuals/abidiff.rst: Add documentation about the new --headers-dir1 and --headers-dir2 options. * doc/manuals/abipkgdiff.rst: Likewise, add documentation about the new --devel-pkg1 and --devel-pkg2 libraries. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: New test reference output. * tests/data/test-diff-pkg/tbb-devel-4.1-9.20130314.fc22.x86_64.rpm: New test input package. * tests/data/test-diff-pkg/tbb-devel-4.3-3.20141204.fc23.x86_64.rpm: Likewise. * tests/test-diff-pkg.cc b/tests/test-diff-pkg.cc (InOutSpec::{first,second}_in_devel_package_path): New data members. (in_out_specs): Adjust. Also, add a new entry describing the new test inputs above. (test_task::perform): When the new test entry contains devel packages, pass them to abipkgdiff using the --devel1 and --devel2 options. * tests/data/test-diff-suppr/test30-include-dir-v0/test30-pub-lib-v0.h: A new test input source code. * tests/data/test-diff-suppr/test30-include-dir-v1/test30-pub-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.so: Add new test binary input. * tests/data/test-diff-suppr/test30-pub-lib-v1.cc: Add new test input source code. * tests/data/test-diff-suppr/test30-pub-lib-v1.so: Add new test binary input. * tests/data/test-diff-suppr/test30-report-0.txt: Add new test reference output. * tests/data/test-diff-suppr/test30-report-1.txt: Add new test reference output. * tests/test-diff-suppr.cc (InOutSpec::headers_dir{1,2}): New data members. (InOutSpec::abidiff_options): Renamed the bidiff_options data member into this. (in_out_specs): Adjust. Also, added the new test input above to this. (main): Adjust to invoke abidiff with the new --hd1 and --hd2 options if the input specs for the tests has the new InOutSpec::headers_dir{1,2} data member set. Renamed bidiff into abidiff. * tests/data/Makefile.am: Add the new test inputs to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a9e01ad6e9 |
Optimize out some shared_ptr use
Profiling showed that getting the pointed-to type of a pointer type is on the hot spot when comparing corpora with a lot of entry points with a lot of pointer types reachable from the entry points of the corpora. So avoid handling the shared_ptr to the pointed-to type for that case can save us a few CPU cycles in a noticeable way. This patch does this by creating a new pointer_type_def::get_naked_pointed_to_type() (that returns a naked pointer) to supplement the classic pointer_type_def::get_pointer_to_type() function, and uses that in a code spot that profiling revealed to be a critical path. * include/abg-ir.h (pointer_type_def::get_naked_pointed_to_type): Declare new member function. * src/abg-ir.cc (pointer_type_def::priv::naked_pointed_to_type_): New data member. (pointer_type_def::priv::priv): Adjust to initialize the new data member. (pointer_type_def::pointer_type_def): Adjust to use the constructor pointer_type_def::priv::priv to initialize the pointed-to type (including its new naked pointer variant). So we do not have to initialize the priv_->pointed_to_type_ explicitely in the constructor anymore. (pointer_type_def::get_naked_pointed_to_type): Define new data member. (pointer_type_def::get_qualified_name): Use a naked pointer to the pointed-to type, rather than a smart pointer. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
22cd4059cd |
Light optimizations by passing reference to smart pointers around
Profiling shows that some smart pointers were unnecessarily created here and there, and that had a noticeable effect on performance, when comparing two gtk3 packages. This patch passes references to smart pointers in those cases. * include/abg-fwd.h (get_type_name): Take a reference to type_sptr. * src/abg-ir.cc (get_type_name): Take a reference to type_sptr. (suppression_base::priv::{get_file_name_regex, get_file_name_not_regex, get_soname_regex, get_soname_not_regex}): Return a reference to regex_t_sptr. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
49db3f838c |
Plug leak of diffs of member variables of class type
On certain work loads, cycles in the tree of diffs of member variables can appear. This because: 1/ each diff tree nodes holds a reference on each of its children nodes 2/ each var_diff tree node holds a reference on the diff tree node representing its type changes. There can thus be reference cycles in involving diff the tree --> child node relationship and the var_diff tree --> type diff tree relationship. This patch fixes the issue be make sure that a diff tree node does not hold a reference on its children nodes. That is, rather than having a vector of shared pointers to its children diff nodes, it has a vector of naked pointers to those. The patch goes further by making sure that a var_diff node does not hold a reference to its type diff node either. It holds a weak pointer to the type diff node, rather than a shared pointer. The patch should be followed by a patch make sure that all kinds of diff nodes follow this pattern; that is, if a diff node needs to carry a sub-type diff node, it should do so by either using a naked pointer to the sub-type diff node, or a weak pointer. For now, the patch fixes the leaks reported by running all the tests of the suite under Valgrind. * include/abg-comparison.h (diff_wptr, unordered_diff_sptr_set): New typedefs. (struct diff_sptr_hasher): Define new type. (diff_context::keep_diff_alive): Declare new member function. (diff::children_nodes): Return a vector of diff*, rather than a vector of diff_sptr. * src/abg-comparison.cc (diff_context::priv::live_diffs_): New data member. (diff_context::keep_diff_alive): Define new data member. (diff::priv::children_): Make this be a vector of diff*, rather than a vector of diff_sptr. (diff_less_than_functor::operator()): Add a new overload for diff*. Make the existing overload of diff_sptr use the new one. (diff::children_nodes): Adjust; (diff::append_child_node): Make sure the child node is kept alive. Only add the naked pointer to the child node to the vector of children. (diff::traverse): Adjust. (var_diff::priv::type_diff_): Make this be a weak pointer, rather than a shared pointer. (var_diff::type_diff): The var_diff::priv::type_diff_ data member is now a weak pointer, so make this accessor convert it to a shared pointer. (corpus_diff::priv::children_): Turn this into a vector of diff*, rather than a vector of diff_sptr. (corpus_diff::children_nodes): Adjust. (corpus_diff::append_child_node): Make sure the child node is kept alive. Only add the naked pointer to the child node to the vector of children. (category_propagation_visitor::visit_end): Adjust. (suppression_categorization_visitor::visit_end): Adjust. (redundancy_marking_visitor::{visit_begin, visit_end}): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
00f79732fb |
Plug leak of shared private data of class_diff type
Some time ago, a memory optimization was put in place to reduce the memory usage of the IR used to represent the result of a comparison between two corpora. The principle of that optimization was to share the data of the class_diff::priv member among instances of class_diff that are in the same class of equivalence. In practice, the class_diff::priv member of an instance that has a non empty class of equivalence was set to the class_diff::priv of its canonical type. Because clas_diff::priv is a shared pointer, setting it to the class_diff::priv of another instance was creating cycles in the graph of class_diff, sometimes. And those cycles lead to memory leaks as the reference count of shared pointers to class_diff would not go down to zero anymore. This patch fixes the problem of those cycles by not setting the class_diff::priv data member. Rather, when a class_diff is part of a non-empty class of equivalence, its class_diff::priv is left nil. A new class_diff::get_priv() accessor is provided; it returns the shared class_diff::priv of the canonical type when the current class_diff::priv is nil; otherwise it just returns the current class_diff::priv. * include/abg-comparison.h (class_diff::get_priv): Declare new member function. (class_diff::get_priv): Define new member function. (class_diff::{chain_into_hierarchy, base_changes, deleted_bases, inserted_bases, changed_bases, base_changes, member_types_changes, member_types_changes, data_members_changes, inserted_data_members, deleted_data_members, member_fns_changes, changed_member_fns, member_fns_changes, deleted_member_fns, inserted_member_fns, member_fn_tmpls_changes, member_class_tmpls_changes, member_class_tmpls_changes, report}): Rather than accessing class_diff::priv directly, use the new class_diff::get_priv. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5cf19e47ef |
Remove circular ref from class_decl::priv::definition_of_declaration
It appears that there are cases where the data member class_decl::priv::definition_of_declaration_ can point to the current instance of class_decl, leading to a circular reference and thus a leak because the reference count of the current instance of class_decl will never reach zero. This patch fixes that by making class_decl::priv::definition_of_declaration_ be a weak pointer, rather than a smart pointer. * include/abg-ir.cc (class_decl::get_definition_of_declaration): Return a shared pointer, rather than a reference to a shared pointer. * src/abg-ir.cc (class_decl::priv::definition_of_declaration_): Make this be a weak pointer. (class_decl::get_definition_of_declaration): Likewise. And return the shared pointer built out of the weak pointer we have in there now. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b71e5c6f22 |
Plug leak of regex_t in suppression engine
The suppression engine was not creating the shared pointer to regex_t in the proper way that would correctly free the memory allocated by the glibc's regcomp function. This patch fixes that. * include/abg-sptr-utils.h (build_sptr<T>): Declare an overload that allocates a T* and wraps it into a shared_ptr<T>. (build_sptr<regex_t>): Declare a specialization for regex_t. * src/abg-corpus.cc (build_sptr<regex_t>()): Define the specialization here. * src/abg-suppression.ccp (suppression_base::priv::{get_file_[not]_name_regex, get_soname_[not]_regex}): Use the new build_sptr<regex_t>(). (type_suppression::priv::{get_type_name_regex, get_source_location_to_keep_regex}): Likewise. (function_suppression::parameter_spec::priv::get_type_name_regex): Likewise. (function_suppression::priv::{get_name_regex, get_return_type_regex, get_symbol_name_regex, get_symbol_version_regex}): Likewise. (variable_suppression::priv::{get_name_regex, get_symbol_name_regex, get_symbol_version_regex, get_type_name_regex}): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
080b88c9a1 |
Implement a [suppress_file] suppression directive
abidiff, abipkgdiff and abicompat now recognize a [suppress_file] directive in suppression specifications. That directive instructs the tool to avoid loading some binaries altogether. This is the first directive that won't act on the result of the comparison of two binaries. It actually acts earlier and prevents the tool from loading some binaries altogether. The directive looks like: [suppress_file] # Don't load any library named lib_private*.so file_name_regexp = lib_private.*\\.so This prevents the tool from loading (and thus comparing) any library which name matches the pattern "lib_private*.so". [suppress_file] # Only load libraries name lib_public*.so file_name_not_regexp = lib_public.*\\.so This instructs the tool to only load (and compare) files which name match the pattern "lib_public*.so". * doc/manuals/libabigail-concepts.rst: Document the new 'suppress_file' directive. * include/abg-suppression.h (file_suppression): Define new class. (file_suppression_sptr): Define new typedef. (is_file_suppression, file_is_suppressed): Declare new functions. * src/abg-suppression.cc (): (read_file_suppression, is_file_suppression, file_is_suppressed): Define new functions. (file_suppression::{file_suppression, suppresses_file, ~file_suppression}): Define new member functions. * tools/abidiff.cc (main): If a suppression specification suppresses one of the input files, then do not perform the comparison. * tools/abipkgdiff.cc (compare): If a suppression specification suppresses a file that is to be compared, then do not perform the comparison. * tools/abicompat.cc (create_diff_context): New static function. (perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode): Adjust to take a context in parameter. Do not create a diff context here anymore, do not load suppression files here either. (main): Use the new create_diff_context to create a diff context and initialize it, including loading suppression specifications. If any suppression specification suppresses a file to load, then do not load perform any compatibility checking. Adjust invocations of perform_compat_check_in_weak_mode and perform_compat_check_in_normal_mode to pass the diff context. * tests/data/test-diff-suppr/test0-type-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test0-type-suppr-4.suppr: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-5.suppr: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-6.suppr: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-6.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-7.txt: Likewise. * tests/test-diff-suppr.cc (in_out_specs): Use the new test inputs. * tests/data/test-abicompat/test0-fn-changed-1.suppr: New test input. * tests/data/test-abicompat/test0-fn-changed-report-3.txt: Likewise. * tests/test-abicompat.cc (in_out_specs):: Use the new test inputs. * tests/data/Makefile.am: Add the new test material to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7cd624a1cd |
Split suppression engine off of abg-comparison.{cc,h}
Until now, the suppression engine was part of the comparison engine. The code of both was in the abg-comparison.{cc,h} files. For the sake of greater modularity, this patch separates the suppression engine from the comparison engine. The suppression engine now lives in include/abg-suppression.h and src/abg-suppression.cc. The patch also updates logical consumers of the suppression engine to adapt them to the change. * include/Makefile.am: Add abg-suppression.h to source distribution. * include/abg-comparison.h: Remove abg-ini.h include directive. (suppression_sptr, suppressions_type): Move these typedefs to abg-fwd.h. (class suppression_base, type_suppression) (type_suppression::insertion_range) (type_suppression::insertion_range::boundary) (type_suppression::insertion_range::integer_boundary) (type_suppression::insertion_range::fn_call_expr_boundary) (function_suppression, function_suppression::parameter_spec) (variable_suppression): Move these type definitions to the new abg-suppression.h. (read_suppressions, is_type_suppression, is_integer_boundary) (is_fn_call_expr_boundary, is_function_suppression) (is_variable_suppression, operator&) (operator|): Move these function declarations to the new abg-suppression.h. (type_suppression, type_suppression_sptr, type_suppression_type) (function_suppression, function_suppression_sptr) (function_suppressions_type, variable_suppression) (variable_suppression_sptr, variable_suppressions_type): Move these forward declaration and typedefs to the new abg-suppression.h. (diff_context::suppressions): Adjust return type to suppr::suppressions_type&. (diff_context::add_suppression): Adjust parameter type to suppr::suppressions_sptr. (diff_context::add_suppressions): Adjust parameter type suppr::suppressions_type&. (is_type_diff, is_decl_diff, is_var_diff, is_function_decl_diff) (is_pointer_diff, is_reference_diff, is_fn_parm_diff) (is_base_diff, is_child_node_of_function_parm_diff) (is_child_node_of_base_diff): Declare these new functions. They were previously static, local to abg-comparison.cc only. Now they need to be exported because they are used by the suppression engine's code that now lives in its one files. * include/abg-fwd.h (suppr::{suppression_base, suppression_sptr, suppressions_type}): Forward declare these here. * include/abg-suppression.h (class suppression_base) (type_suppression, type_suppression::insertion_range) (type_suppression::insertion_range::boundary) (type_suppression::insertion_range::integer_boundary) (type_suppression::insertion_range::fn_call_expr_boundary) (function_suppression, function_suppression::parameter_spec) (variable_suppression): Move these type definitions here, in the namespace suppr. (read_suppressions, is_type_suppression, is_integer_boundary) (is_fn_call_expr_boundary, is_function_suppression) (is_variable_suppression, operator&) (operator|): Move these function decalration here, in the namespace suppr. (type_suppression_sptr, type_suppressions_type) (function_suppression_sptr, function_suppressions_type) (variable_suppression_sptr, variable_suppressions_type): Move these typedefs here, in the namespace suppr. * src/Makefile.am: add src/abg-suppression.cc to source distribution. * src/abg-comparison.cc (is_type_diff, is_decl_diff, is_var_diff) (is_function_decl_diff, 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): Export these functions. (*suppression*): Move all the suppression-related definitions to the new abg-suppression.cc. * src/abg-suppression.cc: New file. Contains all the *suppression* definitions from src/abg-comparison.cc, that are put in the suppr namespace. * tools/abicompat.cc: Adjust. * tools/abidiff.cc: Likewise. * tools/abipkgdiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e2f777164f |
Update copyright year on abg-comparison.h
* include/abg-comparison.h: Update copyright year. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
19463fc485 |
Add some apidoc to dwarf_reader
* include/abg-dwarf-reader.h (namespace dwarf_reader): Add apidoc. (enum elf_type): Add an apidoc for each enumerator. * src/abg-dwarf-reader.cc (get_type_of_elf_file): Add an apidoc for the 'type' parameter. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b885e6283f |
Bug 20015 - support file_name_not_regexp and soname_not_regexp in suppr specs
The supression directives suppress_type, suppress_function and suppress_variable support the two properties below, among others: file_name_regexp = <some-regexp> soname_regexp = <some-regexp> When the regular expression matches either the file name or the soname, then the suppression directive is activated. This patch adds the support for these two additional properties for these suppression directives: file_name_not_regexp = <some-regexp> soname_not_regexp = <some-regexp> These activate the current suppression directive if the regular expression does *NOT* match the file name or soname. This is very helpful to express change report suppressions like: "suppress all ABI change reports for all libraries but those with file names (or sonames) with the pattern libfoobar.*" * include/abg-comparison.h (suppression_base::{get,set}_file_name_not_regex_str): Declare new member functions. (suppression_base::{get,set}_soname_not_regex_str): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Likewise. * src/abg-comparison.cc (suppression_base::priv::get_file_name_regex): Fix comment. (suppression_base::priv::get_file_name_not_regex): New member function. (suppression_base::priv::get_soname_regex): Fix comment. (suppression_base::priv::get_soname_not_regex): New member function. (suppression_base::{get,set}_file_name_not_regex_str): Define new member functions. (suppression_base::{get,set}_soname_not_regex_str): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Likewise. These got factorized out of type_suppression::suppresses_type, function_suppression::suppresses_function, function_suppression::suppresses_function_symbol, variable_suppression::suppresses_variable, variable_suppression::suppresses_variable_symbol. (type_suppression::suppresses_type): Use the new suppression_base::{names,sonames}_of_binaries_match. (read_type_suppression): Read the new file_name_not_regexp and soname_not_regexp properties. (function_suppression::{suppresses_function, suppresses_function_symbol}): Use the new suppression_base::{names,sonames}_of_binaries_match. (read_function_suppression): Read the new file_name_not_regexp and soname_not_regexp properties. (variable_suppression::{suppresses_variable, variable_suppression::suppresses_variable_symbol}): Use the new suppression_base::{names,sonames}_of_binaries_match. (read_variable_suppression): Use the new suppression_base::{names,sonames}_of_binaries_match. * doc/manuals/libabigail-concepts.rst: Document the new file_name_not_regexp and soname_not_regexp suppression properties. * tests/data/test-diff-suppr/test24-soname-report-10.txt: New test reference output. * tests/data/test-diff-suppr/test24-soname-report-11.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-13.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-15.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-9.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-10.txt: New test input. * tests/data/test-diff-suppr/test24-soname-suppr-11.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-12.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-13.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-14.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-15.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-16.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-9.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-2.txt: New test reference output. * tests/data/test-diff-suppr/test29-soname-report-3.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-4.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-5.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-6.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-7.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-8.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-2.txt: New test input. * tests/data/test-diff-suppr/test29-suppr-3.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-4.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-5.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-7.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Make this test harness run over the new test inputs. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
8d670d6dde |
Make API documentation of thread pools visible
* include/abg-workers.h: Document the workers namespace, the task, queue and queue::task_done_notify types. * src/abg-workers.cc: Move the documentation of the thread_pool module inside the abigail::worker namespace, so that references to task and queue types (which are also in the abigail::worker namespace) can be resolved in the apidoc. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Sinny Kumari
|
8944ceb9ef |
Bug 19961 - Distinguish between PI executable and shared library
In the ELF format, Position Independent Executables (aka PIE) and shared libraries are marked as being of type ET_DYN. So just looking at the type of the ELF file is not enough to discriminate a position independent executable from a shared library. And this is the problem. Libabigail just looks at the type of the ELF file to discriminate PIE binaries from shared libraries binaries. So it treats both kinds of binaries as being shared libraries. When we run abipkgdiff with the --dso-only option, the tool considers both PIEs and shared libraries, even though the intent of the --dso-only option is have the tool consider shared libraries only. With this patch, we introduce a new enumerator ELF_TYPE_PI_EXEC (to the elf_type enum) for PIE binaries. From now on, a file will be properly recognized as being of the ELF_TYPE_DSO kind only if it is a shared library. * include/abg-dwarf-reader.h (elf_type): Add new enumerator ELF_TYPE_PI_EXEC. * src/abg-dwarf-reader.cc (lookup_data_tag_from_dynamic_segment): New function for data tag lookup in dynamic segment of an elf (elf_file_type): Return ELF_TYPE_PI_EXEC file type for a PI executable. (get_elf_file_type): Change this to take an elf handle. (get_type_of_elf_file): New function that got factorized out of ... (load_dt_soname_and_needed): ... this one. * tools/abipkgdiff.cc (create_maps_of_package_content): Also consider ELF_TYPE_PI_EXEC file type. (compare): Likewise. * tests/test-diff-pkg.cc (in_out_specs): Test case additions * tests/data/Makefile.am: Include test files * tests/data/test-diff-pkg/tarpkg-1-dir1.tar.gz: New test data * tests/data/test-diff-pkg/tarpkg-1-dir2.tar.gz: New test data * tests/data/test-diff-pkg/tarpkg-1-report-0.txt: New test result Signed-off-by: Sinny Kumari <sinny@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |