Avoid crash in Ada value printing with optimized-out array
The Ada value-printing code could crash when printing an array which
had been optimized out.
The crash is difficult to reproduce, but I did manage to write a test
that at least shows that the previous behavior was incorrect -- before
the patch, the array is printed as if it is valid and every value is 0.
gdb/ChangeLog
2021-04-15 Tom Tromey <tromey@adacore.com>
* ada-valprint.c (ada_value_print_array): Handle optimized-out
arrays.
gdb/testsuite/ChangeLog
2021-04-15 Tom Tromey <tromey@adacore.com>
* gdb.dwarf2/arr-stride.exp: Add test.