variables whose type is a typedef to an array pointer
If we declare a type as being an access to array type, and then
declare a variable of that type, for instance:
type Some_Array is array [...];
type Array_Access is access all Some_Array;
Table : Array_Access := [...];
The variable "Table" may be defined in the debugging information
as being a typedef to the array pointer type. In the past, it was
defined directly as the array pointer type, but this has been changed
to make sure that the typedef type gets used.
If the typedef type wasn't used, it would allow the compiler to stop
emitting that typedef type when compiling with
-feliminate-unused-debug-types. The removal of this typedef would
be a problem, because GDB relies on the typedef to create symbols
for pointer types, and without it, we would no longer be able to
do "ptype array_access".
This patch helps prevent incorrect output or even crashes when that
extra typedef layer is used.
The testing is already mostly covered by arrayptr.exp, but I still
added a 'ptype' test, just for good measure.
gdb/ChangeLog: (Eric Botcazou)
* ada-lang.c (thin_descriptor_type): Deal with typedefs.
(decode_constrained_packed_array): Likewise.
(ada_evaluate_subexp) <TERNOP_SLICE>: Likewise.
gdb/testsuite/ChangeLog (Joel Brobecker):
* gdb.ada/arrayptr.exp: Add ptype test.