aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-06-17 07:41:37 -0600
committerTom Tromey <tromey@adacore.com>2022-07-18 09:57:04 -0600
commit6a40c6e4374a660eab5cdc2f8a777ccbd7a81951 (patch)
tree58413fbd5fbe095288fc93c6474a0b84dbe6f757 /gdb/ada-lang.c
parent083aca0c8333fc24c6a65a03fca765bc13ee37c0 (diff)
downloadgdb-6a40c6e4374a660eab5cdc2f8a777ccbd7a81951.zip
gdb-6a40c6e4374a660eab5cdc2f8a777ccbd7a81951.tar.gz
gdb-6a40c6e4374a660eab5cdc2f8a777ccbd7a81951.tar.bz2
Remove array typedef assumption for Ada
Currently the Ada code assumes that it can distinguish between a multi-dimensional array and an array of arrays by looking for an intervening typedef -- that is, for an array of arrays, there will be a typedef wrapping the innermost array type. A recent compiler change removes this typedef, which causes a gdb failure in the internal AdaCore test suite. This patch handles this case by checking whether the array type in question has a name.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 93e0c67..6504081 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -3208,6 +3208,12 @@ ada_array_element_type (struct type *type, int nindices)
while (nindices != 0 && type->code () == TYPE_CODE_ARRAY)
{
type = TYPE_TARGET_TYPE (type);
+ /* A multi-dimensional array is represented using a sequence
+ of array types. If one of these types has a name, then
+ it is not another dimension of the outer array, but
+ rather the element type of the outermost array. */
+ if (type->name () != nullptr)
+ break;
nindices -= 1;
}
return type;