* stabsread.c (read_array_type): Allow negative array bounds,
authorFred Fish <fnf@specifix.com>
Sat, 11 Dec 1993 01:27:23 +0000 (01:27 +0000)
committerFred Fish <fnf@specifix.com>
Sat, 11 Dec 1993 01:27:23 +0000 (01:27 +0000)
without interpreting that to mean "adjustable."
* ch-valprint.c (chill_val_print):  Handle RANGE types.
* ch-typeprint.c (chill_type_print_base):  Handle BOOL.
Handle variant records.  Handle RANGE types.

gdb/ChangeLog
gdb/ch-typeprint.c
gdb/ch-valprint.c
gdb/stabsread.c

index f366fc589f0f8d3ca352def87708c13f0163ac04..f51f5e57be46827587edfccace72f600d2affa5c 100644 (file)
@@ -1,3 +1,11 @@
+Fri Dec 10 15:53:56 1993  Per Bothner  (bothner@kalessin.cygnus.com)
+
+       * stabsread.c (read_array_type):  Allow negative array bounds,
+       without interpreting that to mean "adjustable."
+       * ch-valprint.c (chill_val_print):  Handle RANGE types.
+       * ch-typeprint.c (chill_type_print_base):  Handle BOOL.
+       Handle variant records.  Handle RANGE types.
+
 Tue Dec  7 15:41:32 1993  Ian Lance Taylor  (ian@cygnus.com)
 
        * config/mips/idt.mt: Use tm-idt.h instead of tm-bigmips.h.
index 3d2038eb5d7851a4904568854d79a6034dfbd014..da64b45372ffa7072ef39be148cc53667556ab85 100644 (file)
@@ -114,6 +114,10 @@ chill_type_print_base (type, stream, show, level)
        chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
        break;
 
+      case TYPE_CODE_BOOL:
+       fprintf_filtered (stream, "BOOL");
+       break;
+
       case TYPE_CODE_ARRAY:
        range_type = TYPE_FIELD_TYPE (type, 0);
        index_type = TYPE_TARGET_TYPE (range_type);
@@ -180,11 +184,42 @@ chill_type_print_base (type, stream, show, level)
                len = TYPE_NFIELDS (type);
                for (i = TYPE_N_BASECLASSES (type); i < len; i++)
                  {
+                   struct type *field_type = TYPE_FIELD_TYPE (type, i);
                    QUIT;
                    print_spaces_filtered (level + 4, stream);
-                   chill_print_type (TYPE_FIELD_TYPE (type, i),
-                                     TYPE_FIELD_NAME (type, i),
-                                     stream, show - 1, level + 4);
+                   if (TYPE_CODE (field_type) == TYPE_CODE_UNION)
+                     { int j; /* variant number */
+                       fputs_filtered ("CASE OF\n", stream);
+                       for (j = 0; j < TYPE_NFIELDS (field_type); j++)
+                         { int k; /* variant field index */
+                           struct type *variant_type
+                             = TYPE_FIELD_TYPE (field_type, j);
+                           int var_len = TYPE_NFIELDS (variant_type);
+                           print_spaces_filtered (level + 4, stream);
+                           if (strcmp (TYPE_FIELD_NAME (field_type, j),
+                                       "else") == 0)
+                             fputs_filtered ("ELSE\n", stream);
+                           else
+                             fputs_filtered (":\n", stream);
+                           if (TYPE_CODE (variant_type) != TYPE_CODE_STRUCT)
+                             error ("variant record confusion");
+                           for (k = 0; k < var_len; k++)
+                             {
+                               print_spaces_filtered (level + 8, stream);
+                               chill_print_type (TYPE_FIELD_TYPE (variant_type, k),
+                                                 TYPE_FIELD_NAME (variant_type, k),
+                                                 stream, show - 1, level + 8);
+                               if (k < (var_len - 1))
+                                 fputs_filtered (",", stream);
+                               fputs_filtered ("\n", stream);
+                             }
+                         }
+                       fputs_filtered ("ESAC\n", stream);
+                     }
+                   else
+                     chill_print_type (field_type,
+                                       TYPE_FIELD_NAME (type, i),
+                                       stream, show - 1, level + 4);
                    if (i < (len - 1))
                      {
                        fputs_filtered (",", stream);
@@ -196,10 +231,28 @@ chill_type_print_base (type, stream, show, level)
          }
        break;
 
+      case TYPE_CODE_RANGE:
+       if (TYPE_TARGET_TYPE (type))
+         {
+           chill_type_print_base (TYPE_TARGET_TYPE (type),
+                                  stream, show, level);
+           fputs_filtered (" (", stream);
+           print_type_scalar (TYPE_TARGET_TYPE (type),
+                              TYPE_FIELD_BITPOS (type, 0), stream);
+           fputs_filtered (":", stream);
+           print_type_scalar (TYPE_TARGET_TYPE (type),
+                              TYPE_FIELD_BITPOS (type, 1), stream);
+           fputs_filtered (")", stream);
+         }
+       else
+         fprintf_filtered (stream, "RANGE? (%s : %d)",
+                           TYPE_FIELD_BITPOS (type, 0),
+                           TYPE_FIELD_BITPOS (type, 1));
+       break;
+
       case TYPE_CODE_VOID:
       case TYPE_CODE_UNDEF:
       case TYPE_CODE_ERROR:
-      case TYPE_CODE_RANGE:
       case TYPE_CODE_ENUM:
       case TYPE_CODE_UNION:
       case TYPE_CODE_METHOD:
index 5f29b3152793512591055b949fa3799d9d9b24ba..4be369bd9ac4345651e49d9c516016e44883cb4e 100644 (file)
@@ -234,14 +234,19 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
                   deref_ref, recurse, pretty);
       break;
 
+    case TYPE_CODE_RANGE:
+      if (TYPE_TARGET_TYPE (type))
+       chill_val_print (TYPE_TARGET_TYPE (type), valaddr, address, stream,
+                        format, deref_ref, recurse, pretty);
+      break;
+
     case TYPE_CODE_MEMBER:
     case TYPE_CODE_UNION:
     case TYPE_CODE_FUNC:
     case TYPE_CODE_VOID:
     case TYPE_CODE_ERROR:
-    case TYPE_CODE_RANGE:
     default:
-      /* Let's derfer printing to the C printer, rather than
+      /* Let's defer printing to the C printer, rather than
         print an error message.  FIXME! */
       c_val_print (type, valaddr, address, stream, format,
                   deref_ref, recurse, pretty);
index 4824b718864fbd63ff87a6d266a00cbc0cb75725..3203cbf33290c580b4c1f7c6261963afc61ed5ae 100644 (file)
@@ -2794,7 +2794,7 @@ read_array_type (pp, type, objfile)
     return error_type (pp);
   ++*pp;
 
-  if (!(**pp >= '0' && **pp <= '9'))
+  if (!(**pp >= '0' && **pp <= '9') && **pp != '-')
     {
       (*pp)++;
       adjustable = 1;
@@ -2803,7 +2803,7 @@ read_array_type (pp, type, objfile)
   if (nbits != 0)
     return error_type (pp);
 
-  if (!(**pp >= '0' && **pp <= '9'))
+  if (!(**pp >= '0' && **pp <= '9') && **pp != '-')
     {
       (*pp)++;
       adjustable = 1;