diff options
author | Tom Tromey <tromey@adacore.com> | 2022-09-20 08:39:09 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-10-21 09:40:58 -0600 |
commit | 6c849804cff9e251876f3edb64d44dabeadaa711 (patch) | |
tree | da7aa69ba5cb2c894a91ba814eb256293c95cde9 /gdb/dwarf2 | |
parent | 75436c534bfd7f548a13b5f926c3bd234b23b8d0 (diff) | |
download | gdb-6c849804cff9e251876f3edb64d44dabeadaa711.zip gdb-6c849804cff9e251876f3edb64d44dabeadaa711.tar.gz gdb-6c849804cff9e251876f3edb64d44dabeadaa711.tar.bz2 |
Fix bug in Ada packed array handling
A user found a bug where an array of packed arrays was printed
incorrectly. The bug here is that the packed array has a bit stride,
but the outer array does not -- and should not. However,
update_static_array_size does not distinguish between an array of
packed arrays and a multi-dimensional packed array, and for the
latter, only the innermost array will end up with a stride.
This patch fixes the problem by adding a flag to indicate whether a
given array type is a constituent of a multi-dimensional array.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r-- | gdb/dwarf2/read.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 89ba912..7de89dd 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -15690,6 +15690,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) { type = create_array_type_with_stride (NULL, type, range_types[i++], byte_stride_prop, bit_stride); + type->set_is_multi_dimensional (true); bit_stride = 0; byte_stride_prop = nullptr; } @@ -15701,11 +15702,14 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) { type = create_array_type_with_stride (NULL, type, range_types[ndim], byte_stride_prop, bit_stride); + type->set_is_multi_dimensional (true); bit_stride = 0; byte_stride_prop = nullptr; } } + /* Clear the flag on the outermost array type. */ + type->set_is_multi_dimensional (false); gdb_assert (type != element_type); /* Understand Dwarf2 support for vector types (like they occur on |