Fix bug in dynamic type resolution
authorTom Tromey <tromey@adacore.com>
Fri, 24 Sep 2021 20:06:52 +0000 (14:06 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 19 Oct 2021 19:03:58 +0000 (13:03 -0600)
commit05fb05a94729473cb04b1299fe5c36e06525c78f
treeaedea01744e7289d9faef886a9ab2a2931edbdca
parentd7c68312bdeca52e242326e5cf155e0aa63268bb
Fix bug in dynamic type resolution

A customer-reported problem led us to a bug in dynamic type
resolution.  resolve_dynamic_struct will recursively call
resolve_dynamic_type_internal, passing it the sub-object for the
particular field being resolved.  While it offsets the address here,
it does not also offset the "valaddr" -- the array of bytes describing
the memory.

This patch fixes the bug, by offsetting both.  A test case is included
that can be used to reproduce the bug.
gdb/gdbtypes.c
gdb/testsuite/gdb.ada/array_of_variant.exp
gdb/testsuite/gdb.ada/array_of_variant/p.adb