diff options
author | Tom Tromey <tromey@adacore.com> | 2020-11-04 08:49:16 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-11-04 08:49:18 -0700 |
commit | 24aa1b028236fff1b1cf04e8cadcc2e7b4c72aab (patch) | |
tree | 869a2e61f57a091c293e643c9b064fd406deae53 /gdb/ada-lang.c | |
parent | c9a28cbed612a32efca1167d3b4641278a85059e (diff) | |
download | fsf-binutils-gdb-24aa1b028236fff1b1cf04e8cadcc2e7b4c72aab.zip fsf-binutils-gdb-24aa1b028236fff1b1cf04e8cadcc2e7b4c72aab.tar.gz fsf-binutils-gdb-24aa1b028236fff1b1cf04e8cadcc2e7b4c72aab.tar.bz2 |
Resolve dynamic type in ada_value_struct_elt
An internal AdaCore test case showed that gdb mishandled a case of
assigning to an array element in a packed array inside a variant
record. This problem can only be seen with -fgnat-encodings=minimal,
which isn't yet widely used. This patch fixes the bug, and also
updates an existing test to check this case.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_value_struct_elt): Resolve dynamic type.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/set_pckd_arr_elt.exp: Also test
-fgnat-encodings=minimal. Add tests.
* gdb.ada/set_pckd_arr_elt/foo.adb (Foo): Add VA variable.
Call Update_Small a second time.
* gdb.ada/set_pckd_arr_elt/pck.adb (New_Variant): New function.
* gdb.ada/set_pckd_arr_elt/pck.ads (Buffer, Variant)
(Variant_Access): New types.
(New_Variant): Declare.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index bfb46a5..7613e19 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4396,6 +4396,10 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL, address, NULL, check_tag); + /* Resolve the dynamic type as well. */ + arg = value_from_contents_and_address (t1, nullptr, address); + t1 = value_type (arg); + if (find_struct_field (name, t1, 0, &field_type, &byte_offset, &bit_offset, &bit_size, NULL)) |