libabigail/src
Dodji Seketeli ff8cba872e dwarf-reader: Support indirectly referenced subrange_type DIEs
This is about supporting an Ada-induced DWARF construct related to
ranged types.

To reproduce the issue this patch originated from, you can type:

    $ fedabipkgdiff --self-compare -a --from fc37 gprbuild

From that gprbuild package from fc37, consider this subrange_type DIE
coming from the debuginfo file prtests/gprbuild-2020-11.fc37.aarch64:

     1	 [ 3c10d]        subrange_type        abbrev: 34
     2	                 type                 (ref_addr) [ 6191e]
     3	                 lower_bound          (sdata) 2
     4	                 upper_bound          (ref_udata) [ 3c0eb]

At line 4, look at how the DW_AT_upper_bound attribute is a reference
to another DIE, instead of being a (signed) constant value, like the
DW_AT_lower_bound attribute at line 3.  The referenced DIE is at
offset 0x3c0eb.

How do we get the actual value of the upper_bound of that subrange
type?

To answer that question, let's look at the DIE, at offset 0x3c0eb that
is referenced by the DW_AT_upper_bound attribute at line 4:

     1	 [ 3c0eb]      member               abbrev: 87
     2	               name                 (strp) "last"
     3	               decl_file            (data1) a-coinve.ads (35)
     4	               decl_line            (data2) 415
     5	               decl_column          (data1) 24
     6	               type                 (ref_udata) [ 3c0f7]

It's a data member which type is referenced at line 6.  Let's look at
that type, which offset is 0x3c0f7:

     1	 [ 3c0f7]      subrange_type        abbrev: 122
     2	               upper_bound          (sdata) 99999999
     3	               name                 (strp) "gpr__names__name_vectors__T449bXn"
     4	               type                 (ref_addr) [ 6191e]
     5	               artificial           (flag_present) yes

That type is a DW_TAG_subrange_type and its DW_AT_upper_bound value is
a constant.  Finally.

Actually, the value of DW_AT_upper_bound of this DIE at offset 0x3c0f7
is the value of the DW_AT_upper_bound of the subrange_type DIE at
offset 0x3c10d that we were initially looking for.

The DIE at 0x3c0f7 is said to be indirectly referenced by the DIE at
0x3c10d, through its DW_AT_upper_bound attribute.

This patch supports retrieving the value of the DW_AT_upper_bound of
0x3c10d through the 0x3c0f7 DIE that it indirectly references.

The package gprbuild from fc37 now passes self comparison with this patch.

	* src/abg-dwarf-reader.cc (subrange_die_indirect_bound_value)
	(subrange_die_indirectly_references_subrange_die): Define new
	static function.
	(build_subrange_type): If the value of DW_AT_upper_bound is not a
	constant, try to consider it as an indirect reference to a
	DW_TAG_subrange_type DIE, whose DW_AT_upper_bound might carry the
	constant value that we are looking for.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2023-04-07 13:27:57 +02:00
..
abg-btf-reader.cc btf-reader: Use abigail::ir::canonicalize_types to canonicalize types 2023-01-07 01:15:28 +01:00
abg-comp-filter.cc comp-filter: Speed up harmless/harmful categorization 2023-03-02 18:31:43 +01:00
abg-comparison-priv.h Bug 29340 - Add support for Ada range types 2023-03-31 23:14:01 +02:00
abg-comparison.cc Fix redundancy filtering of range types 2023-03-31 23:14:01 +02:00
abg-config.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-corpus-priv.h Bug 29912 - Better support an ELF symbol alias that designates several functions 2023-03-20 15:16:57 +01:00
abg-corpus.cc Bug 29912 - Better support an ELF symbol alias that designates several functions 2023-03-20 15:16:57 +01:00
abg-ctf-reader.cc suppression: Support offset_of_{first,last}_data_member_regexp offset selectors 2023-03-02 18:18:37 +01:00
abg-default-reporter.cc Fix redundancy filtering of range types 2023-03-31 23:14:01 +02:00
abg-diff-utils.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-dwarf-reader.cc dwarf-reader: Support indirectly referenced subrange_type DIEs 2023-04-07 13:27:57 +02:00
abg-elf-based-reader.cc {dwarf,elf_based}-reader,writer: Avoid duplicating corpora in corpus_group 2023-02-02 12:08:02 +01:00
abg-elf-helpers.cc suppression: Support offset_of_{first,last}_data_member_regexp offset selectors 2023-03-02 18:18:37 +01:00
abg-elf-helpers.h Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-elf-reader.cc Bug 29692 - Support binaries with empty symbol table 2023-03-22 15:32:10 +01:00
abg-fe-iface.cc Bug rhbz#2182807 -- abipkgdiff crashes on missing debuginfo package 2023-04-03 17:01:44 +02:00
abg-hash.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-ini.cc ini: Fix parsing list property values 2023-03-01 13:20:03 +01:00
abg-internal.h Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-ir-priv.h Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-ir.cc dwarf-reader: Support Ada subranges having upper_bound < lower_bound 2023-04-05 16:54:32 +02:00
abg-leaf-reporter.cc Fix redundancy filtering of range types 2023-03-31 23:14:01 +02:00
abg-libxml-utils.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-reader.cc reader: Make reader::get_scope_for_node handle subranges at array scope. 2023-04-05 17:01:48 +02:00
abg-regex.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-reporter-priv.cc Bug 29340 - Add support for Ada range types 2023-03-31 23:14:01 +02:00
abg-reporter-priv.h Bug 29340 - Add support for Ada range types 2023-03-31 23:14:01 +02:00
abg-suppression-priv.h Misc white space fixes 2023-03-02 18:31:43 +01:00
abg-suppression.cc Misc white space fixes 2023-03-02 18:31:43 +01:00
abg-symtab-reader.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-symtab-reader.h Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-tools-utils.cc Bug 29340 - Add support for Ada range types 2023-03-31 23:14:01 +02:00
abg-traverse.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-viz-common.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-viz-dot.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-viz-svg.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-workers.cc Update copyright year for 2023 2023-01-01 18:19:30 +01:00
abg-writer.cc dwarf-reader: Support Ada subranges having upper_bound < lower_bound 2023-04-05 16:54:32 +02:00
Makefile.am Add support for BTF 2023-01-06 21:05:53 +01:00