diff options
Diffstat (limited to 'gdb/expprint.c')
-rw-r--r-- | gdb/expprint.c | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/gdb/expprint.c b/gdb/expprint.c index 5bd9553..d7d7c87 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -54,6 +54,25 @@ print_subexp (struct expression *exp, int *pos, prec); } +/* See parser-defs.h. */ + +void +print_subexp_funcall (struct expression *exp, int *pos, + struct ui_file *stream) +{ + (*pos) += 2; + unsigned nargs = longest_to_int (exp->elts[*pos].longconst); + print_subexp (exp, pos, stream, PREC_SUFFIX); + fputs_filtered (" (", stream); + for (unsigned tem = 0; tem < nargs; tem++) + { + if (tem != 0) + fputs_filtered (", ", stream); + print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); + } + fputs_filtered (")", stream); +} + /* Standard implementation of print_subexp for use in language_defn vectors. */ void @@ -188,18 +207,7 @@ print_subexp_standard (struct expression *exp, int *pos, return; case OP_FUNCALL: - case OP_F77_UNDETERMINED_ARGLIST: - (*pos) += 2; - nargs = longest_to_int (exp->elts[pc + 1].longconst); - print_subexp (exp, pos, stream, PREC_SUFFIX); - fputs_filtered (" (", stream); - for (tem = 0; tem < nargs; tem++) - { - if (tem != 0) - fputs_filtered (", ", stream); - print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); - } - fputs_filtered (")", stream); + print_subexp_funcall (exp, pos, stream); return; case OP_NAME: @@ -798,6 +806,22 @@ dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt) elt); } +/* See parser-defs.h. */ + +int +dump_subexp_body_funcall (struct expression *exp, + struct ui_file *stream, int elt) +{ + int nargs = longest_to_int (exp->elts[elt].longconst); + fprintf_filtered (stream, "Number of args: %d", nargs); + elt += 2; + + for (int i = 1; i <= nargs + 1; i++) + elt = dump_subexp (exp, stream, elt); + + return elt; +} + /* Default value for subexp_body in exp_descriptor vector. */ int @@ -933,18 +957,7 @@ dump_subexp_body_standard (struct expression *exp, elt += 2; break; case OP_FUNCALL: - case OP_F77_UNDETERMINED_ARGLIST: - { - int i, nargs; - - nargs = longest_to_int (exp->elts[elt].longconst); - - fprintf_filtered (stream, "Number of args: %d", nargs); - elt += 2; - - for (i = 1; i <= nargs + 1; i++) - elt = dump_subexp (exp, stream, elt); - } + elt = dump_subexp_body_funcall (exp, stream, elt); break; case OP_ARRAY: { |