Improve self-comparison debug mode
authorDodji Seketeli <dodji@redhat.com>
Wed, 19 Apr 2023 12:29:13 +0000 (14:29 +0200)
committerDodji Seketeli <dodji@redhat.com>
Tue, 25 Apr 2023 13:50:25 +0000 (15:50 +0200)
commit95abd39b5d23cac486518e9cae46b36207ea6e7b
treeb622748f2f4faedd533cef3626e289473b4f4924
parentbfb7ccb372788a1214d868ea07a5bcee6fccb515
Improve self-comparison debug mode

When looking at debugging some self-comparison difference errors, I
felt the need to improve the debugging support for self-comparison
(triggered by 'abidw --debug-abidiff <binary>').

This patch fixes some typos in the existing diagnostics emitted by the
self-comparison debugging mode and improves the detection of a change
in a canonical type value between a type that is serialized to abixml,
and the same type that is de-serialized from abixml.  This later check
is now performed during the process of handling canonical type
propagation when confirming/canceling (speculatively) propagated
canonical types.  It's useful to find problems in that process of
confirming/canceling.

* include/abg-ir.h
(environment::{get_type_id_canonical_type_map}): Const-ify the
existing member function and add non-const overloads.
(environment::{get_type_id_from_pointer,
get_canonical_type_from_type_id}): Const-ify.
(environment::get_pointer_type_id_map): Add new member function.
* src/abg-ir-priv.h
(environment::priv::{confirm_ct_propagation_for_types_dependant_on,
confirm_ct_propagation}): Call
check_abixml_canonical_type_propagation_during_self_comp() here.
(environment::priv::{get_type_id_canonical_type_map,
get_pointer_type_id_map, get_type_id_from_pointer,
get_type_id_from_type, get_canonical_type_from_type_id,
check_abixml_canonical_type_propagation_during_self_comp}): Add
new member functions.
* src/abg-ir.cc (return_comparison_result): Call
check_abixml_canonical_type_propagation_during_self_comp on every
single type with non confirmed propagated canonical type.
(environment::{get_type_id_canonical_type_map,
get_pointer_type_id_map, get_type_id_from_pointer,
get_type_id_from_type, get_canonical_type_from_type_id}): Delegate
to the new implementations that are now member functions of
environment::priv.
(type_base::get_canonical_type_for): Fix typo in diagnostics when
debugging self-comparison. Add more context.
* src/abg-reader.cc
(abixml::reader::maybe_check_abixml_canonical_type_stability):
Likewise.
* src/abg-writer.cc (write_type_record): Do not try to get abixml
type-id for a type (originating from the DWARF) that has no
canonical type, otherwise, that /can/ introduce a gap in the
type-ids as those can turn out not being emitted in the abixml
after all.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-ir.h
src/abg-ir-priv.h
src/abg-ir.cc
src/abg-reader.cc
src/abg-writer.cc
tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt