Select variant field when printing variant
authorTom Tromey <tromey@adacore.com>
Mon, 6 Apr 2020 18:59:57 +0000 (12:59 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 6 Apr 2020 18:59:57 +0000 (12:59 -0600)
commit6ee448cc2d0b9337713ecb6bb2e6305b4f504cbc
treebc6c280d5cb3ad650f3c93b7a5c2455cf66583c7
parentdea34e8cc336a80546dac21463583a76e3e5d473
Select variant field when printing variant

When I updated the Ada variant-printing code to be value-based, I
neglected a couple of issues.  First, print_variant_part must first
extract the variant field before finding the active component; second,
print_field_values should pass in the field value as the outer value
when recursing.

This patch fixes both of these issues.

gdb/ChangeLog
2020-04-06  Tom Tromey  <tromey@adacore.com>

* ada-valprint.c (print_variant_part): Extract the variant field.
(print_field_values): Use the field as the outer value when
recursing.

gdb/testsuite/ChangeLog
2020-04-06  Tom Tromey  <tromey@adacore.com>

* gdb.ada/variant-record/proc.adb: New file.
* gdb.ada/variant-record/value.adb: New file.
* gdb.ada/variant-record/value.s: New file.
* gdb.ada/variant-record.exp: New file.
gdb/ChangeLog
gdb/ada-valprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/variant-record.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/variant-record/proc.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/variant-record/value.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/variant-record/value.ads [new file with mode: 0644]