CORE_ADDR address, struct value *dval0,
int keep_dynamic_fields)
{
- struct value *mark = value_mark ();
struct value *dval;
struct type *rtype;
int nfields, bit_len;
int fld_bit_len;
int f;
+ scoped_value_mark mark;
+
/* Compute the number of fields in this record type that are going
to be processed: unless keep_dynamic_fields, this includes only
fields whose position and length are static will be processed. */
else
rtype->set_length (align_up (rtype->length (), type->length ()));
- value_free_to_mark (mark);
return rtype;
}
to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
CORE_ADDR address, struct value *dval0)
{
- struct value *mark = value_mark ();
struct value *dval;
struct type *rtype;
struct type *branch_type;
if (variant_field == -1)
return type;
+ scoped_value_mark mark;
if (dval0 == NULL)
{
dval = value_from_contents_and_address (type, valaddr, address);
rtype->set_length (rtype->length ()
- type->field (variant_field).type ()->length ());
- value_free_to_mark (mark);
return rtype;
}
stop = true;
try
{
- struct value *mark;
-
- mark = value_mark ();
+ scoped_value_mark mark;
stop = value_true (evaluate_expression (ada_loc->excep_cond_expr.get ()));
- value_free_to_mark (mark);
}
catch (const gdb_exception &ex)
{
unsigned len;
struct type *elttype, *index_type;
unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0);
- struct value *mark = value_mark ();
LONGEST low = 0;
+ scoped_value_mark mark;
+
elttype = type->target_type ();
index_type = type->index_type ();
{
gdb_printf (stream, "...");
}
-
- value_free_to_mark (mark);
}
/* Print the character C on STREAM as part of the contents of a literal
static bool
breakpoint_cond_eval (expression *exp)
{
- struct value *mark = value_mark ();
- bool res = value_true (evaluate_expression (exp));
-
- value_free_to_mark (mark);
- return res;
+ scoped_value_mark mark;
+ return value_true (evaluate_expression (exp));
}
/* Allocate a new bpstat. Link it to the FIFO list by BS_LINK_POINTER. */
int within_current_scope = 1;
struct watchpoint * w;
- /* We use value_mark and value_free_to_mark because it could
- be a long time before we return to the command level and
- call free_all_values. We can't call free_all_values
- because we might be in the middle of evaluating a
- function call. */
- struct value *mark = value_mark ();
+ /* We use scoped_value_mark because it could be a long time
+ before we return to the command level and call
+ free_all_values. We can't call free_all_values because we
+ might be in the middle of evaluating a function call. */
+ scoped_value_mark mark;
if (is_watchpoint (b))
w = (struct watchpoint *) b;
watchpoint, unconditionally report it. */
}
/* FIXME-someday, should give breakpoint #. */
- value_free_to_mark (mark);
}
if (cond != nullptr && !condition_result)
/* We've found a "mask" token, which means the user wants to
create a hardware watchpoint that is going to have the mask
facility. */
- struct value *mask_value, *mark;
+ struct value *mask_value;
if (use_mask)
error(_("You can specify only one mask."));
use_mask = just_location = true;
- mark = value_mark ();
+ scoped_value_mark mark;
mask_value = parse_to_comma_and_eval (&value_start);
mask = value_as_address (mask_value);
- value_free_to_mark (mark);
}
else
/* We didn't recognize what we found. We should stop here. */
execute_control_command_1 (struct command_line *cmd, int from_tty)
{
struct command_line *current;
- struct value *val;
- struct value *val_mark;
int loop;
enum command_control_type ret;
QUIT;
/* Evaluate the expression. */
- val_mark = value_mark ();
- val = evaluate_expression (expr.get ());
- cond_result = value_true (val);
- value_free_to_mark (val_mark);
+ {
+ scoped_value_mark mark;
+ value *val = evaluate_expression (expr.get ());
+ cond_result = value_true (val);
+ }
/* If the value is false, then break out of the loop. */
if (!cond_result)
ret = simple_control;
/* Evaluate the conditional. */
- val_mark = value_mark ();
- val = evaluate_expression (expr.get ());
-
- /* Choose which arm to take commands from based on the value
- of the conditional expression. */
- if (value_true (val))
- current = cmd->body_list_0.get ();
- else if (cmd->body_list_1 != nullptr)
- current = cmd->body_list_1.get ();
- value_free_to_mark (val_mark);
+ {
+ scoped_value_mark mark;
+ value *val = evaluate_expression (expr.get ());
+
+ /* Choose which arm to take commands from based on the value
+ of the conditional expression. */
+ if (value_true (val))
+ current = cmd->body_list_0.get ();
+ else if (cmd->body_list_1 != nullptr)
+ current = cmd->body_list_1.get ();
+ }
/* Execute commands in the given arm. */
while (current)
info_port_rights (const char *args, mach_port_type_t only)
{
struct inf *inf = active_inf ();
- struct value *vmark = value_mark ();
+ scoped_value_mark vmark;
if (args)
/* Explicit list of port rights. */
if (err)
error (_("%s."), safe_strerror (err));
}
-
- value_free_to_mark (vmark);
}
static void
static void
lval_func_write (struct value *v, struct value *fromval)
{
- struct value *mark = value_mark ();
+ scoped_value_mark mark;
+
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
struct type *type = check_typedef (value_type (v));
struct type *eltype = check_typedef (value_type (c->val))->target_type ();
elsize);
value_assign (to_elm_val, from_elm_val);
}
-
- value_free_to_mark (mark);
}
/* Return nonzero if bits in V from OFFSET and LENGTH represent a
}
else if (gdbarch_pseudo_register_read_value_p (m_descr->gdbarch))
{
- struct value *mark, *computed;
+ struct value *computed;
enum register_status result = REG_VALID;
- mark = value_mark ();
+ scoped_value_mark mark;
computed = gdbarch_pseudo_register_read_value (m_descr->gdbarch,
this, regnum);
result = REG_UNAVAILABLE;
}
- value_free_to_mark (mark);
-
return result;
}
else
value *val = allocate_value (type1);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
- value *mark = value_mark ();
+ scoped_value_mark mark;
for (i = 0; i < high_bound1 - low_bound1 + 1; i++)
{
value *tmp = value_binop (value_subscript (val1, i),
copy (value_contents_all (tmp),
val_contents.slice (i * elsize, elsize));
}
- value_free_to_mark (mark);
return val;
}