diff options
author | Joel Brobecker <brobecker@adacore.com> | 2014-11-20 12:10:41 +0400 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2014-11-20 13:43:50 +0400 |
commit | 005e2509a167c05719df3a3edd966865110a5052 (patch) | |
tree | 612469b50576b31a40b191fe1e087b4b21812999 /bfd | |
parent | 9274e9de160a98d737bb2bd068c22d37ec66d98d (diff) | |
download | gdb-005e2509a167c05719df3a3edd966865110a5052.zip gdb-005e2509a167c05719df3a3edd966865110a5052.tar.gz gdb-005e2509a167c05719df3a3edd966865110a5052.tar.bz2 |
[Ada] XA type is not redundant if the ranges' subtypes do not match
Jan noticed that gdb.ada/arrayidx.exp regressed after I applied
the following patch:
commit 8908fca5772fcff9f7766158ba2aa59f5a2b1f68
Author: Joel Brobecker <brobecker@adacore.com>
Date: Sat Sep 27 09:09:34 2014 -0700
Subject: [Ada] Ignore __XA types when redundant.
What happens is that we're trying to print the value of
r_two_three, which is defined as follow:
type Index is (One, Two, Three);
type RTable is array (Index range Two .. Three) of Integer;
R_Two_Three : RTable := (2, 3);
The expected output is:
(gdb) p r_two_three
$1 = (two => 2, 3)
But after the patch above was applied, with the program program
compiled using gcc-gnat-4.9.2-1.fc21.x86_64 (x86_64-linux),
the output becomes:
(gdb) p r_two_three
$1 = (2, 3)
(the name of the first bound is missing). The problem comes from
the fact that the compiler described the array's index type as
a plain base type, instead of as a subrange of the enumerated type.
More particularly, this is what gcc-gnat-4.9.2-1.fc21.x86_64
generated:
<3><7ce>: Abbrev Number: 9 (DW_TAG_array_type)
<7cf> DW_AT_name : (indirect string, offset: 0xc13): p__rtable
[...]
<7d7> DW_AT_GNAT_descriptive_type: <0x98a>
[...]
<4><7df>: Abbrev Number: 8 (DW_TAG_subrange_type)
<7e0> DW_AT_type : <0xa79>
where DIE 0xa79 is:
<1><a79>: Abbrev Number: 2 (DW_TAG_base_type)
<a7a> DW_AT_byte_size : 8
<a7b> DW_AT_encoding : 7 (unsigned)
<a7c> DW_AT_name : (indirect string, offset: 0xfc): sizetype
The actual array subrange type can be found in the array's
parallel XA type (the DW_AT_GNAT_descriptive_type).
The recent commit correctly found that that bounds taken from
the descriptive type are the same as bounds of our array's index
type. But it failed to notice that ignoring this descriptive
type would make us lose the actual array index type, making us
think that we're printing an array indexed by integers.
I hadn't seen that problem, because the compiler I used produced
debugging info where the array's index type is correctly described:
<3><79f>: Abbrev Number: 10 (DW_TAG_array_type)
<7a0> DW_AT_name : (indirect string, offset: 0xb3d): p__rtable
[...]
<4><7b0>: Abbrev Number: 8 (DW_TAG_subrange_type)
<7b1> DW_AT_type : <0x9b2>
<7b5> DW_AT_upper_bound : 2
... where DIE 0x9b2 leads us to ...
<3><9b2>: Abbrev Number: 9 (DW_TAG_subrange_type)
[...]
<9b8> DW_AT_type : <0x962>
<2><962>: Abbrev Number: 22 (DW_TAG_enumeration_type)
<963> DW_AT_name : (indirect string, offset: 0xb34): p__index
[...]
This patch fixes the issue by also making sure that the subtype
of the original range type does match the subtype found in the
descriptive type.
gdb/ChangeLog:
* ada-lang.c (ada_is_redundant_range_encoding): Return 0
if the TYPE_CODE of range_type's base type does not match
the TYPE_CODE of encoding_type's base type.
Diffstat (limited to 'bfd')
0 files changed, 0 insertions, 0 deletions