diff options
Diffstat (limited to 'gdb/parse.c')
-rw-r--r-- | gdb/parse.c | 16 |
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; } |