From 42fca93eb8a04a1c2602d6bfb932a4f13b1e4a21 Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Mon, 5 Sep 1994 21:47:03 +0000 Subject: [PATCH] * ch-typeprint.c (chill_type_print_base): Make TYPE_CODE_RANGE case more robust. This fixes PR 5016. --- gdb/ChangeLog | 5 +++++ gdb/ch-typeprint.c | 26 ++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0d0a3052093..a4ec0612cda 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c index 9bc4303e58f..3311e1f9200 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: -- 2.30.2