return addr;
}
-/* Like parse_and_eval_address but takes a pointer to a char * variable
- and advanced that variable across the characters parsed. */
-
-CORE_ADDR
-parse_and_eval_address_1 (char **expptr)
-{
- struct expression *expr = parse_exp_1 (expptr, (struct block *) 0, 0);
- CORE_ADDR addr;
- struct cleanup *old_chain =
- make_cleanup (free_current_contents, &expr);
-
- addr = value_as_address (evaluate_expression (expr));
- do_cleanups (old_chain);
- return addr;
-}
-
/* Like parse_and_eval_address, but treats the value of the expression
as an integer, not an address, returns a LONGEST, not a CORE_ADDR. */
LONGEST
if (method)
{
- struct block *b;
CORE_ADDR funaddr;
struct type *val_type;
funaddr = find_function_addr (method, &val_type);
- b = block_for_pc (funaddr);
+ block_for_pc (funaddr);
CHECK_TYPEDEF (val_type);
return value_zero (builtin_type (exp->gdbarch)->builtin_int,
not_lval);
}
+ else if (TYPE_GNU_IFUNC (ftype))
+ return allocate_value (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (ftype)));
else if (TYPE_TARGET_TYPE (ftype))
return allocate_value (TYPE_TARGET_TYPE (ftype));
else
{
struct value *v_one, *retval;
- v_one = value_one (value_type (arg2), not_lval);
+ v_one = value_one (value_type (arg2));
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &v_one);
retval = value_binop (arg1, v_one, op);
return retval;
}
case BINOP_RANGE:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ evaluate_subexp (NULL_TYPE, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
error (_("':' operator used in invalid context"));
multi_f77_subscript:
{
- int subscript_array[MAX_FORTRAN_DIMS];
- int array_size_array[MAX_FORTRAN_DIMS];
+ LONGEST subscript_array[MAX_FORTRAN_DIMS];
int ndimensions = 1, i;
- struct type *tmp_type;
- int offset_item; /* The array offset where the item lives. */
+ struct value *array = arg1;
if (nargs > MAX_FORTRAN_DIMS)
error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
- tmp_type = check_typedef (value_type (arg1));
ndimensions = calc_f77_array_dims (type);
if (nargs != ndimensions)
/* Now that we know we have a legal array subscript expression
let us actually find out where this element exists in the array. */
- offset_item = 0;
/* Take array indices left to right. */
for (i = 0; i < nargs; i++)
{
/* Evaluate each subscript; it must be a legal integer in F77. */
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
- /* Fill in the subscript and array size arrays. */
+ /* Fill in the subscript array. */
subscript_array[i] = value_as_long (arg2);
}
/* Internal type of array is arranged right to left. */
- for (i = 0; i < nargs; i++)
+ for (i = nargs; i > 0; i--)
{
- upper = f77_get_upperbound (tmp_type);
- lower = f77_get_lowerbound (tmp_type);
-
- array_size_array[nargs - i - 1] = upper - lower + 1;
-
- /* Zero-normalize subscripts so that offsetting will work. */
+ struct type *array_type = check_typedef (value_type (array));
+ LONGEST index = subscript_array[i - 1];
- subscript_array[nargs - i - 1] -= lower;
-
- /* If we are at the bottom of a multidimensional
- array type then keep a ptr to the last ARRAY
- type around for use when calling value_subscript()
- below. This is done because we pretend to value_subscript
- that we actually have a one-dimensional array
- of base element type that we apply a simple
- offset to. */
-
- if (i < nargs - 1)
- tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type));
+ lower = f77_get_lowerbound (array_type);
+ array = value_subscripted_rvalue (array, index, lower);
}
- /* Now let us calculate the offset for this item. */
-
- offset_item = subscript_array[ndimensions - 1];
-
- for (i = ndimensions - 1; i > 0; --i)
- offset_item =
- array_size_array[i - 1] * offset_item + subscript_array[i - 1];
-
- /* Let us now play a dirty trick: we will take arg1
- which is a value node pointing to the topmost level
- of the multidimensional array-set and pretend
- that it is actually a array of the final element
- type, this will ensure that value_subscript()
- returns the correct type value. */
-
- deprecated_set_value_type (arg1, tmp_type);
- return value_subscripted_rvalue (arg1, offset_item, 0);
+ return array;
}
case BINOP_LOGICAL_AND:
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
if (noside == EVAL_SKIP)
{
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ evaluate_subexp (NULL_TYPE, exp, pos, noside);
goto nosideret;
}
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
if (noside == EVAL_SKIP)
{
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ evaluate_subexp (NULL_TYPE, exp, pos, noside);
goto nosideret;
}
{
struct value *tmp = arg1;
- arg2 = value_one (value_type (arg1), not_lval);
+ arg2 = value_one (value_type (arg1));
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_ADD);
}
{
struct value *tmp = arg1;
- arg2 = value_one (value_type (arg1), not_lval);
+ arg2 = value_one (value_type (arg1));
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_SUB);
}
{
struct value *tmp = arg1;
- arg2 = value_one (value_type (arg1), not_lval);
+ arg2 = value_one (value_type (arg1));
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_ADD);
}
{
struct value *tmp = arg1;
- arg2 = value_one (value_type (arg1), not_lval);
+ arg2 = value_one (value_type (arg1));
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_SUB);
}
case OP_THIS:
(*pos) += 1;
- return value_of_this (1);
-
- case OP_OBJC_SELF:
- (*pos) += 1;
- return value_of_local ("self", 1);
+ return value_of_this (exp->language_defn);
case OP_TYPE:
/* The value is not supposed to be used. This is here to make it