/* Evaluate expressions for GDB.
- Copyright (C) 1986-2015 Free Software Foundation, Inc.
+ Copyright (C) 1986-2016 Free Software Foundation, Inc.
This file is part of GDB.
int preserve_errors)
{
struct value *mark, *new_mark, *result;
- volatile struct gdb_exception ex;
*valp = NULL;
if (resultp)
mark = value_mark ();
result = NULL;
- TRY_CATCH (ex, RETURN_MASK_ALL)
+ TRY
{
result = evaluate_subexp (NULL_TYPE, exp, pc, EVAL_NORMAL);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ALL)
{
/* Ignore memory errors if we want watchpoints pointing at
inaccessible memory to still be created; otherwise, throw the
break;
}
}
+ END_CATCH
new_mark = value_mark ();
if (mark == new_mark)
*valp = result;
else
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
value_fetch_lazy (result);
*valp = result;
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
}
}
int pc = (*pos) + 1;
LONGEST low_bound, high_bound;
struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array)));
- enum f90_range_type range_type = longest_to_int (exp->elts[pc].longconst);
+ enum range_type range_type
+ = (enum range_type) longest_to_int (exp->elts[pc].longconst);
*pos += 3;
TYPE_MAIN_TYPE (type) = XCNEW (struct main_type);
TYPE_LENGTH (type) = 1;
TYPE_CODE (type) = TYPE_CODE_METHOD;
- TYPE_VPTR_FIELDNO (type) = -1;
TYPE_CHAIN (type) = type;
if (num_types > 0)
{
or reference to a base class and print object is on. */
{
- volatile struct gdb_exception except;
struct value *ret = NULL;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
ret = value_of_variable (exp->elts[pc + 2].symbol,
exp->elts[pc + 1].block);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol),
else
throw_exception (except);
}
+ END_CATCH
return ret;
}
return set;
}
- argvec = (struct value **) alloca (sizeof (struct value *) * nargs);
+ argvec = XALLOCAVEC (struct value *, nargs);
for (tem = 0; tem < nargs; tem++)
{
/* Ensure that array expressions are coerced into pointer
CORE_ADDR selector = 0;
int struct_return = 0;
- int sub_no_side = 0;
+ enum noside sub_no_side = EVAL_NORMAL;
struct value *msg_send = NULL;
struct value *msg_send_stret = NULL;
selector = exp->elts[pc + 1].longconst;
nargs = exp->elts[pc + 2].longconst;
- argvec = (struct value **) alloca (sizeof (struct value *)
- * (nargs + 5));
+ argvec = XALLOCAVEC (struct value *, nargs + 5);
(*pos) += 3;
block_for_pc (funaddr);
- CHECK_TYPEDEF (val_type);
+ val_type = check_typedef (val_type);
if ((val_type == NULL)
|| (TYPE_CODE(val_type) == TYPE_CODE_ERROR))
operator and continue evaluation. */
while (unop_user_defined_p (op, arg2))
{
- volatile struct gdb_exception except;
struct value *value = NULL;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
value = value_x_unop (arg2, op, noside);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (except.error == NOT_FOUND_ERROR)
break;
else
throw_exception (except);
}
+ END_CATCH
+
arg2 = value;
}
}
function = cp_lookup_symbol_namespace (TYPE_TAG_NAME (type),
name,
get_selected_block (0),
- VAR_DOMAIN);
+ VAR_DOMAIN).symbol;
if (function == NULL)
error (_("No symbol \"%s\" in namespace \"%s\"."),
name, TYPE_TAG_NAME (type));
return value_zero (builtin_type (exp->gdbarch)->builtin_int,
not_lval);
}
+ else if (TYPE_CODE (ftype) == TYPE_CODE_XMETHOD)
+ {
+ struct type *return_type
+ = result_type_of_xmethod (argvec[0], nargs, argvec + 1);
+
+ if (return_type == NULL)
+ error (_("Xmethod is missing return type."));
+ return value_zero (return_type, not_lval);
+ }
else if (TYPE_GNU_IFUNC (ftype))
return allocate_value (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (ftype)));
else if (TYPE_TARGET_TYPE (ftype))
switch (code)
{
case TYPE_CODE_ARRAY:
- if (exp->elts[*pos].opcode == OP_F90_RANGE)
+ if (exp->elts[*pos].opcode == OP_RANGE)
return value_f90_subarray (arg1, exp, pos, noside);
else
goto multi_f77_subscript;
case TYPE_CODE_STRING:
- if (exp->elts[*pos].opcode == OP_F90_RANGE)
+ if (exp->elts[*pos].opcode == OP_RANGE)
return value_f90_subarray (arg1, exp, pos, noside);
else
{
arg3 = value_struct_elt (&arg1, NULL, &exp->elts[pc + 2].string,
NULL, "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- arg3 = value_zero (value_type (arg3), not_lval);
+ arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3));
return arg3;
case STRUCTOP_PTR:
arg1 with the value returned by evaluating operator->(). */
while (unop_user_defined_p (op, arg1))
{
- volatile struct gdb_exception except;
struct value *value = NULL;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
value = value_x_unop (arg1, op, noside);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ERROR)
{
if (except.error == NOT_FOUND_ERROR)
break;
else
throw_exception (except);
}
+ END_CATCH
+
arg1 = value;
}
{
struct type *type = value_type (arg1);
struct type *real_type;
- int full, top, using_enc;
+ int full, using_enc;
+ LONGEST top;
struct value_print_options opts;
get_user_print_options (&opts);
arg3 = value_struct_elt (&arg1, NULL, &exp->elts[pc + 2].string,
NULL, "structure pointer");
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- arg3 = value_zero (value_type (arg3), not_lval);
+ arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3));
return arg3;
case STRUCTOP_MEMBER:
if (noside == EVAL_SKIP)
goto nosideret;
type = check_typedef (value_type (arg2));
- if (TYPE_CODE (type) != TYPE_CODE_INT)
+ if (TYPE_CODE (type) != TYPE_CODE_INT
+ && TYPE_CODE (type) != TYPE_CODE_ENUM)
error (_("Non-integral right operand for \"@\" operator."));
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
/* $5.3.3/2 of the C++ Standard (n3290 draft) says of sizeof:
"When applied to a reference or a reference type, the result is
the size of the referenced type." */
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
if (exp->language_defn->la_language == language_cplus
&& TYPE_CODE (type) == TYPE_CODE_REF)
type = check_typedef (TYPE_TARGET_TYPE (type));