mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-14 05:54:50 +00:00
84ec784743
In this problem report, the DWARF reader comes across an ADA subrange which lower bound is a negative signed integer. The problem is that the internal representation of libabigail expects the bounds of the subrange to be unsigned integer. This incompatibility leads to an assertion failure. Further down the road I realized that the function types_have_similar_structure doesn't support subrange types. This patch thus introduces a new array_type_def::subrange_type::bound_value class that captures the signedness of the bound value. This allows the internal representation to keep the sign information of the bound value, and yet be able to treat the bound value as either a signed or unsigned value depending on the contexts. The patch also extends the function types_have_similar_structure to make it support subrange types. * include/abg-ir.h (array_type_def::subrange_type::bound_value): Define new class. (array_type_def::subrange_type::subrange_type): Adjust to use the new bound_value type for bound values. (array_type_def::subrange_type::{get_upper_bound, get_lower_bound, set_upper_bound, set_lower_bound}): Return or take int64_t rather than size_t. (array_type_def::subrange_type::get_length): Return uint64_t rather than size_t. * src/abg-dwarf-reader.cc (die_signed_constant_attribute) (die_constant_attribute, die_attribute_has_form) (die_attribute_is_signed, die_attribute_is_unsigned) (die_attribute_has_no_signedness): Define new static functions. (get_default_array_lower_bound): Return uint64_t rather than int. (build_subrange_type): Use the new array_type_def::subrange_type::bound_value type for bound values. Use the new die_constant_attribute function, rather than die_unsigned_constant_attribute to fecth the bound values. * src/abg-ir.cc (array_type_def::subrange_type::bound_value::{bound_value, get_signedness, set_signedness, get_signed_value, get_unsigned_value, set_unsigned, set_signed}): Define new member functions. (array_type_def::subrange_type::priv::{lower_bound_, upper_bound}): Use the new class bound_value. (array_type_def::subrange_type::priv::priv): Adjust to use the new bound_value class to hold bound values. (array_type_def::subrange_type::subrange_type): Likewise. (array_type_def::subrange_type::{get_upper_bound, get_lower_bound, set_upper_bound, set_lower_bound}): Return or take int64_t rather than size_t. (array_type_def::subrange_type::get_length): Return uint64_t rather than size_t. (types_have_similar_structure): Handle array_type_def::subrange_type * src/abg-reader.cc (build_subrange_type): Use the new array_type_def::subrange_type::bound_value to hold bound values. * tests/data/test-diff-pkg/GtkAda-debuginfo-2.24.2-29.fc29.x86_64.rpm: New binary RPM as test input. * tests/data/test-diff-pkg/GtkAda-debuginfo-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-devel-2.24.2-29.fc29.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-devel-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt: New expected test output. * tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64.rpm: New binary RPM as test input. * tests/data/test-diff-pkg/GtkAda-gl-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-29.fc29.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the new input testing RPMs in here. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
3.0 MiB
3.0 MiB