Print Ada type name in more cases
authorTom Tromey <tromey@adacore.com>
Wed, 4 Nov 2020 16:17:58 +0000 (09:17 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 4 Nov 2020 16:17:58 +0000 (09:17 -0700)
commit8d9fd3a107c4ae251a4cbcfc995115334e0cf84e
tree48f17c1b0bd417a9e080b148fa0352878c6bf0ae
parentd8f62e8447e7ddba311e9a51d1bf36ef533a2745
Print Ada type name in more cases

In some cases the name of an Ada type cannot be decoded by
decoded_type_name.  For example, the name
"p__complex_variable_record_type__T9s" in the included test case is
rejected due to the "T".  This causes ptype to display the full
contents of a record type -- when in fact the name is available and
ought to be printed.

Fixing this in decoded_type_name isn't possible because the "__T" name
is not the real name of the type -- it is just a compiler-assigned
name of convenience.

This patch fixes the problem by using the resolved type's name when
the original type's name isn't suitable.

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

* ada-typeprint.c (ada_print_type): Handle __T types.

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

* gdb.ada/rec_ptype.exp: New file.
* gdb.ada/rec_ptype/main.adb: New file.
* gdb.ada/rec_ptype/p.ads: New file.
gdb/ChangeLog
gdb/ada-typeprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/rec_ptype.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/rec_ptype/main.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/rec_ptype/p.ads [new file with mode: 0644]