summaryrefslogtreecommitdiff
path: root/gdb/ch-typeprint.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1994-09-05 21:47:03 +0000
committerPer Bothner <per@bothner.com>1994-09-05 21:47:03 +0000
commit42fca93eb8a04a1c2602d6bfb932a4f13b1e4a21 (patch)
tree75c05bdfcc0083c88875d88c18890e04a69edc46 /gdb/ch-typeprint.c
parente1728bee60c4326b5a71a0c4937005733466f3c6 (diff)
* ch-typeprint.c (chill_type_print_base): Make TYPE_CODE_RANGE
case more robust. This fixes PR 5016.
Diffstat (limited to 'gdb/ch-typeprint.c')
-rw-r--r--gdb/ch-typeprint.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c
index 9bc4303e58..3311e1f920 100644
--- a/gdb/ch-typeprint.c
+++ b/gdb/ch-typeprint.c
@@ -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: