aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.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/parse.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/parse.c')
-rw-r--r--gdb/parse.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 2ce1ea7..e6e6fff 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -376,7 +376,7 @@ length_of_subexp (expr, endpos)
break;
/* Modula-2 */
- case BINOP_MULTI_SUBSCRIPT:
+ case MULTI_SUBSCRIPT:
oplen=3;
args = 1 + longest_to_int (expr->elts[endpos- 2].longconst);
break;
@@ -498,7 +498,7 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
break;
/* Modula-2 */
- case BINOP_MULTI_SUBSCRIPT:
+ case MULTI_SUBSCRIPT:
oplen=3;
args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst);
break;
@@ -591,12 +591,24 @@ parse_exp_1 (stringptr, block, comma)
current_language->la_error (NULL);
discard_cleanups (old_chain);
+
+ /* Record the actual number of expression elements, and then
+ reallocate the expression memory so that we free up any
+ excess elements. */
+
expout->nelts = expout_ptr;
expout = (struct expression *)
xrealloc ((char *) expout,
sizeof (struct expression)
+ expout_ptr * sizeof (union exp_element));
+
+ /* Convert expression from postfix form as generated by yacc
+ parser, to a prefix form. */
+
+ DUMP_EXPRESSION (expout, stdout, "before conversion to prefix form");
prefixify_expression (expout);
+ DUMP_EXPRESSION (expout, stdout, "after conversion to prefix form");
+
*stringptr = lexptr;
return expout;
}