This speeds up the tests when they are run in parallel.
* tests/Makefile.am: Sort the tests by running the slowest ones
first.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
We are going to need to speed up more and more tests, and coding directly
with libpthread for that can be tedious and bug-prone. So I devised an
implementation for the worker threads design pattern instead, and used
it to speed up some tests.
* include/Makefile.am: Add the new abg-workers.h to source
distribution.
* include/abg-workers.h: New file.
* src/Makefile.am: Add the new abg-worker.cc to source
distribution.
* src/abg-workers.cc: New file.
* tests/test-utils.cc: Update copyright. Make get_src_dir() and
get_build_dir() return a const char*, as opposed to returning a
string. Make that const char reside in thread local storage, so
that two concurrent threads can safely call these functions in
parallel, without any race.
* tests/test-utils.h: Make get_src_dir() and get_build_dir()
return a const char*, as opposed to returning a string.
* tests/test-abicompat.cc: Update copyright. Adjust for
get_src_dir() and get_build_dir() change.
* tests/test-abidiff.cc: Likewise.
* tests/test-alt-dwarf-file.cc: Likewise.
* tests/test-core-diff.cc: Likewise.
* tests/test-diff-dwarf-abixml.cc: Likewise.
* tests/test-diff-dwarf.cc: Likewise.
* tests/test-diff-pkg.cc: Likewise.
* tests/test-diff-suppr.cc: Likewise.
* tests/test-lookup-syms.cc: Likewise.
* tests/test-read-dwarf.cc: Likewise.
* tests/test-read-write.cc: Likewise.
* tests/test-types-stability.cc: Likewise. Use the new task queue
type to run these tests in parallel.
* tests/test-diff-filter.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-writer.cc (write_location): Sanitize the filepath with
xml::escape_xml_string().
(write_translation_unit): Likewise.
(write_corpus_to_native_xml): Likewise.
* tests/data/test-types-stability/pr19433-custom0: Add a new test file.
* tests/test-types-stability.cc: Add the test file to the test harness.
* tests/data/Makefile.am: Add the new test file to the list.
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
The is still some changes in the way values of enumerators are
represented in 32 and 64 bits systems. This is because the type of
enumerators is size_t which 32 bits on 32 bits systems and 64 bits on
64 bits systems. The problem is, the output of, abidw can thus be
different on 32 and 64 bits, making some tests output be different on
these platforms.
This patch thus uses uint64_t to represent enumerator values on all
platforms.
* include/abg-ir.h: Include stdint.h for int64_t.
(enumerator::enumerator): Take an int64_t value for the value of
the enumerator.
(enumerator::{s,g}et_value): Take/return an int64_t value.
* src/abg-ir.cc (enum_type_decl::enumerator::priv): Store the
value in an int64_t.
(enumerator::priv::priv): Take a int64_t for the value.
(enum_type_decl::enumerator::enumerator): Likewise.
(enum_type_decl::enumerator::{s,g}et_value): Take/returnan int64_t
value.
* src/abg-dwarf-reader.cc (die_unsigned_constant_attribute): Take
an uint64_t value.
(die_signed_constant_attribute): Take an int64_t value.
(die_location, die_size_in_bits, die_access_specifier)
(die_virtuality, die_is_virtual, die_is_declared_inline)
(build_translation_unit_and_add_to_ir, build_type_decl)
(build_enum_type, build_pointer_type_def, build_array_type):
Adjust.
* src/abg-reader.cc (build_enum_type_decl): Adjust.
* src/abg-writer.cc (write_enum_type_decl): Do not cast the result
of enumerator::get_value() anymore, it's value is now a int64_t.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Turns out without this include the file won't compile on el6/g++
4.4.7, because std::lower_bound won't be found. Woops.
Fixed thus.
* src/abg-dwarf-reader.cc: Add missing <algorithm> include file.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In this problem report libabigail's DWARF reader wrongly looks up the
address of variables (that it got from DWARF) in the .bss section of
the ELF file. But then, in these files (generated by the Intel C++
compiler) the variables we are looking at have their addresses in the
.data1 section.
This patch changes the DWARF/ELF reader to make it look for variable
addresses in .data, .data1, .rodata and .bss sections, as it should
be.
* include/abg-dwarf-reader.h (elf_type::ELF_TYPE_RELOCATABLE): New
enumerator.
* src/abg-dwarf-reader.cc (find_section): Factorize this from ...
(find_text_section, find_bss_section): ... these.
(find_rodata_section, find_data_section, find_data1_section):
Define new static functions.
(elf_file_type): Move this static function definition up.
(read_context::{get_elf_file_type, address_is_in_section,
get_data_section_for_variable_address}): New member functions.
(read_context::maybe_adjust_fn_sym_address): Adjust comment.
Adjust to use the new
read_context::get_data_section_for_variable_address().
* tests/data/test-types-stability/pr19138-elf0: New test input
binary.
* tests/data/Makefile.am: Add the new test input binary to the
test suite.
* tests/test-types-stability.cc (elf_paths): Take it into account.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Now that we release tarballs, this patch updates the website for
instructions about how to compile them.
* doc/website/mainpage.txt: Add instruction about how to build
tarballs.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Until now, added and removed base classes were not sorted in class
change reports. This causes differences change reports when running
the tests on different platorms. This patch fixes that.
* src/abg-comparison.cc (sort_string_base_diff_sptr_map): Define
new static function.
(struct base_spec_comp): Define new type.
(class_diff::priv::sorted_{deleted,inserted}_bases_): New data
members.
(class_diff::ensure_lookup_tables_populated): Sort the deleted and
inserted base classes.
(class_diff::report): Use the sorted set of deleted/inserted base
classes in the report.
* 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.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
My commit "5a8c000 Bug 19355 - Libabigail slow on r300_dri.so"
introduced a faster way of getting the logical parent of a DIE, when
one of its ancestor DIEs has been imported into a the current
translation unit.
But then that commit broke the support for alternate debug info
files. Oops.
This commit brings back the support for alternate debug info files.
* src/abg-dwarf-reader.cc
(imported_unit_point::imported_unit_from_alt_di): New data member.
(imported_unit_point::imported_unit_point): Adjust.
(read_context::alt_tu_die_imported_unit_points_map_): New data
member.
(read_context::alt_tu_die_imported_unit_points_map): New accessor.
(die_die_attribute): Remove the overload which doesn't say if the
resulting DIE comes from alternate debug info.
(build_die_parent_relations_under): Take a new flag which says if
we are building the relations about DIEs in the alternate debug
info section or not. Use that flag to know if the imported unit
trace we are building is for an alternate debug info file or not.
(build_die_parent_maps): Build two different imported unit point
trace vectors: one for the main debug info file, and another one
for the alternate debug info file.
(find_import_unit_point_between_dies): Take a flag that says if
the beginning of the search is a DIE in the alternate debug info
file or not. Use it to know if we should use the import point
trace vectors from alternate debug info or from the main debug
info file. When the import point trace vector is empty, return
immediatly.
(get_parent_die): If the parent DIE is a DW_TAG_partial_unit which
hasn't been imported into this TU, then assume the logical parent
is the DIE for the current translation unit.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
Reference test output.
* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64.rpm: New
input test rpm.
* tests/data/test-diff-pkg/tbb-4.3-3.20141204.fc23.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/tbb-debuginfo-4.1-9.20130314.fc22.x86_64.rpm:
Likewise.
* tests/data/test-diff-pkg/tbb-debuginfo-4.3-3.20141204.fc23.x86_64.rpm:
Likewise.
* tests/data/Makefile.am: Add the new test materials to the source
distribution.
* tests/test-diff-pkg.cc (int_out_specs): Add the new rpms to the
list of rpms to test against.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
abidw -v was failing to work until now. This patch fixes that.
* tools/abidw.cc (parse_command_line): Simplify logic.
(main): Fix logic.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Profiling abidw --abidiff r300_dri.so, with a r30_dri.so that was run
through dwz shows that a great deal of the time is spent in trying to
get the logical parent of a DIE which has been imported.
To do that, we need to walk the translation unit DIEs again to know
where the DIE we are looking at has been imported. And doing that
walking again and again, following the accessors of the DIE data
structure from elfutils takes time.
This patch reduces that time by constructing a "trace" of where units
have been imported. So that looking for the logical parent of a given
DIE doesn't involve walking the DIE tree itself, but rather, walking
the trace, which is a vector. This proves to be much faster.
In practice, the overall time spent is now less than 12 minutes. It
was more than 50 minutes before.
* src/abg-dwarf-reader.cc (struct imported_unit_point): Define new
type.
(operator<(const imported_unit_point&, const
imported_unit_point&)): Define less-than operator for new
imported_unit_point& type.
(imported_unit_points_type, tu_die_imported_unit_points_map_type):
New typedefs.
(find_lower_bound_in_imported_unit_points): Define new static function.
(read_context::tu_die_imported_unit_points_map_): New data member.
(read_context::tu_die_imported_unit_points_map): New getter.
(die_die_attribute): Define new overload.
(build_die_parent_relations_under): Take imported_unit_points_type
output parameter and populate it along the way. Remove the
overload that takes a read_context as a parameter.
(build_primary_die_parent_relations_under)
(build_alternate_die_parent_relations_under): Remove.
(build_die_parent_maps): Pass an instance of
imported_unit_points_type to build_die_parent_relations_under.
(find_import_unit_point_between_dies): Rename one overload of
find_last_import_unit_point_before_die into this. Adjust to make
it find the import point between two offsets.
(find_import_unit_point_before_die): Rename the other overload of
find_last_import_unit_point_before_die into this. Adjust to use
find_import_unit_point_between_dies.
(get_parent_die): Adjust to use find_import_unit_point_before_die.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Sometimes, two different variables A and B can have the same underlying
symbol, when for instance A is a reference that is initialized with
the address of B.
Until now, that was not supported by libabigail's ABI corpus. Only
one (either A or B) variable is kept. This is because the ID of the
variable, as returned by abigail::var_decl::get_id() is made of the
symbol name of the variable only.
This patch fixes the issue by including the name of the variable in
the ID.
* src/abg-ir.cc (var_decl::get_id()): Include the name of the
variable in the ID.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When looking at bug
https://sourceware.org/bugzilla/show_bug.cgi?id=19355, it appears that
some class have the same base class more than once.
Here is why.
Sometime in the DWARF, a given class is declared briefly, and then
later, it's amended. Sometimes, when the class is updated, the debug
info contains redundant information, like base classes that were
previously expressed, and which are expressed again in the updated
version of the class. The DWARF reader needs to not add that
duplicated information.
It appears the DWARF reader fails to recognize redundant base class
specifiers. The native xml reader which is supposed to recognize
those, has some logic error that prevents it from working correctly.
This patch fixes both the DWARF and native xml readers.
The patch has no test because the r300_dri.so binary is really big and
still takes too much time to process, for it to be a practical
candidate for the regression test suite.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This is useful for big debug info data set. Also, this function is
going to be used extensively in subsequent patch that fixes a base
class representation related issue.
* src/abg-ir.cc (class_decl::priv::bases_map_): New data member.
(class_decl::add_base_specifier): Add the new base specifier to
the new class_decl::priv::bases_map_ data member.
(class_decl::find_base_class): Use the new
class_decl::priv::bases_map_ data member to speed up finding the
base class.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (class_decl::base_spec::priv): Declare new
private data type.
(class_decl::base_spec::priv_): Declare new pimpl data member.
(class_decl::base_spec::{base_class_, offset_in_bits_,
is_virtual_}): Remove.
(class_decl::base_spec::{get_base_class, get_is_virtual,
get_offset_in_bits}): Make these member functions out of line.
* src/abg-ir.cc (struct class_decl::base_spec::priv): New type.
(class_decl::base_spec::{get_base_class, get_is_virtual,
get_offset_in_bits}): Define these functions here.
(class_decl::base_spec::base_spec): Adjust because now there is
only one pimpl data member to initialize.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* bash-completion/abicompat: Complete the new "--no-show-locs" option.
* bash-completion/abidiff: Likewise.
* bash-completion/abidw: Likewise.
* bash-completion/abipkgdiff: Likewise.
* doc/manuals/abicompat.rst: Mention the new "--no-show-locs" option.
* doc/manuals/abidiff.rst: Likewise.
* doc/manuals/abidw.rst: Likewise.
* doc/manuals/abipkgdiff.rst: Likewise.
* include/abg-comparison.h (show_locs): Add declarations.
* src/abg-comparison.cc: (diff_context::priv): Add a new switch
called "show_locs_" and set its default value to false.
(report_loc_info): New function. Outputting the extra information
is conditionalized based on the associated diff contexts settings.
(show_locs): define a getter/setter for
diff_context::priv::show_locs_.
({distinct,pointer,reference,qualified_type,enum,class,scope,fn_parm,
typedef,corpus}_diff::report): Call report_loc_info when
appropriate.
(maybe_report_diff_for_member): Likewise.
(represent): Accept a const reference to a diff_context_sptr as a first
argument and call report_loc_info on its second argument.
* src/abg-dwarf-reader.cc:
* tests/data/Makefile.am: Add the new test reference files.
* tests/data/test-abicompat/test0-fn-changed-report-2.txt: New test
reference output.
* tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test6-var-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test7-fn-changed-report-2.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
Likewise.
* tests/data/test-diff-pkg/dirpkg-3-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Likewise.
* tests/test-abidiff.cc: Explicitly create a diff context and turn off
location emitting.
* tests/test-diff-dwarf.cc: Likewise.
* tests/test-abicompat.cc: Add --no-show-locs to all existing test
arguments. Run a few of the existing tests again, but without this
option.
* tests/test-diff-filter.cc: Likewise.
* tests/test-diff-pkg.cc: Likewise.
* tests/test-diff-suppr.cc: Likewise.
* tools/abicompat.cc: Handle the new "--no-show-locs" option.
* tools/abidiff.cc: Likewise.
* tools/abidw.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* src/abg-ir.cc: (location_manager::expand_location): Fix a factual
error in the function documentation.
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
The structural comparison of declaration-only class_decl has show up
high on performance profiles while running abidw --abidiff on the
r300_dri.so binary.
The class_decl::get_is_declaration_only() function seems to be used
too many times. The copying of the qualified name of the class_decl
showed up too. Also, it looks like that the != operator on string is
slightly slower than than the == operator; OK, this is while looking
at a binary without optimizations, but still.
So the patch addresses the specific issues above.
* src/abg-ir.cc (equals): In the overload for class_decl, avoid
calling class_decl::get_is_declaration_only() several times.
Avoid copying the qualified name of the class_decl. Also, use the
== operator to compare strings, rather than the != one.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Performance profiling has shown that accessing shared_ptr to canonical
types and function type during type comparison was noticeable slowing
down the process. This patch thus access naked pointers for canonical
types and function types at these performance hot spots.
The profiling took place while running abidw --abidiff on the
r300_dri.so binary.
* include/abg-ir.h (type_base::get_naked_canonical_type): Declare
new accessor.
(function_decl::get_naked_canonical_type): Likewise.
(function_decl::set_type): Pass a reference to the shared_ptr.
* src/abg-ir.cc (type_base::priv::naked_canonical_type): New data
member.
(type_base::priv::priv): Initialize it.
(canonicalize): Set the naked canonicalize type when we set its
shared pointer.
(type_base::get_naked_canonical_type): Define new accessor.
({pointer_type_def,reference_type_def,function_type,class_decl}::operator==):
Use naked canonical pointers rather than the slower shared_ptr to
canonical pointers.
(function_decl::priv::naked_type_): New data member.
(function_decl::priv::priv): Initialize it.
(function_decl::get_naked_type): Define new accessor.
(function_decl::set_type): Pass a reference to the shared_ptr .
(equals): In the overload for function_decl, use the faster naked
pointers to the type of the function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The private data pointers of libabigail IR types are usually managed
using shared_ptr. But performance profiling has shown that
de-referencing some of these private data shared_ptr can have a
noticeable performance impact. This is because de-referencing
shared_ptr involves some locking that show up on some performance
profile.
So, for decl_base, type_base, and function_decl, this patch replaces
the private data shared pointers by naked pointers. This speeds up
the access to private data members, especially during comparison of
class pointer, reference and function types. And that has a
noticeable impact when libabigail handles huge binaries with lots of
functions an type, like r300_dri.so.
* include/abg-ir.h ({decl_base, type_base, function_decl}::priv_)
Make this a naked pointer to priv, rather than a shared_ptr<priv>.
* src/abg-ir.cc (decl_base::~decl_base): Destroy the private data
pointer, aka pimpl pointer.
(type_base::~type_base): Likewise.
(function_decl::~function_decl): Likewise.
(class_decl::~class_decl): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Suppose a declaration D (which locus is in a file F) is imported at an
offset offset of O1 into a compilation unit C1 and at an offset O2
(using DW_TAG_imported_unit) into a compilation unit C2.
When the DWARF reader creates the ABI artifact for D in O1, its
location is encoded by a location manager that is handled by C1.
At O2 (in C2) the ABI artifact for D (created at O1, in C1) is
re-used. But then, to decode the location of D, the DWARF reader
wrongly uses the location manager that is handled by C2. It should
use the location manager of C1, because that is the one used to encode
the location of D.
It picks the wrong location manager because it picks the wrong
translation unit for D. Right now, the translation unit for a given
declaration is the "current" translation unit at the moment the DIE
was being inspected. And that is wrong when imported type units kick
in.
1/ More generally, each ABI artifact should be associated with its
translation unit, which is the current translation unit when the
artifact was created. As there is just one copy of D, its translation
unit should always be the same.
2/ Also, the location should ensure that about the location manager used
to encode it is the same one used to decode it, so that this kind of
bug cannot arise.
This patch fixes the issue by doing 1/ and 2/. The r300_dri.so test
case on which is was failing is not added to the test suite because
it's too big. It was taking more than 55 minutes to have complete
abidw --abidiff complete on that binary, on my machine. So I am going
to work on the performance side of things, I think.
* include/abg-ir.h (class location_manager): Forward declare it
before class location.
(location::loc_manager_): New data member.
(location::location): Take the location manager in one overload
and initialize the new loc_managers_ in all the overloads.
(location::get_location_manager): New getter.
(location::expand): New member function.
(location::*): Add API doc to all entry points.
(location_manager::expand_location): Take a const location.
(type_or_decl_base::set_corpus): Remove.
(type_or_decl_base::{get,set}_translation): New accessors.
(decl_base::{decl_base,get_location}): Take or return a reference
on location.
(scope_decl::scope_decl): Likewise.
(type_decl::type_decl): Likewise.
(namespace_decl::namespace_decl): Likewise.
(qualified_type_def::qualified_type_def): Likewise.
(pointer_type_def::pointer_type_def): Likewise.
(reference_type_def::reference_type_def): Likewise.
(array_type_def::subrange_type::{subrange_type,
get_location}): Likewise.
(enum_type_decl::enum_type_decl): Likewise.
(typedef_decl::typedef_decl): Likewise.
(var_decl::var_decl): Likewise.
(function_decl::function_decl): Likewise.
(function_decl::parameter::parameter): Likewise.
(template_decl::template_decl): Likewise.
(type_tparameter::type_tparameter): Likewise.
(non_type_tparameter::non_type_tparameter): Likewise.
(function_tdecl::function_tdecl): Likewise.
(class_tdecl::class_tdecl): Likewise.
(class_decl::class_decl): Likewise.
(class_decl::method_decl::method_decl): Likewise.
* src/abg-ir.cc (location::expand_location): Define new member
function.
(type_or_decl_base::priv::corpus_): Remove.
(type_or_decl_base::priv::translation_unit_): New data member.
(type_or_decl_base::priv::priv): Adjust.
(type_or_decl_base::set_corpus): Remove.
(type_or_decl_base::get_corpus): Adjust.
(type_or_decl_base::{get,set}_translation_unit): New member
functions.
(decl_base::priv::priv): Take a reference to location.
(decl_base::decl_base): Likewise.
(decl_base::get_location): Return a reference to location.
(location_manager::create_new_location): Adjust.
(location_manager::expand_location): Take a reference to location.
(translation_unit::get_global_scope()): Adjust.
(translation_unit::bind_function_type_life_time): Likewise.
(scope_decl::{add,insert}_member_decl): Adjust.
(get_translation_unit): Likewise.
(type_decl::type_decl): Take a reference to location.
(namespace_decl::namespace_decl): Likewise.
(qualified_type_def::qualified_type_def): Likewise.
(pointer_type_def::pointer_type_def): Likewise.
(reference_type_def::reference_type_def): Likewise.
(array_type_def::subrange_type::priv::priv): Likewise.
(array_type_def::subrange_type::{subrange_type,
get_location}): Likewise.
(enum_type_decl::enum_type_decl): Likewise.
(typedef_decl::typedef_decl): Likewise.
(var_decl::var_decl): Likewise.
(function_decl::function_decl): Likewise.
(function_decl::parameter::parameter): Likewise.
(template_decl::template_decl): Likewise.
(type_tparameter::type_tparameter): Likewise.
(non_type_tparameter::non_type_tparameter): Likewise.
(function_tdecl::function_tdecl): Likewise.
(class_tdecl::class_tdecl): Likewise.
(class_decl::class_decl): Likewise.
(class_decl::method_decl::method_decl): Likewise.
* src/abg-writer.cc (write_location): Take a reference to
location and adjust.
(write_array_type_def, write_function_decl, dump_decl_location):
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Suppose we have tree types which have the same name A. The first A
comes from a binary B1 and the two others come from a binary B2.
Let's call them A{B1}{1}, A{B2}{1} and A{B2}{2}.
Suppose A{B1}{1} is different from A{B2}{1} (but both types are
compatible), just because one of their sub-types are different but are
compatible. So A{B1}{1} and A{B2}{1} are canonically different; they
have different canonical types.
But then, because of the One Definition Rule (ODR), A{B2}{1} and
A{B2}{2} are canonically equal. But then let's suppose that A{B2}{2}
is structurally equal to A{B1}{1}. So this implies that A{B1}{1} and
A{B2}{2} are canonically different, while being structurally equal.
Odd, but not impossible. I noticed this while comparing the two
versions of libgromacs_d.so.0.0.0 involved in the comparison
referenced by bug https://bugzilla.redhat.com/show_bug.cgi?id=1283906.
But then that library is too big (and takes too much time) to be
included as a non regression test :(
Anyway, this patch detects this glitch and categorizes it so that the
resulting ABI change reports are filtered out. Otherwise, this is
considered as an ABI change (because of the canonical different), for
which the reporter fails to provide details (because of the structural
equality).
* src/abg-comp-filter.cc
(class_diff_has_harmless_odr_violation_change): New static
function.
(harmless_filter::visit): Call it.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Internal names (and pretty representation) of types are used for type
canonicalization. These were not being correctly computed for
pointers typedefs and arrays because we were forgetting sometimes to
use internal names of the underlying types, especially because of caching issues.
This patch addresses that.
Note that I noticed this while comparing the two versions of
libgromacs_d.so.0.0.0 involved in the comparison referenced by bug
https://bugzilla.redhat.com/show_bug.cgi?id=1283906. But then that
library is too big (and takes too much time) to be included as a non
regression test :(
* include/abg-ir.h (pointer_type_def::priv_): New data structure.
The type is now pimpled.
(typedef_decl::priv_): Likewise.
* src/abg-ir.cc (struct pointer_type_def::priv): New struct.
(pointer_type_def::pointer_type_def): Adjust.
(pointer_type_def::get_pointed_to_type): Likewise.
(pointer_type_def::get_qualified_name): Store temporary/internal
names into different caches.
(array_type_def::priv::{temp_internal_qualified_name_,
internal_qualified_name_}): New data members.
(get_type_representation): In the overload for array_type_def,
take requests for internal names into account.
(array_type_def::get_qualified_name): Take requests for internal
names into account. Store temporary/internal names into different
caches.
(typedef_decl::priv): New struct.
(typedef_decl::typedef_decl): Adjust.
(typedef_decl::get_underlying_type): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (qualified_type_diff::has_changes): Make
this stupid and simple, now that we have (fast) canonical type
based comparison.
* include/abg-ir.h (qualified_type_diff::operator==): Add an
overload for qualified_type_diff here.
(operator==): Likewise.
* src/abg-ir.cc (qualified_type_diff::operator==): Define it.
(operator==): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Sometimes we can see const references in DWARF. But then, a reference
is always const, so that qualified reference is redundant.
Furthermore, having that construct make its way into the internal
representation can cause awkward diagnostics.
The DWARF reader was thus eliding such redundant qualifiers in the
function "maybe_strip_qualification". It was doing so by stripping
the qualifier from the qualified type. So const reference, for
instance, becomes a (non-qualified) reference. In that case, we are
turning a qualified type into a non-qualified one.
But as the accompanying problem report suggests, this can cause issues
during the DWARF parsing. This is because a given Debug Information
Entry (DIE) of qualified type kind can be referenced elsewhere, by
another type. That other type expects that DIE to be a qualified
type. And libabigail's DWARF reader code enforces that. So the
internal representation of a type resulting from a qualified type DIE
must be a qualified type itself.
So the way the function "maybe_strip_qualification" was doing the
redundancy elision was wrong. This patch fixes that by keeping the
type qualified, but introducing a "no-op" qualifier. Actually, the IR
already has that "no-op" qualifier: abigail::ir::qualified_type_def::CV_NONE.
So now "maybe_strip_qualification" just turns the CV_CONST qualifier
into a CV_NONE one when the former is redundant.
Now that the libabigail type system actually *has* types qualified
with this no-op qualifier, we need to handle things like printing the
name of such qualified types. When we are printing the name of the
type for internal reasons (i.e, for type canonicalization purposes) we
need to make a difference between the name of a no-op qualified type
and the name of the underlying type of the qualified type, otherwise,
the canonicalizer wrongly considers the two types as being equal. But
then when we are printing the name of the no-op qualified type for
diagnostics reasons, then the name is the same as the name of its
underlying unqualified type.
* src/abg-dwarf-reader.cc (maybe_strip_qualification): Do not nuke
the qualified type. Rather, just turn the redundant const
qualifier into a no-op one.
* src/abg-comparison.cc (compute_diff_for_types): Look through
no-op qualified types.
* include/abg-ir.h
(decl_base::{peek,set}_temporary_qualified_name): Declare new
accessors.
* src/abg-ir.cc (decl_base::priv::temporary_qualified_name_): New
data member.
(decl_base::{peek,set}_temporary_qualified_name): Define new
accessors.
(qualified_type_def::priv::{temporary_internal_name_,
internal_name}): New data members.
(qualified_type_def::build_name): For a no-op qualified type, the
internal name (which contains the 'none' qualifier) is different
from the non-internal name.
(qualified_type_def::get_qualified_name): Handle temporary names
and non-temporary names in two different caches. Also handle
internal and non-internal names in two different caches. This
makes four different caches.
(qualified_name_setter::do_update): Do not touch the non-internal,
non-temporary qualified name cache if the qualified parent name is
empty.
* tools/abidw.cc (main): change --check-alternate-debug-info to
make it *not* display the name/path to the alternate debug info,
when it's found. Rather, only
--check-alternate-debug-info-base-name keeps displaying the base
name of the alternate debug info.
* tests/data/test-alt-dwarf-file/test1-libgromacs-debug-dir/*: New
test material.
* tests/data/Makefile.am: Add the new test material to the build
system.
* tests/test-alt-dwarf-file.cc (in_out_specs): Take the new test
input into account.
* tests/data/test-read-dwarf/test1.abi: Adjust.
* tests/data/test-read-dwarf/test7.so.abi: Likewise.
* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/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/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When peeling off typedefs, references and pointers to see if a type is
made of a class type, we forget to peel qualified types off.
This is in the context of parsing type info from DWARF and to
determine if we should delay type canonicalization (because a given
type is made of a class) or not.
Fixed thus.
* include/abg-fwd.h (peel_qualified_type): Declare new function
...
* src/abg-ir.cc (peel_qualified_type): ... and define it.
(peel_typedef_pointer_or_reference_type): Peel qualified types
here too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While looking at something else, I stumbled across spots where we
forget to discriminate between internal and non-internal type names.
This can lead to two types (that are equivalent) to be considered as
being different just because one is based on a struct foo, and the
other one is based on a class foo.
Fixed thus.
* src/abg-ir.cc (get_type_name, get_method_type_name)
({typedef_decl,var_decl,function_decl,class_decl}::get_pretty_representation):
Propagate the internal-ness to the call to get_qualified_name().
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (is_qualified_type): Make this take a const
parameter.
* src/abg-ir.cc (is_qualified_type): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
When given a package which has no binary to compare, abipkgdiff
aborts. This patch fixes that.
* tests/data/test-diff-pkg/empty-pkg-libvirt-0.9.11.3-1.el7.ppc64.rpm:
New input test package.
* tests/data/test-diff-pkg/empty-pkg-libvirt-1.2.17-13.el7_2.2.ppc64.rpm:
Likewise.
* tests/data/test-diff-pkg/empty-pkg-report-0.txt: New test
reference output.
* data/Makefile.am: Add the new test material above to the build system.
* tests/test-diff-pkg.cc (int_out_specs): Add the new test inputs
to the set of tests.
* tools/abipkgdiff.cc (compare): Do not abort if there is no
binary to compare.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Make sure to read enum values in the widest possible integer (size_t)
but write them (in abixml writer) using a signed type to ease
comparison.
This makes the runtestreaddwarf pass on 32 bit x86, because we were
losing some precision reading enum values using a signed integer.
* include/abg-ir.h (enum_type_def::enumerator::get_value): Return
a size_t.
* src/abg-ir.cc (enum_type_decl::enumerator::get_value): Likewise.
* src/abg-dwarf-reader.cc (die_signed_constant_attribute): #if-out
this static function that is not used anymore.
(build_enum_type): Read the value of the enumerator using a size_t
value.
* src/abg-reader.cc (build_enum_type_decl): Read the enum value
using a long long int.
* src/abg-writer.cc (write_enum_type_decl): Write using a ssize_t.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
g++ 4.4.7 of el6 does not support designated initializers, so
libabigail fails to build on el6 for that reason.
* tools/abipkgdiff.cc (prepare_packages): Do not use designated
initializers syntax.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>