Fix Ada val_print removal regression
authorTom Tromey <tromey@adacore.com>
Fri, 20 Mar 2020 14:24:16 +0000 (08:24 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 20 Mar 2020 14:28:11 +0000 (08:28 -0600)
commit70304be939301a91dade0dc7d4234c081372bd24
treecb9db6c1bc3941bd3fb31ff6f41f9c47258b5a05
parent9faa006d11a5e08264a007463435f84b77864c9c
Fix Ada val_print removal regression

The removal of val_print caused a regression in the Ada code.  In one
scenario, a variant type would not be properly printed, because the
address of a component was lost.  This patch fixes the bug by changing
this API to be value-based.  This is cleaner and fixes the bug as a
side effect.

gdb/ChangeLog
2020-03-20  Tom Tromey  <tromey@adacore.com>

* ada-valprint.c (print_variant_part): Remove parameters; switch
to value-based API.
(print_field_values): Likewise.
(ada_val_print_struct_union): Likewise.
(ada_value_print_1): Update.

gdb/testsuite/ChangeLog
2020-03-20  Tom Tromey  <tromey@adacore.com>

* gdb.ada/sub_variant/subv.adb: New file.
* gdb.ada/sub_variant.exp: New file.
gdb/ChangeLog
gdb/ada-valprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/sub_variant.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/sub_variant/subv.adb [new file with mode: 0644]