Be more careful when rewriting thick pointer array type
authorTom Tromey <tromey@adacore.com>
Mon, 14 Dec 2020 14:42:23 +0000 (07:42 -0700)
committerTom Tromey <tromey@adacore.com>
Mon, 14 Dec 2020 14:42:23 +0000 (07:42 -0700)
commite26624c669037529816f89ce1b9c78954c389ca1
treee2b683793e2f22b56ce2dac69d4f67eccc21a848
parenta3bdae4ef826f2b59cc475e530b2a4130185cfac
Be more careful when rewriting thick pointer array type

To handle thick pointers with -fgnat-encodings=minimal, gdb will
rewrite the underlying array type to remove the bounds.  However, if
the same DWARF type is used both for a thick pointer and for an
ordinary array, this will have the side effect of removing the bounds
from the array.  This breaks the printing of objects of this type.

This patch fixes the problem by copying the array type, its range, and
its bounds.

gdb/ChangeLog
2020-12-14  Tom Tromey  <tromey@adacore.com>

* dwarf2/read.c (rewrite_array_type): New function.
        (quirk_ada_thick_pointer_struct): Use rewrite_array_type.

gdb/testsuite/ChangeLog
2020-12-14  Tom Tromey  <tromey@adacore.com>

* gdb.dwarf2/ada-thick-pointer.exp: New file.
gdb/ChangeLog
gdb/dwarf2/read.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/ada-thick-pointer.exp [new file with mode: 0644]