|
|
a8223e |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
a8223e |
From: Kevin Buettner <kevinb@redhat.com>
|
|
|
a8223e |
Date: Mon, 24 May 2021 17:00:17 -0700
|
|
|
a8223e |
Subject: gdb-rhbz1964167-move-fortran-expr-handling.patch
|
|
|
a8223e |
|
|
|
a8223e |
;; [fortran] Backport Andrew Burgess's commit which moves Fortran
|
|
|
a8223e |
;; expression handling to f-lang.c.
|
|
|
a8223e |
|
|
|
a8223e |
gdb/fortran: Move Fortran expression handling into f-lang.c
|
|
|
a8223e |
|
|
|
a8223e |
The Fortran specific OP_F77_UNDETERMINED_ARGLIST is currently handled
|
|
|
a8223e |
in the generic expression handling code. There's no reason why this
|
|
|
a8223e |
should be the case, so this commit moves handling of this into Fortran
|
|
|
a8223e |
specific files.
|
|
|
a8223e |
|
|
|
a8223e |
There should be no user visible changes after this commit.
|
|
|
a8223e |
|
|
|
a8223e |
gdb/ChangeLog:
|
|
|
a8223e |
|
|
|
a8223e |
* eval.c: Remove 'f-lang.h' include.
|
|
|
a8223e |
(value_f90_subarray): Moved to f-lang.c.
|
|
|
a8223e |
(eval_call): Renamed to...
|
|
|
a8223e |
(evaluate_subexp_do_call): ...this, is no longer static, header
|
|
|
a8223e |
comment moved into header file.
|
|
|
a8223e |
(evaluate_funcall): Update call to eval_call.
|
|
|
a8223e |
(skip_undetermined_arglist): Moved to f-lang.c.
|
|
|
a8223e |
(fortran_value_subarray): Likewise.
|
|
|
a8223e |
(evaluate_subexp_standard): OP_F77_UNDETERMINED_ARGLIST handling
|
|
|
a8223e |
moved to evaluate_subexp_f.
|
|
|
a8223e |
(calc_f77_array_dims): Moved to f-lang.c
|
|
|
a8223e |
* expprint.c (print_subexp_funcall): New function.
|
|
|
a8223e |
(print_subexp_standard): OP_F77_UNDETERMINED_ARGLIST handling
|
|
|
a8223e |
moved to print_subexp_f, OP_FUNCALL uses new function.
|
|
|
a8223e |
(dump_subexp_body_funcall): New function.
|
|
|
a8223e |
(dump_subexp_body_standard): OP_F77_UNDETERMINED_ARGLIST handling
|
|
|
a8223e |
moved to dump_subexp_f, OP_FUNCALL uses new function.
|
|
|
a8223e |
* expression.h (evaluate_subexp_do_call): Declare.
|
|
|
a8223e |
* f-lang.c (value_f90_subarray): Moved from eval.c.
|
|
|
a8223e |
(skip_undetermined_arglist): Likewise.
|
|
|
a8223e |
(calc_f77_array_dims): Likewise.
|
|
|
a8223e |
(fortran_value_subarray): Likewise.
|
|
|
a8223e |
(evaluate_subexp_f): Add OP_F77_UNDETERMINED_ARGLIST support.
|
|
|
a8223e |
(operator_length_f): Likewise.
|
|
|
a8223e |
(print_subexp_f): Likewise.
|
|
|
a8223e |
(dump_subexp_body_f): Likewise.
|
|
|
a8223e |
* fortran-operator.def (OP_F77_UNDETERMINED_ARGLIST): Move
|
|
|
a8223e |
declaration of this operation to here.
|
|
|
a8223e |
* parse.c (operator_length_standard): OP_F77_UNDETERMINED_ARGLIST
|
|
|
a8223e |
support moved to operator_length_f.
|
|
|
a8223e |
* parser-defs.h (dump_subexp_body_funcall): Declare.
|
|
|
a8223e |
(print_subexp_funcall): Declare.
|
|
|
a8223e |
* std-operator.def (OP_F77_UNDETERMINED_ARGLIST): Moved to
|
|
|
a8223e |
fortran-operator.def.
|
|
|
a8223e |
|
|
|
a8223e |
diff --git a/gdb/eval.c b/gdb/eval.c
|
|
|
a8223e |
--- a/gdb/eval.c
|
|
|
a8223e |
+++ b/gdb/eval.c
|
|
|
a8223e |
@@ -26,7 +26,6 @@
|
|
|
a8223e |
#include "frame.h"
|
|
|
a8223e |
#include "gdbthread.h"
|
|
|
a8223e |
#include "language.h" /* For CAST_IS_CONVERSION. */
|
|
|
a8223e |
-#include "f-lang.h" /* For array bound stuff. */
|
|
|
a8223e |
#include "cp-abi.h"
|
|
|
a8223e |
#include "infcall.h"
|
|
|
a8223e |
#include "objc-lang.h"
|
|
|
a8223e |
@@ -371,32 +370,6 @@ struct value *
|
|
|
a8223e |
return index;
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
-static struct value *
|
|
|
a8223e |
-value_f90_subarray (struct value *array,
|
|
|
a8223e |
- struct expression *exp, int *pos, enum noside noside)
|
|
|
a8223e |
-{
|
|
|
a8223e |
- int pc = (*pos) + 1;
|
|
|
a8223e |
- LONGEST low_bound, high_bound;
|
|
|
a8223e |
- struct type *range = check_typedef (value_type (array)->index_type ());
|
|
|
a8223e |
- enum range_type range_type
|
|
|
a8223e |
- = (enum range_type) longest_to_int (exp->elts[pc].longconst);
|
|
|
a8223e |
-
|
|
|
a8223e |
- *pos += 3;
|
|
|
a8223e |
-
|
|
|
a8223e |
- if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
|
|
|
a8223e |
- low_bound = range->bounds ()->low.const_val ();
|
|
|
a8223e |
- else
|
|
|
a8223e |
- low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
|
|
|
a8223e |
-
|
|
|
a8223e |
- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
|
|
|
a8223e |
- high_bound = range->bounds ()->high.const_val ();
|
|
|
a8223e |
- else
|
|
|
a8223e |
- high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
|
|
|
a8223e |
-
|
|
|
a8223e |
- return value_slice (array, low_bound, high_bound - low_bound + 1);
|
|
|
a8223e |
-}
|
|
|
a8223e |
-
|
|
|
a8223e |
-
|
|
|
a8223e |
/* Promote value ARG1 as appropriate before performing a unary operation
|
|
|
a8223e |
on this argument.
|
|
|
a8223e |
If the result is not appropriate for any particular language then it
|
|
|
a8223e |
@@ -749,17 +722,13 @@ class fake_method
|
|
|
a8223e |
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
-/* Evaluate a function call. The function to be called is in
|
|
|
a8223e |
- ARGVEC[0] and the arguments passed to the function are in
|
|
|
a8223e |
- ARGVEC[1..NARGS]. FUNCTION_NAME is the name of the function, if
|
|
|
a8223e |
- known. DEFAULT_RETURN_TYPE is used as the function's return type
|
|
|
a8223e |
- if the return type is unknown. */
|
|
|
a8223e |
+/* See expression.h. */
|
|
|
a8223e |
|
|
|
a8223e |
-static value *
|
|
|
a8223e |
-eval_call (expression *exp, enum noside noside,
|
|
|
a8223e |
- int nargs, value **argvec,
|
|
|
a8223e |
- const char *function_name,
|
|
|
a8223e |
- type *default_return_type)
|
|
|
a8223e |
+value *
|
|
|
a8223e |
+evaluate_subexp_do_call (expression *exp, enum noside noside,
|
|
|
a8223e |
+ int nargs, value **argvec,
|
|
|
a8223e |
+ const char *function_name,
|
|
|
a8223e |
+ type *default_return_type)
|
|
|
a8223e |
{
|
|
|
a8223e |
if (argvec[0] == NULL)
|
|
|
a8223e |
error (_("Cannot evaluate function -- may be inlined"));
|
|
|
a8223e |
@@ -1230,20 +1199,8 @@ class fake_method
|
|
|
a8223e |
/* Nothing to be done; argvec already correctly set up. */
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
- return eval_call (exp, noside, nargs, argvec, var_func_name, expect_type);
|
|
|
a8223e |
-}
|
|
|
a8223e |
-
|
|
|
a8223e |
-/* Helper for skipping all the arguments in an undetermined argument list.
|
|
|
a8223e |
- This function was designed for use in the OP_F77_UNDETERMINED_ARGLIST
|
|
|
a8223e |
- case of evaluate_subexp_standard as multiple, but not all, code paths
|
|
|
a8223e |
- require a generic skip. */
|
|
|
a8223e |
-
|
|
|
a8223e |
-static void
|
|
|
a8223e |
-skip_undetermined_arglist (int nargs, struct expression *exp, int *pos,
|
|
|
a8223e |
- enum noside noside)
|
|
|
a8223e |
-{
|
|
|
a8223e |
- for (int i = 0; i < nargs; ++i)
|
|
|
a8223e |
- evaluate_subexp (nullptr, exp, pos, noside);
|
|
|
a8223e |
+ return evaluate_subexp_do_call (exp, noside, nargs, argvec,
|
|
|
a8223e |
+ var_func_name, expect_type);
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
/* Return true if type is integral or reference to integral */
|
|
|
a8223e |
@@ -1260,67 +1217,6 @@ class fake_method
|
|
|
a8223e |
&& is_integral_type (TYPE_TARGET_TYPE (type)));
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
-/* Called from evaluate_subexp_standard to perform array indexing, and
|
|
|
a8223e |
- sub-range extraction, for Fortran. As well as arrays this function
|
|
|
a8223e |
- also handles strings as they can be treated like arrays of characters.
|
|
|
a8223e |
- ARRAY is the array or string being accessed. EXP, POS, and NOSIDE are
|
|
|
a8223e |
- as for evaluate_subexp_standard, and NARGS is the number of arguments
|
|
|
a8223e |
- in this access (e.g. 'array (1,2,3)' would be NARGS 3). */
|
|
|
a8223e |
-
|
|
|
a8223e |
-static struct value *
|
|
|
a8223e |
-fortran_value_subarray (struct value *array, struct expression *exp,
|
|
|
a8223e |
- int *pos, int nargs, enum noside noside)
|
|
|
a8223e |
-{
|
|
|
a8223e |
- if (exp->elts[*pos].opcode == OP_RANGE)
|
|
|
a8223e |
- return value_f90_subarray (array, exp, pos, noside);
|
|
|
a8223e |
-
|
|
|
a8223e |
- if (noside == EVAL_SKIP)
|
|
|
a8223e |
- {
|
|
|
a8223e |
- skip_undetermined_arglist (nargs, exp, pos, noside);
|
|
|
a8223e |
- /* Return the dummy value with the correct type. */
|
|
|
a8223e |
- return array;
|
|
|
a8223e |
- }
|
|
|
a8223e |
-
|
|
|
a8223e |
- LONGEST subscript_array[MAX_FORTRAN_DIMS];
|
|
|
a8223e |
- int ndimensions = 1;
|
|
|
a8223e |
- struct type *type = check_typedef (value_type (array));
|
|
|
a8223e |
-
|
|
|
a8223e |
- if (nargs > MAX_FORTRAN_DIMS)
|
|
|
a8223e |
- error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
|
|
|
a8223e |
-
|
|
|
a8223e |
- ndimensions = calc_f77_array_dims (type);
|
|
|
a8223e |
-
|
|
|
a8223e |
- if (nargs != ndimensions)
|
|
|
a8223e |
- error (_("Wrong number of subscripts"));
|
|
|
a8223e |
-
|
|
|
a8223e |
- gdb_assert (nargs > 0);
|
|
|
a8223e |
-
|
|
|
a8223e |
- /* Now that we know we have a legal array subscript expression let us
|
|
|
a8223e |
- actually find out where this element exists in the array. */
|
|
|
a8223e |
-
|
|
|
a8223e |
- /* Take array indices left to right. */
|
|
|
a8223e |
- for (int i = 0; i < nargs; i++)
|
|
|
a8223e |
- {
|
|
|
a8223e |
- /* Evaluate each subscript; it must be a legal integer in F77. */
|
|
|
a8223e |
- value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
a8223e |
-
|
|
|
a8223e |
- /* Fill in the subscript array. */
|
|
|
a8223e |
- subscript_array[i] = value_as_long (arg2);
|
|
|
a8223e |
- }
|
|
|
a8223e |
-
|
|
|
a8223e |
- /* Internal type of array is arranged right to left. */
|
|
|
a8223e |
- for (int i = nargs; i > 0; i--)
|
|
|
a8223e |
- {
|
|
|
a8223e |
- struct type *array_type = check_typedef (value_type (array));
|
|
|
a8223e |
- LONGEST index = subscript_array[i - 1];
|
|
|
a8223e |
-
|
|
|
a8223e |
- array = value_subscripted_rvalue (array, index,
|
|
|
a8223e |
- f77_get_lowerbound (array_type));
|
|
|
a8223e |
- }
|
|
|
a8223e |
-
|
|
|
a8223e |
- return array;
|
|
|
a8223e |
-}
|
|
|
a8223e |
-
|
|
|
a8223e |
struct value *
|
|
|
a8223e |
evaluate_subexp_standard (struct type *expect_type,
|
|
|
a8223e |
struct expression *exp, int *pos,
|
|
|
a8223e |
@@ -1335,7 +1231,6 @@ struct value *
|
|
|
a8223e |
struct type *type;
|
|
|
a8223e |
int nargs;
|
|
|
a8223e |
struct value **argvec;
|
|
|
a8223e |
- int code;
|
|
|
a8223e |
int ix;
|
|
|
a8223e |
long mem_offset;
|
|
|
a8223e |
struct type **arg_types;
|
|
|
a8223e |
@@ -1976,84 +1871,6 @@ struct value *
|
|
|
a8223e |
case OP_FUNCALL:
|
|
|
a8223e |
return evaluate_funcall (expect_type, exp, pos, noside);
|
|
|
a8223e |
|
|
|
a8223e |
- case OP_F77_UNDETERMINED_ARGLIST:
|
|
|
a8223e |
-
|
|
|
a8223e |
- /* Remember that in F77, functions, substring ops and
|
|
|
a8223e |
- array subscript operations cannot be disambiguated
|
|
|
a8223e |
- at parse time. We have made all array subscript operations,
|
|
|
a8223e |
- substring operations as well as function calls come here
|
|
|
a8223e |
- and we now have to discover what the heck this thing actually was.
|
|
|
a8223e |
- If it is a function, we process just as if we got an OP_FUNCALL. */
|
|
|
a8223e |
-
|
|
|
a8223e |
- nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
|
|
a8223e |
- (*pos) += 2;
|
|
|
a8223e |
-
|
|
|
a8223e |
- /* First determine the type code we are dealing with. */
|
|
|
a8223e |
- arg1 = evaluate_subexp (nullptr, exp, pos, noside);
|
|
|
a8223e |
- type = check_typedef (value_type (arg1));
|
|
|
a8223e |
- code = type->code ();
|
|
|
a8223e |
-
|
|
|
a8223e |
- if (code == TYPE_CODE_PTR)
|
|
|
a8223e |
- {
|
|
|
a8223e |
- /* Fortran always passes variable to subroutines as pointer.
|
|
|
a8223e |
- So we need to look into its target type to see if it is
|
|
|
a8223e |
- array, string or function. If it is, we need to switch
|
|
|
a8223e |
- to the target value the original one points to. */
|
|
|
a8223e |
- struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
|
|
|
a8223e |
-
|
|
|
a8223e |
- if (target_type->code () == TYPE_CODE_ARRAY
|
|
|
a8223e |
- || target_type->code () == TYPE_CODE_STRING
|
|
|
a8223e |
- || target_type->code () == TYPE_CODE_FUNC)
|
|
|
a8223e |
- {
|
|
|
a8223e |
- arg1 = value_ind (arg1);
|
|
|
a8223e |
- type = check_typedef (value_type (arg1));
|
|
|
a8223e |
- code = type->code ();
|
|
|
a8223e |
- }
|
|
|
a8223e |
- }
|
|
|
a8223e |
-
|
|
|
a8223e |
- switch (code)
|
|
|
a8223e |
- {
|
|
|
a8223e |
- case TYPE_CODE_ARRAY:
|
|
|
a8223e |
- case TYPE_CODE_STRING:
|
|
|
a8223e |
- return fortran_value_subarray (arg1, exp, pos, nargs, noside);
|
|
|
a8223e |
-
|
|
|
a8223e |
- case TYPE_CODE_PTR:
|
|
|
a8223e |
- case TYPE_CODE_FUNC:
|
|
|
a8223e |
- case TYPE_CODE_INTERNAL_FUNCTION:
|
|
|
a8223e |
- /* It's a function call. */
|
|
|
a8223e |
- /* Allocate arg vector, including space for the function to be
|
|
|
a8223e |
- called in argvec[0] and a terminating NULL. */
|
|
|
a8223e |
- argvec = (struct value **)
|
|
|
a8223e |
- alloca (sizeof (struct value *) * (nargs + 2));
|
|
|
a8223e |
- argvec[0] = arg1;
|
|
|
a8223e |
- tem = 1;
|
|
|
a8223e |
- for (; tem <= nargs; tem++)
|
|
|
a8223e |
- {
|
|
|
a8223e |
- argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
a8223e |
- /* Arguments in Fortran are passed by address. Coerce the
|
|
|
a8223e |
- arguments here rather than in value_arg_coerce as otherwise
|
|
|
a8223e |
- the call to malloc to place the non-lvalue parameters in
|
|
|
a8223e |
- target memory is hit by this Fortran specific logic. This
|
|
|
a8223e |
- results in malloc being called with a pointer to an integer
|
|
|
a8223e |
- followed by an attempt to malloc the arguments to malloc in
|
|
|
a8223e |
- target memory. Infinite recursion ensues. */
|
|
|
a8223e |
- if (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC)
|
|
|
a8223e |
- {
|
|
|
a8223e |
- bool is_artificial
|
|
|
a8223e |
- = TYPE_FIELD_ARTIFICIAL (value_type (arg1), tem - 1);
|
|
|
a8223e |
- argvec[tem] = fortran_argument_convert (argvec[tem],
|
|
|
a8223e |
- is_artificial);
|
|
|
a8223e |
- }
|
|
|
a8223e |
- }
|
|
|
a8223e |
- argvec[tem] = 0; /* signal end of arglist */
|
|
|
a8223e |
- if (noside == EVAL_SKIP)
|
|
|
a8223e |
- return eval_skip_value (exp);
|
|
|
a8223e |
- return eval_call (exp, noside, nargs, argvec, NULL, expect_type);
|
|
|
a8223e |
-
|
|
|
a8223e |
- default:
|
|
|
a8223e |
- error (_("Cannot perform substring on this type"));
|
|
|
a8223e |
- }
|
|
|
a8223e |
-
|
|
|
a8223e |
case OP_COMPLEX:
|
|
|
a8223e |
/* We have a complex number, There should be 2 floating
|
|
|
a8223e |
point numbers that compose it. */
|
|
|
a8223e |
@@ -3346,27 +3163,3 @@ struct type *
|
|
|
a8223e |
error (_("Internal error in eval_type."));
|
|
|
a8223e |
return expr->elts[1].type;
|
|
|
a8223e |
}
|
|
|
a8223e |
-
|
|
|
a8223e |
-/* Return the number of dimensions for a Fortran array or string. */
|
|
|
a8223e |
-
|
|
|
a8223e |
-int
|
|
|
a8223e |
-calc_f77_array_dims (struct type *array_type)
|
|
|
a8223e |
-{
|
|
|
a8223e |
- int ndimen = 1;
|
|
|
a8223e |
- struct type *tmp_type;
|
|
|
a8223e |
-
|
|
|
a8223e |
- if ((array_type->code () == TYPE_CODE_STRING))
|
|
|
a8223e |
- return 1;
|
|
|
a8223e |
-
|
|
|
a8223e |
- if ((array_type->code () != TYPE_CODE_ARRAY))
|
|
|
a8223e |
- error (_("Can't get dimensions for a non-array type"));
|
|
|
a8223e |
-
|
|
|
a8223e |
- tmp_type = array_type;
|
|
|
a8223e |
-
|
|
|
a8223e |
- while ((tmp_type = TYPE_TARGET_TYPE (tmp_type)))
|
|
|
a8223e |
- {
|
|
|
a8223e |
- if (tmp_type->code () == TYPE_CODE_ARRAY)
|
|
|
a8223e |
- ++ndimen;
|
|
|
a8223e |
- }
|
|
|
a8223e |
- return ndimen;
|
|
|
a8223e |
-}
|
|
|
a8223e |
diff --git a/gdb/expprint.c b/gdb/expprint.c
|
|
|
a8223e |
--- a/gdb/expprint.c
|
|
|
a8223e |
+++ b/gdb/expprint.c
|
|
|
a8223e |
@@ -53,6 +53,25 @@
|
|
|
a8223e |
exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec);
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
+/* See parser-defs.h. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+void
|
|
|
a8223e |
+print_subexp_funcall (struct expression *exp, int *pos,
|
|
|
a8223e |
+ struct ui_file *stream)
|
|
|
a8223e |
+{
|
|
|
a8223e |
+ (*pos) += 2;
|
|
|
a8223e |
+ unsigned nargs = longest_to_int (exp->elts[*pos].longconst);
|
|
|
a8223e |
+ print_subexp (exp, pos, stream, PREC_SUFFIX);
|
|
|
a8223e |
+ fputs_filtered (" (", stream);
|
|
|
a8223e |
+ for (unsigned tem = 0; tem < nargs; tem++)
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ if (tem != 0)
|
|
|
a8223e |
+ fputs_filtered (", ", stream);
|
|
|
a8223e |
+ print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+ fputs_filtered (")", stream);
|
|
|
a8223e |
+}
|
|
|
a8223e |
+
|
|
|
a8223e |
/* Standard implementation of print_subexp for use in language_defn
|
|
|
a8223e |
vectors. */
|
|
|
a8223e |
void
|
|
|
a8223e |
@@ -187,18 +206,7 @@
|
|
|
a8223e |
return;
|
|
|
a8223e |
|
|
|
a8223e |
case OP_FUNCALL:
|
|
|
a8223e |
- case OP_F77_UNDETERMINED_ARGLIST:
|
|
|
a8223e |
- (*pos) += 2;
|
|
|
a8223e |
- nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
|
|
a8223e |
- print_subexp (exp, pos, stream, PREC_SUFFIX);
|
|
|
a8223e |
- fputs_filtered (" (", stream);
|
|
|
a8223e |
- for (tem = 0; tem < nargs; tem++)
|
|
|
a8223e |
- {
|
|
|
a8223e |
- if (tem != 0)
|
|
|
a8223e |
- fputs_filtered (", ", stream);
|
|
|
a8223e |
- print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
|
|
|
a8223e |
- }
|
|
|
a8223e |
- fputs_filtered (")", stream);
|
|
|
a8223e |
+ print_subexp_funcall (exp, pos, stream);
|
|
|
a8223e |
return;
|
|
|
a8223e |
|
|
|
a8223e |
case OP_NAME:
|
|
|
a8223e |
@@ -796,6 +804,22 @@
|
|
|
a8223e |
return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt);
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
+/* See parser-defs.h. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+int
|
|
|
a8223e |
+dump_subexp_body_funcall (struct expression *exp,
|
|
|
a8223e |
+ struct ui_file *stream, int elt)
|
|
|
a8223e |
+{
|
|
|
a8223e |
+ int nargs = longest_to_int (exp->elts[elt].longconst);
|
|
|
a8223e |
+ fprintf_filtered (stream, "Number of args: %d", nargs);
|
|
|
a8223e |
+ elt += 2;
|
|
|
a8223e |
+
|
|
|
a8223e |
+ for (int i = 1; i <= nargs + 1; i++)
|
|
|
a8223e |
+ elt = dump_subexp (exp, stream, elt);
|
|
|
a8223e |
+
|
|
|
a8223e |
+ return elt;
|
|
|
a8223e |
+}
|
|
|
a8223e |
+
|
|
|
a8223e |
/* Default value for subexp_body in exp_descriptor vector. */
|
|
|
a8223e |
|
|
|
a8223e |
int
|
|
|
a8223e |
@@ -931,18 +955,7 @@
|
|
|
a8223e |
elt += 2;
|
|
|
a8223e |
break;
|
|
|
a8223e |
case OP_FUNCALL:
|
|
|
a8223e |
- case OP_F77_UNDETERMINED_ARGLIST:
|
|
|
a8223e |
- {
|
|
|
a8223e |
- int i, nargs;
|
|
|
a8223e |
-
|
|
|
a8223e |
- nargs = longest_to_int (exp->elts[elt].longconst);
|
|
|
a8223e |
-
|
|
|
a8223e |
- fprintf_filtered (stream, "Number of args: %d", nargs);
|
|
|
a8223e |
- elt += 2;
|
|
|
a8223e |
-
|
|
|
a8223e |
- for (i = 1; i <= nargs + 1; i++)
|
|
|
a8223e |
- elt = dump_subexp (exp, stream, elt);
|
|
|
a8223e |
- }
|
|
|
a8223e |
+ elt = dump_subexp_body_funcall (exp, stream, elt);
|
|
|
a8223e |
break;
|
|
|
a8223e |
case OP_ARRAY:
|
|
|
a8223e |
{
|
|
|
a8223e |
diff --git a/gdb/expression.h b/gdb/expression.h
|
|
|
a8223e |
--- a/gdb/expression.h
|
|
|
a8223e |
+++ b/gdb/expression.h
|
|
|
a8223e |
@@ -155,6 +155,18 @@ enum noside
|
|
|
a8223e |
extern struct value *evaluate_subexp_standard
|
|
|
a8223e |
(struct type *, struct expression *, int *, enum noside);
|
|
|
a8223e |
|
|
|
a8223e |
+/* Evaluate a function call. The function to be called is in ARGVEC[0] and
|
|
|
a8223e |
+ the arguments passed to the function are in ARGVEC[1..NARGS].
|
|
|
a8223e |
+ FUNCTION_NAME is the name of the function, if known.
|
|
|
a8223e |
+ DEFAULT_RETURN_TYPE is used as the function's return type if the return
|
|
|
a8223e |
+ type is unknown. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+extern struct value *evaluate_subexp_do_call (expression *exp,
|
|
|
a8223e |
+ enum noside noside,
|
|
|
a8223e |
+ int nargs, value **argvec,
|
|
|
a8223e |
+ const char *function_name,
|
|
|
a8223e |
+ type *default_return_type);
|
|
|
a8223e |
+
|
|
|
a8223e |
/* From expprint.c */
|
|
|
a8223e |
|
|
|
a8223e |
extern void print_expression (struct expression *, struct ui_file *);
|
|
|
a8223e |
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
|
|
|
a8223e |
--- a/gdb/f-lang.c
|
|
|
a8223e |
+++ b/gdb/f-lang.c
|
|
|
a8223e |
@@ -114,6 +114,134 @@ enum f_primitive_types {
|
|
|
a8223e |
nr_f_primitive_types
|
|
|
a8223e |
};
|
|
|
a8223e |
|
|
|
a8223e |
+/* Called from fortran_value_subarray to take a slice of an array or a
|
|
|
a8223e |
+ string. ARRAY is the array or string to be accessed. EXP, POS, and
|
|
|
a8223e |
+ NOSIDE are as for evaluate_subexp_standard. Return a value that is a
|
|
|
a8223e |
+ slice of the array. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+static struct value *
|
|
|
a8223e |
+value_f90_subarray (struct value *array,
|
|
|
a8223e |
+ struct expression *exp, int *pos, enum noside noside)
|
|
|
a8223e |
+{
|
|
|
a8223e |
+ int pc = (*pos) + 1;
|
|
|
a8223e |
+ LONGEST low_bound, high_bound;
|
|
|
a8223e |
+ struct type *range = check_typedef (value_type (array)->index_type ());
|
|
|
a8223e |
+ enum range_type range_type
|
|
|
a8223e |
+ = (enum range_type) longest_to_int (exp->elts[pc].longconst);
|
|
|
a8223e |
+
|
|
|
a8223e |
+ *pos += 3;
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
|
|
|
a8223e |
+ low_bound = range->bounds ()->low.const_val ();
|
|
|
a8223e |
+ else
|
|
|
a8223e |
+ low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
|
|
|
a8223e |
+ high_bound = range->bounds ()->high.const_val ();
|
|
|
a8223e |
+ else
|
|
|
a8223e |
+ high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
|
|
|
a8223e |
+
|
|
|
a8223e |
+ return value_slice (array, low_bound, high_bound - low_bound + 1);
|
|
|
a8223e |
+}
|
|
|
a8223e |
+
|
|
|
a8223e |
+/* Helper for skipping all the arguments in an undetermined argument list.
|
|
|
a8223e |
+ This function was designed for use in the OP_F77_UNDETERMINED_ARGLIST
|
|
|
a8223e |
+ case of evaluate_subexp_standard as multiple, but not all, code paths
|
|
|
a8223e |
+ require a generic skip. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+static void
|
|
|
a8223e |
+skip_undetermined_arglist (int nargs, struct expression *exp, int *pos,
|
|
|
a8223e |
+ enum noside noside)
|
|
|
a8223e |
+{
|
|
|
a8223e |
+ for (int i = 0; i < nargs; ++i)
|
|
|
a8223e |
+ evaluate_subexp (nullptr, exp, pos, noside);
|
|
|
a8223e |
+}
|
|
|
a8223e |
+
|
|
|
a8223e |
+/* Return the number of dimensions for a Fortran array or string. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+int
|
|
|
a8223e |
+calc_f77_array_dims (struct type *array_type)
|
|
|
a8223e |
+{
|
|
|
a8223e |
+ int ndimen = 1;
|
|
|
a8223e |
+ struct type *tmp_type;
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if ((array_type->code () == TYPE_CODE_STRING))
|
|
|
a8223e |
+ return 1;
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if ((array_type->code () != TYPE_CODE_ARRAY))
|
|
|
a8223e |
+ error (_("Can't get dimensions for a non-array type"));
|
|
|
a8223e |
+
|
|
|
a8223e |
+ tmp_type = array_type;
|
|
|
a8223e |
+
|
|
|
a8223e |
+ while ((tmp_type = TYPE_TARGET_TYPE (tmp_type)))
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ if (tmp_type->code () == TYPE_CODE_ARRAY)
|
|
|
a8223e |
+ ++ndimen;
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+ return ndimen;
|
|
|
a8223e |
+}
|
|
|
a8223e |
+
|
|
|
a8223e |
+/* Called from evaluate_subexp_standard to perform array indexing, and
|
|
|
a8223e |
+ sub-range extraction, for Fortran. As well as arrays this function
|
|
|
a8223e |
+ also handles strings as they can be treated like arrays of characters.
|
|
|
a8223e |
+ ARRAY is the array or string being accessed. EXP, POS, and NOSIDE are
|
|
|
a8223e |
+ as for evaluate_subexp_standard, and NARGS is the number of arguments
|
|
|
a8223e |
+ in this access (e.g. 'array (1,2,3)' would be NARGS 3). */
|
|
|
a8223e |
+
|
|
|
a8223e |
+static struct value *
|
|
|
a8223e |
+fortran_value_subarray (struct value *array, struct expression *exp,
|
|
|
a8223e |
+ int *pos, int nargs, enum noside noside)
|
|
|
a8223e |
+{
|
|
|
a8223e |
+ if (exp->elts[*pos].opcode == OP_RANGE)
|
|
|
a8223e |
+ return value_f90_subarray (array, exp, pos, noside);
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if (noside == EVAL_SKIP)
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ skip_undetermined_arglist (nargs, exp, pos, noside);
|
|
|
a8223e |
+ /* Return the dummy value with the correct type. */
|
|
|
a8223e |
+ return array;
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+
|
|
|
a8223e |
+ LONGEST subscript_array[MAX_FORTRAN_DIMS];
|
|
|
a8223e |
+ int ndimensions = 1;
|
|
|
a8223e |
+ struct type *type = check_typedef (value_type (array));
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if (nargs > MAX_FORTRAN_DIMS)
|
|
|
a8223e |
+ error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
|
|
|
a8223e |
+
|
|
|
a8223e |
+ ndimensions = calc_f77_array_dims (type);
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if (nargs != ndimensions)
|
|
|
a8223e |
+ error (_("Wrong number of subscripts"));
|
|
|
a8223e |
+
|
|
|
a8223e |
+ gdb_assert (nargs > 0);
|
|
|
a8223e |
+
|
|
|
a8223e |
+ /* Now that we know we have a legal array subscript expression let us
|
|
|
a8223e |
+ actually find out where this element exists in the array. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+ /* Take array indices left to right. */
|
|
|
a8223e |
+ for (int i = 0; i < nargs; i++)
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ /* Evaluate each subscript; it must be a legal integer in F77. */
|
|
|
a8223e |
+ value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
a8223e |
+
|
|
|
a8223e |
+ /* Fill in the subscript array. */
|
|
|
a8223e |
+ subscript_array[i] = value_as_long (arg2);
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+
|
|
|
a8223e |
+ /* Internal type of array is arranged right to left. */
|
|
|
a8223e |
+ for (int i = nargs; i > 0; i--)
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ struct type *array_type = check_typedef (value_type (array));
|
|
|
a8223e |
+ LONGEST index = subscript_array[i - 1];
|
|
|
a8223e |
+
|
|
|
a8223e |
+ array = value_subscripted_rvalue (array, index,
|
|
|
a8223e |
+ f77_get_lowerbound (array_type));
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+
|
|
|
a8223e |
+ return array;
|
|
|
a8223e |
+}
|
|
|
a8223e |
+
|
|
|
a8223e |
/* Special expression evaluation cases for Fortran. */
|
|
|
a8223e |
|
|
|
a8223e |
static struct value *
|
|
|
a8223e |
@@ -285,6 +413,87 @@ enum f_primitive_types {
|
|
|
a8223e |
TYPE_LENGTH (type));
|
|
|
a8223e |
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
|
|
|
a8223e |
TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
|
|
|
a8223e |
+
|
|
|
a8223e |
+
|
|
|
a8223e |
+ case OP_F77_UNDETERMINED_ARGLIST:
|
|
|
a8223e |
+ /* Remember that in F77, functions, substring ops and array subscript
|
|
|
a8223e |
+ operations cannot be disambiguated at parse time. We have made
|
|
|
a8223e |
+ all array subscript operations, substring operations as well as
|
|
|
a8223e |
+ function calls come here and we now have to discover what the heck
|
|
|
a8223e |
+ this thing actually was. If it is a function, we process just as
|
|
|
a8223e |
+ if we got an OP_FUNCALL. */
|
|
|
a8223e |
+ int nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
|
|
a8223e |
+ (*pos) += 2;
|
|
|
a8223e |
+
|
|
|
a8223e |
+ /* First determine the type code we are dealing with. */
|
|
|
a8223e |
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
|
|
|
a8223e |
+ type = check_typedef (value_type (arg1));
|
|
|
a8223e |
+ enum type_code code = type->code ();
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if (code == TYPE_CODE_PTR)
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ /* Fortran always passes variable to subroutines as pointer.
|
|
|
a8223e |
+ So we need to look into its target type to see if it is
|
|
|
a8223e |
+ array, string or function. If it is, we need to switch
|
|
|
a8223e |
+ to the target value the original one points to. */
|
|
|
a8223e |
+ struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if (target_type->code () == TYPE_CODE_ARRAY
|
|
|
a8223e |
+ || target_type->code () == TYPE_CODE_STRING
|
|
|
a8223e |
+ || target_type->code () == TYPE_CODE_FUNC)
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ arg1 = value_ind (arg1);
|
|
|
a8223e |
+ type = check_typedef (value_type (arg1));
|
|
|
a8223e |
+ code = type->code ();
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+
|
|
|
a8223e |
+ switch (code)
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ case TYPE_CODE_ARRAY:
|
|
|
a8223e |
+ case TYPE_CODE_STRING:
|
|
|
a8223e |
+ return fortran_value_subarray (arg1, exp, pos, nargs, noside);
|
|
|
a8223e |
+
|
|
|
a8223e |
+ case TYPE_CODE_PTR:
|
|
|
a8223e |
+ case TYPE_CODE_FUNC:
|
|
|
a8223e |
+ case TYPE_CODE_INTERNAL_FUNCTION:
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ /* It's a function call. Allocate arg vector, including
|
|
|
a8223e |
+ space for the function to be called in argvec[0] and a
|
|
|
a8223e |
+ termination NULL. */
|
|
|
a8223e |
+ struct value **argvec = (struct value **)
|
|
|
a8223e |
+ alloca (sizeof (struct value *) * (nargs + 2));
|
|
|
a8223e |
+ argvec[0] = arg1;
|
|
|
a8223e |
+ int tem = 1;
|
|
|
a8223e |
+ for (; tem <= nargs; tem++)
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
a8223e |
+ /* Arguments in Fortran are passed by address. Coerce the
|
|
|
a8223e |
+ arguments here rather than in value_arg_coerce as
|
|
|
a8223e |
+ otherwise the call to malloc to place the non-lvalue
|
|
|
a8223e |
+ parameters in target memory is hit by this Fortran
|
|
|
a8223e |
+ specific logic. This results in malloc being called
|
|
|
a8223e |
+ with a pointer to an integer followed by an attempt to
|
|
|
a8223e |
+ malloc the arguments to malloc in target memory.
|
|
|
a8223e |
+ Infinite recursion ensues. */
|
|
|
a8223e |
+ if (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC)
|
|
|
a8223e |
+ {
|
|
|
a8223e |
+ bool is_artificial
|
|
|
a8223e |
+ = TYPE_FIELD_ARTIFICIAL (value_type (arg1), tem - 1);
|
|
|
a8223e |
+ argvec[tem] = fortran_argument_convert (argvec[tem],
|
|
|
a8223e |
+ is_artificial);
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+ argvec[tem] = 0; /* signal end of arglist */
|
|
|
a8223e |
+ if (noside == EVAL_SKIP)
|
|
|
a8223e |
+ return eval_skip_value (exp);
|
|
|
a8223e |
+ return evaluate_subexp_do_call (exp, noside, nargs, argvec, NULL,
|
|
|
a8223e |
+ expect_type);
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+
|
|
|
a8223e |
+ default:
|
|
|
a8223e |
+ error (_("Cannot perform substring on this type"));
|
|
|
a8223e |
+ }
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
/* Should be unreachable. */
|
|
|
a8223e |
@@ -318,6 +527,11 @@ enum f_primitive_types {
|
|
|
a8223e |
oplen = 1;
|
|
|
a8223e |
args = 2;
|
|
|
a8223e |
break;
|
|
|
a8223e |
+
|
|
|
a8223e |
+ case OP_F77_UNDETERMINED_ARGLIST:
|
|
|
a8223e |
+ oplen = 3;
|
|
|
a8223e |
+ args = 1 + longest_to_int (exp->elts[pc - 2].longconst);
|
|
|
a8223e |
+ break;
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
*oplenp = oplen;
|
|
|
a8223e |
@@ -390,6 +604,10 @@ enum f_primitive_types {
|
|
|
a8223e |
case BINOP_FORTRAN_MODULO:
|
|
|
a8223e |
print_binop_subexp_f (exp, pos, stream, prec, "MODULO");
|
|
|
a8223e |
return;
|
|
|
a8223e |
+
|
|
|
a8223e |
+ case OP_F77_UNDETERMINED_ARGLIST:
|
|
|
a8223e |
+ print_subexp_funcall (exp, pos, stream);
|
|
|
a8223e |
+ return;
|
|
|
a8223e |
}
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
@@ -432,6 +650,9 @@ enum f_primitive_types {
|
|
|
a8223e |
case BINOP_FORTRAN_MODULO:
|
|
|
a8223e |
operator_length_f (exp, (elt + 1), &oplen, &nargs);
|
|
|
a8223e |
break;
|
|
|
a8223e |
+
|
|
|
a8223e |
+ case OP_F77_UNDETERMINED_ARGLIST:
|
|
|
a8223e |
+ return dump_subexp_body_funcall (exp, stream, elt);
|
|
|
a8223e |
}
|
|
|
a8223e |
|
|
|
a8223e |
elt += oplen;
|
|
|
a8223e |
diff --git a/gdb/fortran-operator.def b/gdb/fortran-operator.def
|
|
|
a8223e |
--- a/gdb/fortran-operator.def
|
|
|
a8223e |
+++ b/gdb/fortran-operator.def
|
|
|
a8223e |
@@ -17,6 +17,14 @@
|
|
|
a8223e |
You should have received a copy of the GNU General Public License
|
|
|
a8223e |
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
a8223e |
|
|
|
a8223e |
+/* This is EXACTLY like OP_FUNCALL but is semantically different.
|
|
|
a8223e |
+ In F77, array subscript expressions, substring expressions and
|
|
|
a8223e |
+ function calls are all exactly the same syntactically. They
|
|
|
a8223e |
+ may only be disambiguated at runtime. Thus this operator,
|
|
|
a8223e |
+ which indicates that we have found something of the form
|
|
|
a8223e |
+ <name> ( <stuff> ). */
|
|
|
a8223e |
+OP (OP_F77_UNDETERMINED_ARGLIST)
|
|
|
a8223e |
+
|
|
|
a8223e |
/* Single operand builtins. */
|
|
|
a8223e |
OP (UNOP_FORTRAN_KIND)
|
|
|
a8223e |
OP (UNOP_FORTRAN_FLOOR)
|
|
|
a8223e |
diff --git a/gdb/parse.c b/gdb/parse.c
|
|
|
a8223e |
--- a/gdb/parse.c
|
|
|
a8223e |
+++ b/gdb/parse.c
|
|
|
a8223e |
@@ -817,7 +817,6 @@ static expression_up parse_exp_in_context (const char **, CORE_ADDR,
|
|
|
a8223e |
break;
|
|
|
a8223e |
|
|
|
a8223e |
case OP_FUNCALL:
|
|
|
a8223e |
- case OP_F77_UNDETERMINED_ARGLIST:
|
|
|
a8223e |
oplen = 3;
|
|
|
a8223e |
args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
|
|
|
a8223e |
break;
|
|
|
a8223e |
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
|
|
|
a8223e |
--- a/gdb/parser-defs.h
|
|
|
a8223e |
+++ b/gdb/parser-defs.h
|
|
|
a8223e |
@@ -338,6 +338,13 @@ extern void write_exp_msymbol (struct expr_builder *,
|
|
|
a8223e |
extern int dump_subexp_body_standard (struct expression *,
|
|
|
a8223e |
struct ui_file *, int);
|
|
|
a8223e |
|
|
|
a8223e |
+/* Dump (to STREAM) a function call like expression at position ELT in the
|
|
|
a8223e |
+ expression array EXP. Return a new value for ELT just after the
|
|
|
a8223e |
+ function call expression. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+extern int dump_subexp_body_funcall (struct expression *exp,
|
|
|
a8223e |
+ struct ui_file *stream, int elt);
|
|
|
a8223e |
+
|
|
|
a8223e |
extern void operator_length (const struct expression *, int, int *, int *);
|
|
|
a8223e |
|
|
|
a8223e |
extern void operator_length_standard (const struct expression *, int, int *,
|
|
|
a8223e |
@@ -440,6 +447,15 @@ extern void print_subexp (struct expression *, int *, struct ui_file *,
|
|
|
a8223e |
extern void print_subexp_standard (struct expression *, int *,
|
|
|
a8223e |
struct ui_file *, enum precedence);
|
|
|
a8223e |
|
|
|
a8223e |
+/* Print a function call like expression to STREAM. This is called as a
|
|
|
a8223e |
+ helper function by which point the expression node identifying this as a
|
|
|
a8223e |
+ function call has already been stripped off and POS should point to the
|
|
|
a8223e |
+ number of function call arguments. EXP is the object containing the
|
|
|
a8223e |
+ list of expression elements. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+extern void print_subexp_funcall (struct expression *exp, int *pos,
|
|
|
a8223e |
+ struct ui_file *stream);
|
|
|
a8223e |
+
|
|
|
a8223e |
/* Function used to avoid direct calls to fprintf
|
|
|
a8223e |
in the code generated by the bison parser. */
|
|
|
a8223e |
|
|
|
a8223e |
diff --git a/gdb/std-operator.def b/gdb/std-operator.def
|
|
|
a8223e |
--- a/gdb/std-operator.def
|
|
|
a8223e |
+++ b/gdb/std-operator.def
|
|
|
a8223e |
@@ -168,14 +168,6 @@ OP (OP_FUNCALL)
|
|
|
a8223e |
pointer. This is an Objective C message. */
|
|
|
a8223e |
OP (OP_OBJC_MSGCALL)
|
|
|
a8223e |
|
|
|
a8223e |
-/* This is EXACTLY like OP_FUNCALL but is semantically different.
|
|
|
a8223e |
- In F77, array subscript expressions, substring expressions and
|
|
|
a8223e |
- function calls are all exactly the same syntactically. They
|
|
|
a8223e |
- may only be disambiguated at runtime. Thus this operator,
|
|
|
a8223e |
- which indicates that we have found something of the form
|
|
|
a8223e |
- <name> ( <stuff> ). */
|
|
|
a8223e |
-OP (OP_F77_UNDETERMINED_ARGLIST)
|
|
|
a8223e |
-
|
|
|
a8223e |
/* OP_COMPLEX takes a type in the following element, followed by another
|
|
|
a8223e |
OP_COMPLEX, making three exp_elements. It is followed by two double
|
|
|
a8223e |
args, and converts them into a complex number of the given type. */
|