* ch-typeprint.c (chill_type_print_base): Make TYPE_CODE_RANGE
authorPer Bothner <per@bothner.com>
Mon, 5 Sep 1994 21:47:03 +0000 (21:47 +0000)
committerPer Bothner <per@bothner.com>
Mon, 5 Sep 1994 21:47:03 +0000 (21:47 +0000)
case more robust.
This fixes PR 5016.

gdb/ChangeLog
gdb/ch-typeprint.c

index 0d0a305..a4ec061 100644 (file)
@@ -1,3 +1,8 @@
+Mon Sep  5 14:46:41 1994  Per Bothner  (bothner@kalessin.cygnus.com)
+
+       * ch-typeprint.c (chill_type_print_base):  Make TYPE_CODE_RANGE
+       case more robust.
+
 Sun Sep  4 16:06:34 1994  Stan Shebs  (shebs@andros.cygnus.com)
 
        * i960-tdep.c (signal.h): Don't include.
index 9bc4303..3311e1f 100644 (file)
@@ -243,25 +243,23 @@ chill_type_print_base (type, stream, show, level)
        break;
 
       case TYPE_CODE_RANGE:
-       if (TYPE_DUMMY_RANGE (type))
-         chill_type_print_base (TYPE_TARGET_TYPE (type),
-                                stream, show, level);
-       else if (TYPE_TARGET_TYPE (type))
+       if (TYPE_DUMMY_RANGE (type) > 0)
+         chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+       else
          {
-           chill_type_print_base (TYPE_TARGET_TYPE (type),
-                                  stream, show, level);
+           struct type *target = TYPE_TARGET_TYPE (type);
+           if (target && TYPE_NAME (target))
+             fputs_filtered (TYPE_NAME (target), stream);
+           else
+             fputs_filtered ("RANGE", stream);
+           if (target == NULL)
+             target = builtin_type_long;
            fputs_filtered (" (", stream);
-           print_type_scalar (TYPE_TARGET_TYPE (type),
-                              TYPE_FIELD_BITPOS (type, 0), stream);
+           print_type_scalar (target, TYPE_LOW_BOUND (type), stream);
            fputs_filtered (":", stream);
-           print_type_scalar (TYPE_TARGET_TYPE (type),
-                              TYPE_FIELD_BITPOS (type, 1), stream);
+           print_type_scalar (target, TYPE_HIGH_BOUND (type), 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_ENUM: