Avoid crash in Ada value printing with optimized-out array
authorTom Tromey <tromey@adacore.com>
Thu, 15 Apr 2021 16:14:11 +0000 (10:14 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 15 Apr 2021 16:14:11 +0000 (10:14 -0600)
commita15a276b46bf07323a1d270d7abece83ef1ea78f
tree742b28318ab95c69c7cdbf446a4439d6e288ea5f
parent644a2e75ace6b5e76f91d38c28c3b97fcfdeeaa5
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.
gdb/ChangeLog
gdb/ada-valprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/arr-stride.exp
This page took 0.035642 seconds and 4 git commands to generate.