aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-02-01 21:02:51 +0000
committerPer Bothner <per@bothner.com>1995-02-01 21:02:51 +0000
commitf91a9e05e0183d596f1f307ddeb462175ca84ce8 (patch)
tree0d4a44205089ea893799272b7a78b7f8bd3acdea /gdb/gdbtypes.c
parente1affd5840505e64d51482bfc3de7ea74edc5352 (diff)
downloadgdb-f91a9e05e0183d596f1f307ddeb462175ca84ce8.zip
gdb-f91a9e05e0183d596f1f307ddeb462175ca84ce8.tar.gz
gdb-f91a9e05e0183d596f1f307ddeb462175ca84ce8.tar.bz2
* ch-exp.y (value_string_element, string_primitive_value,
start_element, left_element, right_element, slice_size, lower_element, upper_element, first_element): Removed. (value_string_slice, value_array_slice): Replaced by ... (slice): New non-terminal, with working slice support. (primitive_value_lparen, rparen): New non-terminals. (maybe_tuple_elements): New non-terminal, to allow empty tuples. (idtokentab): Added "up". * value.h (COERCE_VARYING_ARRAY): New macro. * valarith.c (value_subscript): Use it. * valops.c (value_cast): Likewise. Also, do nothing if already correct type, and allow converting from/to range to/from scalar. * valops.c, value.h (varying_to_slice, value_slice): New functions. * eval.c (OP_ARRAY): Add cast for array element. * expression.h (TERNOP_SLICE, TERNOP_SLICE_COUNT): New exp_opcodes. * valops.c (chill_varying_type): Moved function frp, here ... * gdbtypes.c (chill_varying_type), gdbtypes.h: ... to here. * parse.c (length_of_subexp, prefixify_subexp): Add support for TERNOP_SLICE, TERNOP_SLICE_COUNT. * expprint.c (print_subexp, dump_expression): Likewise. * eval.c (evaluate_subexp): Likewise. * eval.c (evaluate_subexp case MULTI_SUBSCRIPT): Don't call value_x_binop on a Chill varying string.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 9ec6666..cc76898 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1236,6 +1236,23 @@ can_dereference (t)
&& TYPE_CODE (TYPE_TARGET_TYPE (t)) != TYPE_CODE_VOID);
}
+/* Chill varying string and arrays are represented as follows:
+
+ struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data};
+
+ Return true if TYPE is such a Chill varying type. */
+
+int
+chill_varying_type (type)
+ struct type *type;
+{
+ if (TYPE_CODE (type) != TYPE_CODE_STRUCT
+ || TYPE_NFIELDS (type) != 2
+ || strcmp (TYPE_FIELD_NAME (type, 0), "__var_length") != 0)
+ return 0;
+ return 1;
+}
+
#if MAINTENANCE_CMDS
static void