aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1993-01-02 20:32:01 +0000
committerFred Fish <fnf@specifix.com>1993-01-02 20:32:01 +0000
commit54bbbfb43300a2ca9ef3509e9076caa1776970d1 (patch)
tree86109f7c0f1730cf10d8332153359774397ea0cf /gdb/eval.c
parentea81b10d1eb802c8270a758d5f6017b56e3388ca (diff)
downloadgdb-54bbbfb43300a2ca9ef3509e9076caa1776970d1.zip
gdb-54bbbfb43300a2ca9ef3509e9076caa1776970d1.tar.gz
gdb-54bbbfb43300a2ca9ef3509e9076caa1776970d1.tar.bz2
* eval.c (evaluate_subexp): Add case MULTI_SUBSCRIPT.
* expprint.c (print_subexp): Rename BINOP_MULTI_SUBSCRIPT to MULTI_SUBSCRIPT. * expprint.c (dump_expression): New function for dumping expression vectors during gdb debugging. * expression.h (BINOP_MULTI_SUBSCRIPT): Name changed to MULTI_SUBSCRIPT and moved out of BINOP range. * expression.h (DUMP_EXPRESSION): New macro that calls dump_expression if DEBUG_EXPRESSIONS is defined. * m2-exp.y (BINOP_MULTI_SUBSCRIPT): Changed to MULTI_SUBSCRIPT. * parse.c (length_of_subexp, prefixify_subexp): Change BINOP_MULTI_SUBSCRIPT to MULTI_SUBSCRIPT. * parse.c (parse_exp_1): Call DUMP_EXPRESSION before and after prefixify'ing the expression. * printcmd.c (print_command_1): Add comment. **** start-sanitize-chill **** * ch-exp.y (expression_list): Add useful actions. * ch-exp.y (value_array_element): Add useful actions. * ch-exp.y (array_primitive_value): Add production. * ch-exp.y (yylex): Recognize ',' as a token. **** end-sanitize-chill ****
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 7f2ac9d..77ae90c 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -584,6 +584,57 @@ evaluate_subexp (expect_type, exp, pos, noside)
else
return value_subscript (arg1, arg2);
+ case MULTI_SUBSCRIPT:
+ (*pos) += 2;
+ nargs = longest_to_int (exp->elts[pc + 1].longconst);
+ arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
+ while (nargs-- > 0)
+ {
+ arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
+ /* FIXME: EVAL_SKIP handling may not be correct. */
+ if (noside == EVAL_SKIP)
+ {
+ if (nargs > 0)
+ {
+ continue;
+ }
+ else
+ {
+ goto nosideret;
+ }
+ }
+ /* FIXME: EVAL_AVOID_SIDE_EFFECTS handling may not be correct. */
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
+ /* If the user attempts to subscript something that has no target
+ type (like a plain int variable for example), then report this
+ as an error. */
+
+ type = TYPE_TARGET_TYPE (VALUE_TYPE (arg1));
+ if (type != NULL)
+ {
+ arg1 = value_zero (type, VALUE_LVAL (arg1));
+ noside = EVAL_SKIP;
+ continue;
+ }
+ else
+ {
+ error ("cannot subscript something of type `%s'",
+ TYPE_NAME (VALUE_TYPE (arg1)));
+ }
+ }
+
+ if (binop_user_defined_p (op, arg1, arg2))
+ {
+ arg1 = value_x_binop (arg1, arg2, op, OP_NULL);
+ }
+ else
+ {
+ arg1 = value_subscript (arg1, arg2);
+ }
+ }
+ return (arg1);
+
case BINOP_LOGICAL_AND:
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
if (noside == EVAL_SKIP)