mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-23 13:21:43 +08:00
Use scoped_value_mark in more places
I looked at all the spots using value_mark, and converted all the straightforward ones to use scoped_value_mark instead. Regression tested on x86-64 Fedora 34.
This commit is contained in:
parent
ce6c3d253b
commit
65558ca5df
@ -7858,7 +7858,6 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||
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;
|
||||
@ -7867,6 +7866,8 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||
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. */
|
||||
@ -8068,7 +8069,6 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||
else
|
||||
rtype->set_length (align_up (rtype->length (), type->length ()));
|
||||
|
||||
value_free_to_mark (mark);
|
||||
return rtype;
|
||||
}
|
||||
|
||||
@ -8169,7 +8169,6 @@ static struct type *
|
||||
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;
|
||||
@ -8179,6 +8178,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
|
||||
if (variant_field == -1)
|
||||
return type;
|
||||
|
||||
scoped_value_mark mark;
|
||||
if (dval0 == NULL)
|
||||
{
|
||||
dval = value_from_contents_and_address (type, valaddr, address);
|
||||
@ -8228,7 +8228,6 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
|
||||
rtype->set_length (rtype->length ()
|
||||
- type->field (variant_field).type ()->length ());
|
||||
|
||||
value_free_to_mark (mark);
|
||||
return rtype;
|
||||
}
|
||||
|
||||
@ -12311,11 +12310,8 @@ should_stop_exception (const struct bp_location *bl)
|
||||
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)
|
||||
{
|
||||
|
@ -127,9 +127,10 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||
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 ();
|
||||
|
||||
@ -251,8 +252,6 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||
{
|
||||
gdb_printf (stream, "...");
|
||||
}
|
||||
|
||||
value_free_to_mark (mark);
|
||||
}
|
||||
|
||||
/* Print the character C on STREAM as part of the contents of a literal
|
||||
|
@ -4837,11 +4837,8 @@ bpstat_print (bpstat *bs, target_waitkind kind)
|
||||
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. */
|
||||
@ -5363,12 +5360,11 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
|
||||
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;
|
||||
@ -5427,7 +5423,6 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
|
||||
watchpoint, unconditionally report it. */
|
||||
}
|
||||
/* FIXME-someday, should give breakpoint #. */
|
||||
value_free_to_mark (mark);
|
||||
}
|
||||
|
||||
if (cond != nullptr && !condition_result)
|
||||
@ -9979,17 +9974,16 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
|
||||
/* 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. */
|
||||
|
@ -512,8 +512,6 @@ static enum command_control_type
|
||||
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;
|
||||
|
||||
@ -567,10 +565,11 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
|
||||
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)
|
||||
@ -621,16 +620,17 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
|
||||
ret = simple_control;
|
||||
|
||||
/* Evaluate the conditional. */
|
||||
val_mark = value_mark ();
|
||||
val = evaluate_expression (expr.get ());
|
||||
{
|
||||
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 ();
|
||||
value_free_to_mark (val_mark);
|
||||
/* 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)
|
||||
|
@ -3062,7 +3062,7 @@ static void
|
||||
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. */
|
||||
@ -3088,8 +3088,6 @@ info_port_rights (const char *args, mach_port_type_t only)
|
||||
if (err)
|
||||
error (_("%s."), safe_strerror (err));
|
||||
}
|
||||
|
||||
value_free_to_mark (vmark);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -147,7 +147,8 @@ lval_func_read (struct value *v)
|
||||
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 ();
|
||||
@ -184,8 +185,6 @@ lval_func_write (struct value *v, struct value *fromval)
|
||||
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
|
||||
|
@ -708,10 +708,10 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf)
|
||||
}
|
||||
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);
|
||||
@ -724,8 +724,6 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf)
|
||||
result = REG_UNAVAILABLE;
|
||||
}
|
||||
|
||||
value_free_to_mark (mark);
|
||||
|
||||
return result;
|
||||
}
|
||||
else
|
||||
|
@ -1615,7 +1615,7 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
|
||||
|
||||
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),
|
||||
@ -1623,7 +1623,6 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
|
||||
copy (value_contents_all (tmp),
|
||||
val_contents.slice (i * elsize, elsize));
|
||||
}
|
||||
value_free_to_mark (mark);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user