Add TYPE_CODE_FIXED_POINT handling in print_type_scalar
authorJoel Brobecker <brobecker@adacore.com>
Tue, 24 Nov 2020 03:03:36 +0000 (22:03 -0500)
committerJoel Brobecker <brobecker@adacore.com>
Tue, 24 Nov 2020 03:03:36 +0000 (22:03 -0500)
This commit enhances print_type_scalar to include support for
TYPE_CODE_FIXED_POINT. This way, any language falling back to
this function for printing the description of some types
also gets basic ptype support for fixed point types as well.

This fixes a couple of XFAILs in gdb.dwarf2/dw2-fixed-point.exp.

gdb/ChangeLog:

        * typeprint.c (print_type_scalar): Add handling of
        TYPE_CODE_FIXED_POINT.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/dw2-fixed-point.exp: Fix the expected output of
        the "ptype pck__fp1_range_var" test for the module-2 and pascal
        languages.  Remove the associated setup_xfail.

gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp
gdb/typeprint.c

index 014687416432d3bfa184afa715ac66fecb10748b..35940d515c412b8d1c7898c1c8bd67253069d3cb 100644 (file)
@@ -1,3 +1,8 @@
+2020-11-24  Joel Brobecker  <brobecker@adacore.com>
+
+       * typeprint.c (print_type_scalar): Add handling of
+       TYPE_CODE_FIXED_POINT.
+
 2020-11-24  Joel Brobecker  <brobecker@adacore.com>
 
        * valarith.c (fixed_point_binop): Replace the
index d6358dd88563068d84c360ccbb289d63125a8761..fa1f0e8faaf630517b6b1a4f7f6e90c64b3a3545 100644 (file)
@@ -1,3 +1,9 @@
+2020-11-24  Joel Brobecker  <brobecker@adacore.com>
+
+       * gdb.dwarf2/dw2-fixed-point.exp: Fix the expected output of
+       the "ptype pck__fp1_range_var" test for the module-2 and pascal
+       languages.  Remove the associated setup_xfail.
+
 2020-11-23  Simon Marchi  <simon.marchi@efficios.com>
 
        * lib/gdb.exp (gdb_assert): Show error message on error.
index a82a9af32392d2c8e877e1e8580fe727f1155c05..67d1d34d8f3546f927b1f778924c64b893e7fff6 100644 (file)
@@ -278,9 +278,6 @@ proc do_ptype_test {lang fp1_re fp2_re fp3_re fp1_range_re} {
 
         gdb_test "ptype pck__fp3_var" $fp3_re
 
-        if { $lang == "modula-2" || $lang == "pascal" } {
-            setup_xfail "*-*-*" "not supported by language"
-        }
         gdb_test "ptype pck__fp1_range_var" $fp1_range_re
     }
 }
@@ -299,10 +296,21 @@ foreach lang [list "c" "d" "go" "objective-c" "opencl" ] {
                   " = <range type>"
 }
 
-foreach lang [list "fortran" "modula-2" "pascal" ] {
-    do_ptype_test $lang \
-                  " = pck__fp1_type" \
-                  " = pck__fp2_type" \
-                  " = pck__fp3_type" \
-                  " = <range type>"
-}
+do_ptype_test "fortran" \
+          " = pck__fp1_type" \
+          " = pck__fp2_type" \
+          " = pck__fp3_type" \
+          " = <range type>"
+
+do_ptype_test "modula-2" \
+          " = pck__fp1_type" \
+          " = pck__fp2_type" \
+          " = pck__fp3_type" \
+          " = \\\[1-byte fixed point \\(small = 1/16\\)\\.\\.1-byte fixed point \\(small = 1/16\\)\\\]"
+
+do_ptype_test "pascal" \
+          " = pck__fp1_type" \
+          " = pck__fp2_type" \
+          " = pck__fp3_type" \
+          " = 1-byte fixed point \\(small = 1/16\\)\\.\\.1-byte fixed point \\(small = 1/16\\)"
+
index a3fc9ccff306b7a9e492cb15b06e82a73cac63bb..47019a23aeda779386a0e9c233b2c8353d379bb1 100644 (file)
@@ -637,6 +637,10 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
       print_type_scalar (TYPE_TARGET_TYPE (type), val, stream);
       return;
 
+    case TYPE_CODE_FIXED_POINT:
+      print_type_fixed_point (type, stream);
+      break;
+
     case TYPE_CODE_UNDEF:
     case TYPE_CODE_PTR:
     case TYPE_CODE_ARRAY: