Add ptype support for DWARF-based fixed-point types

Note that the ptype information printed for types described
via pure DWARF debug info is slightly less informative as
the one printed when the information is encoded in the type's
name, via the GNAT encoding. As a result, the output in
the case of DWARF-described fixed point types is slightly
different. In pratice, this is no real loss because the information
not available in DWARF has no bearing on how the type is actually
stored in memory.

gdb/ChangeLog:

        * ada-typeprint.c (ada_print_type): Add handing of fixed-point
        range types.
        * c-typeprint.c (c_type_print_varspec_prefix)
        (c_type_print_varspec_suffix, c_type_print_base_1): Add
        TYPE_CODE_FIXED_POINT handling.
        * p-typeprint.c (pascal_type_print_varspec_prefix)
        (pascal_type_print_varspec_suffix): Likewise.
        * typeprint.c (print_type_fixed_point): New function.
        * typeprint.h (print_type_fixed_point): Add declaration.

gdb/testsuite/ChangeLog:

        * gdb.ada/fixed_points.exp: Add ptype tests.
        * gdb.dwarf2/dw2-fixed-point.exp: Likewise.
This commit is contained in:
Joel Brobecker
2020-11-15 03:16:01 -05:00
parent b26daff97c
commit 0c9150e4de
9 changed files with 128 additions and 0 deletions

View File

@@ -465,6 +465,7 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_COMPLEX:
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
case TYPE_CODE_FIXED_POINT:
/* These types need no prefix. They are listed here so that
gcc -Wall will reveal any types that haven't been handled. */
break;
@@ -844,6 +845,7 @@ c_type_print_varspec_suffix (struct type *type,
case TYPE_CODE_COMPLEX:
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
case TYPE_CODE_FIXED_POINT:
/* These types do not need a suffix. They are listed so that
gcc -Wall will report types that may not have been
considered. */
@@ -1683,6 +1685,10 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
fprintf_styled (stream, metadata_style.style (), _("<range type>"));
break;
case TYPE_CODE_FIXED_POINT:
print_type_fixed_point (type, stream);
break;
case TYPE_CODE_NAMESPACE:
fputs_filtered ("namespace ", stream);
fputs_filtered (type->name (), stream);