sym_name = renaming_sym->linkage_name ();
expression_up expr = parse_exp_1 (&sym_name, 0, block, 0);
- return evaluate_expression (expr.get ());
+ return expr->evaluate ();
}
\f
try
{
scoped_value_mark mark;
- stop = value_true (evaluate_expression (ada_loc->excep_cond_expr.get ()));
+ stop = value_true (ada_loc->excep_cond_expr->evaluate ());
}
catch (const gdb_exception_error &ex)
{
{
struct value *val;
if (args != NULL && strlen (args) > 0)
- val = evaluate_expression (parse_expression (args).get ());
+ val = parse_expression (args)->evaluate ();
else
val = access_value_history (0);
val->record_latest ();
breakpoint_cond_eval (expression *exp)
{
scoped_value_mark mark;
- return value_true (evaluate_expression (exp));
+ return value_true (exp->evaluate ());
}
/* Allocate a new bpstat. Link it to the FIFO list by BS_LINK_POINTER. */
/* Evaluate the expression. */
{
scoped_value_mark mark;
- value *val = evaluate_expression (expr.get ());
+ value *val = expr->evaluate ();
cond_result = value_true (val);
}
/* Evaluate the conditional. */
{
scoped_value_mark mark;
- value *val = evaluate_expression (expr.get ());
+ value *val = expr->evaluate ();
/* Choose which arm to take commands from based on the value
of the conditional expression. */
struct inferior *inf;
expression_up expr = parse_expression (exp);
- val = evaluate_expression (expr.get ());
+ val = expr->evaluate ();
if (TYPE_IS_REFERENCE (val->type ()))
{
val = value_ind (val);
struct dtrace_probe_arg *arg;
arg = this->get_arg_by_number (n, gdbarch);
- return evaluate_expression (arg->expr.get (), arg->type);
+ return arg->expr->evaluate (arg->type);
}
/* Implementation of the compile_to_ax method. */
{
expression_up expr = parse_expression (exp);
- return value_as_address (evaluate_expression (expr.get ()));
+ return value_as_address (expr->evaluate ());
}
/* Like parse_and_eval_address, but treats the value of the expression
{
expression_up expr = parse_expression (exp);
- return value_as_long (evaluate_expression (expr.get ()));
+ return value_as_long (expr->evaluate ());
}
struct value *
{
expression_up expr = parse_expression (exp);
- return evaluate_expression (expr.get ());
+ return expr->evaluate ();
}
/* Parse up to a comma (or to a closeparen)
{
expression_up expr = parse_exp_1 (expp, 0, nullptr, 1);
- return evaluate_expression (expr.get ());
+ return expr->evaluate ();
}
\f
return retval;
}
-/* See value.h. */
-
-struct value *
-evaluate_expression (struct expression *exp, struct type *expect_type)
-{
- return exp->evaluate (expect_type, EVAL_NORMAL);
-}
-
/* Evaluate an expression, avoiding all memory references
and getting a value whose type alone is correct. */
/* Evaluate the expression. EXPECT_TYPE is the context type of the
expression; normally this should be nullptr. NOSIDE controls how
evaluation is performed. */
- struct value *evaluate (struct type *expect_type, enum noside noside);
+ struct value *evaluate (struct type *expect_type = nullptr,
+ enum noside noside = EVAL_NORMAL);
/* Language it was entered in. */
const struct language_defn *language_defn;
switch_to_thread (thread_info);
expression_up expr = parse_expression ("(int) errno");
- struct value *val = evaluate_expression (expr.get ());
+ struct value *val = expr->evaluate ();
if (tdb_testinfo->log_progress)
{
expression_up expr = parse_expression (argv[0]);
- val = evaluate_expression (expr.get ());
+ val = expr->evaluate ();
string_file stb;
if (values == PRINT_SIMPLE_VALUES)
val = evaluate_type (expr.get ());
else
- val = evaluate_expression (expr.get ());
+ val = expr->evaluate ();
gdb::optional<ui_out_emit_tuple> tuple_emitter;
if (values != PRINT_NO_VALUES)
{
expression_up expr = parse_expression (args);
- object
- = evaluate_expression (expr.get (),
- builtin_type (expr->gdbarch)->builtin_data_ptr);
+ object = expr->evaluate (builtin_type (expr->gdbarch)->builtin_data_ptr);
}
/* Validate the address for sanity. */
/* VOIDPRINT is true to indicate that we do want to print a void
value, so invert it for parse_expression. */
expression_up expr = parse_expression (exp, nullptr, !voidprint);
- return evaluate_expression (expr.get ());
+ return expr->evaluate ();
}
return access_value_history (0);
expression_up expr = parse_expression (exp);
- val = evaluate_expression (expr.get ());
+ val = expr->evaluate ();
annotate_value_begin (val->type ());
(_("Expression is not an assignment (and might have no effect)"));
}
- evaluate_expression (expr.get ());
+ expr->evaluate ();
}
static void
command's definition. */
if (from_tty)
set_repeat_arguments ("");
- val = evaluate_expression (expr.get ());
+ val = expr->evaluate ();
if (TYPE_IS_REFERENCE (val->type ()))
val = coerce_ref (val);
/* In rvalue contexts, such as this, functions are coerced into
struct value *val;
CORE_ADDR addr;
- val = evaluate_expression (d->exp.get ());
+ val = d->exp->evaluate ();
addr = value_as_address (val);
if (d->format.format == 'i')
addr = gdbarch_addr_bits_remove (d->exp->gdbarch, addr);
{
struct value *val;
- val = evaluate_expression (d->exp.get ());
+ val = d->exp->evaluate ();
print_formatted (val, d->format.size, &opts, gdb_stdout);
}
catch (const gdb_exception_error &ex)
/* Compute the return value. Should the computation fail, this
call throws an error. */
- return_value = evaluate_expression (retval_expr.get ());
+ return_value = retval_expr->evaluate ();
/* Cast return value to the return type of the function. Should
the cast fail, this call throws an error. */
struct gdbarch *gdbarch = get_frame_arch (frame);
arg = this->get_arg_by_number (n, gdbarch);
- return evaluate_expression (arg->aexpr.get (), arg->atype);
+ return arg->aexpr->evaluate (arg->atype);
}
/* Compile the probe's argument N (indexed from 0) to agent expression.
case UNOP_MEMVAL:
{
/* Safe because we know it's a simple expression. */
- tempval = evaluate_expression (exp.get ());
+ tempval = exp->evaluate ();
addr = tempval->address ();
expr::unop_memval_operation *memop
= (gdb::checked_static_cast<expr::unop_memval_operation *>
/* Only evaluate the expression if the lvalue is void.
This may still fail if the expression is invalid. */
if (intvar->kind == INTERNALVAR_VOID)
- evaluate_expression (expr.get ());
+ expr->evaluate ();
}
struct value *function,
struct type *value_type);
-/* Evaluate the expression EXP. If set, EXPECT_TYPE is passed to the
- outermost operation's evaluation. This is ignored by most
- operations, but may be used, e.g., to determine the type of an
- otherwise untyped symbol. The caller should not assume that the
- returned value has this type. */
-
-extern struct value *evaluate_expression (struct expression *exp,
- struct type *expect_type = nullptr);
-
extern struct value *evaluate_type (struct expression *exp);
extern value *evaluate_var_value (enum noside noside, const block *blk,
select_frame (fi);
}
- /* We definitely need to catch errors here.
- If evaluate_expression succeeds we got the value we wanted.
- But if it fails, we still go on with a call to evaluate_type(). */
+ /* We definitely need to catch errors here. If evaluation of
+ the expression succeeds, we got the value we wanted. But if
+ it fails, we still go on with a call to evaluate_type(). */
try
{
- value = evaluate_expression (var->root->exp.get ());
+ value = var->root->exp->evaluate ();
}
catch (const gdb_exception_error &except)
{
expression_up exp = parse_exp_1 (&s, 0, 0, 0);
try
{
- value = evaluate_expression (exp.get ());
+ value = exp->evaluate ();
}
catch (const gdb_exception_error &except)
expression fails we want to just return NULL. */
try
{
- new_val = evaluate_expression (var->root->exp.get ());
+ new_val = var->root->exp->evaluate ();
}
catch (const gdb_exception_error &except)
{