aboutsummaryrefslogtreecommitdiff
path: root/gdb/ch-valprint.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1993-12-14 04:32:51 +0000
committerPer Bothner <per@bothner.com>1993-12-14 04:32:51 +0000
commite909f287a8340e2fe7a99f6fc1649801ec807768 (patch)
treec63edf815aaacd4fd20ca3cd370799843151bc34 /gdb/ch-valprint.c
parent1400cdc51d7a0264cea808e46f22a0a35faebac9 (diff)
downloadgdb-e909f287a8340e2fe7a99f6fc1649801ec807768.zip
gdb-e909f287a8340e2fe7a99f6fc1649801ec807768.tar.gz
gdb-e909f287a8340e2fe7a99f6fc1649801ec807768.tar.bz2
Implement support for Chill POWERSETs.
* ch-exp.y (operand_2): Implement 'Element IN PowerSet'. * ch-typeprint.c (chill_type_print_base): Handle POWERSETs. * ch-valprint.c (chill_val_print): Handle TYPE_CODE_SET. * eval.c (evaluate_subexp): Implement BINOP_IN. * expression.h (enum exp_opcode): Added BINOP_IN. * gdbtypes.c (create_set_type), gdbtypes.h: New function. * stabsread.c (read_type): If 'S', create a set type. * valarith.c (value_bit_index, value_in), value.h: New functions, for indexing in SETs.
Diffstat (limited to 'gdb/ch-valprint.c')
-rw-r--r--gdb/ch-valprint.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c
index 4be369b..1f0987c 100644
--- a/gdb/ch-valprint.c
+++ b/gdb/ch-valprint.c
@@ -196,6 +196,51 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
return (i + (print_max && i != print_max));
break;
+ case TYPE_CODE_SET:
+ {
+ struct type *range = TYPE_FIELD_TYPE (type, 0);
+ int low_bound = TYPE_FIELD_BITPOS (range, 0);
+ int high_bound = TYPE_FIELD_BITPOS (range, 1);
+ int i;
+ int is_bitstring = 0;
+ int need_comma = 0;
+ int in_range = 0;
+
+ if (is_bitstring)
+ fputs_filtered ("B'", stream);
+ else
+ fputs_filtered ("[", stream);
+ for (i = low_bound; i <= high_bound; i++)
+ {
+ int element = value_bit_index (type, valaddr, i);
+ if (is_bitstring)
+ fprintf_filtered (stream, "%d", element);
+ else if (element)
+ {
+ if (need_comma)
+ fputs_filtered (", ", stream);
+ print_type_scalar (TYPE_TARGET_TYPE (range), i, stream);
+ need_comma = 1;
+
+ /* Look for a continuous range of true elements. */
+ if (i+1 <= high_bound && value_bit_index (type, valaddr, ++i))
+ {
+ int j = i; /* j is the upper bound so far of the range */
+ fputs_filtered (":", stream);
+ while (i+1 <= high_bound
+ && value_bit_index (type, valaddr, ++i))
+ j = i;
+ print_type_scalar (TYPE_TARGET_TYPE (range), j, stream);
+ }
+ }
+ }
+ if (is_bitstring)
+ fputs_filtered ("'", stream);
+ else
+ fputs_filtered ("]", stream);
+ }
+ break;
+
case TYPE_CODE_STRUCT:
chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
0);
@@ -335,4 +380,3 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
}
fprintf_filtered (stream, "]");
}
-