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
8 changed files with 36 additions and 53 deletions
|
@ -7858,7 +7858,6 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||||
CORE_ADDR address, struct value *dval0,
|
CORE_ADDR address, struct value *dval0,
|
||||||
int keep_dynamic_fields)
|
int keep_dynamic_fields)
|
||||||
{
|
{
|
||||||
struct value *mark = value_mark ();
|
|
||||||
struct value *dval;
|
struct value *dval;
|
||||||
struct type *rtype;
|
struct type *rtype;
|
||||||
int nfields, bit_len;
|
int nfields, bit_len;
|
||||||
|
@ -7867,6 +7866,8 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||||
int fld_bit_len;
|
int fld_bit_len;
|
||||||
int f;
|
int f;
|
||||||
|
|
||||||
|
scoped_value_mark mark;
|
||||||
|
|
||||||
/* Compute the number of fields in this record type that are going
|
/* Compute the number of fields in this record type that are going
|
||||||
to be processed: unless keep_dynamic_fields, this includes only
|
to be processed: unless keep_dynamic_fields, this includes only
|
||||||
fields whose position and length are static will be processed. */
|
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
|
else
|
||||||
rtype->set_length (align_up (rtype->length (), type->length ()));
|
rtype->set_length (align_up (rtype->length (), type->length ()));
|
||||||
|
|
||||||
value_free_to_mark (mark);
|
|
||||||
return rtype;
|
return rtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8169,7 +8169,6 @@ static struct type *
|
||||||
to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
|
to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
|
||||||
CORE_ADDR address, struct value *dval0)
|
CORE_ADDR address, struct value *dval0)
|
||||||
{
|
{
|
||||||
struct value *mark = value_mark ();
|
|
||||||
struct value *dval;
|
struct value *dval;
|
||||||
struct type *rtype;
|
struct type *rtype;
|
||||||
struct type *branch_type;
|
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)
|
if (variant_field == -1)
|
||||||
return type;
|
return type;
|
||||||
|
|
||||||
|
scoped_value_mark mark;
|
||||||
if (dval0 == NULL)
|
if (dval0 == NULL)
|
||||||
{
|
{
|
||||||
dval = value_from_contents_and_address (type, valaddr, address);
|
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 ()
|
rtype->set_length (rtype->length ()
|
||||||
- type->field (variant_field).type ()->length ());
|
- type->field (variant_field).type ()->length ());
|
||||||
|
|
||||||
value_free_to_mark (mark);
|
|
||||||
return rtype;
|
return rtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12311,11 +12310,8 @@ should_stop_exception (const struct bp_location *bl)
|
||||||
stop = true;
|
stop = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
struct value *mark;
|
scoped_value_mark mark;
|
||||||
|
|
||||||
mark = value_mark ();
|
|
||||||
stop = value_true (evaluate_expression (ada_loc->excep_cond_expr.get ()));
|
stop = value_true (evaluate_expression (ada_loc->excep_cond_expr.get ()));
|
||||||
value_free_to_mark (mark);
|
|
||||||
}
|
}
|
||||||
catch (const gdb_exception &ex)
|
catch (const gdb_exception &ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,9 +127,10 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
unsigned len;
|
unsigned len;
|
||||||
struct type *elttype, *index_type;
|
struct type *elttype, *index_type;
|
||||||
unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0);
|
unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0);
|
||||||
struct value *mark = value_mark ();
|
|
||||||
LONGEST low = 0;
|
LONGEST low = 0;
|
||||||
|
|
||||||
|
scoped_value_mark mark;
|
||||||
|
|
||||||
elttype = type->target_type ();
|
elttype = type->target_type ();
|
||||||
index_type = type->index_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, "...");
|
gdb_printf (stream, "...");
|
||||||
}
|
}
|
||||||
|
|
||||||
value_free_to_mark (mark);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the character C on STREAM as part of the contents of a literal
|
/* 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
|
static bool
|
||||||
breakpoint_cond_eval (expression *exp)
|
breakpoint_cond_eval (expression *exp)
|
||||||
{
|
{
|
||||||
struct value *mark = value_mark ();
|
scoped_value_mark mark;
|
||||||
bool res = value_true (evaluate_expression (exp));
|
return value_true (evaluate_expression (exp));
|
||||||
|
|
||||||
value_free_to_mark (mark);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a new bpstat. Link it to the FIFO list by BS_LINK_POINTER. */
|
/* 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;
|
int within_current_scope = 1;
|
||||||
struct watchpoint * w;
|
struct watchpoint * w;
|
||||||
|
|
||||||
/* We use value_mark and value_free_to_mark because it could
|
/* We use scoped_value_mark because it could be a long time
|
||||||
be a long time before we return to the command level and
|
before we return to the command level and call
|
||||||
call free_all_values. We can't call free_all_values
|
free_all_values. We can't call free_all_values because we
|
||||||
because we might be in the middle of evaluating a
|
might be in the middle of evaluating a function call. */
|
||||||
function call. */
|
scoped_value_mark mark;
|
||||||
struct value *mark = value_mark ();
|
|
||||||
|
|
||||||
if (is_watchpoint (b))
|
if (is_watchpoint (b))
|
||||||
w = (struct watchpoint *) b;
|
w = (struct watchpoint *) b;
|
||||||
|
@ -5427,7 +5423,6 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
|
||||||
watchpoint, unconditionally report it. */
|
watchpoint, unconditionally report it. */
|
||||||
}
|
}
|
||||||
/* FIXME-someday, should give breakpoint #. */
|
/* FIXME-someday, should give breakpoint #. */
|
||||||
value_free_to_mark (mark);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cond != nullptr && !condition_result)
|
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
|
/* We've found a "mask" token, which means the user wants to
|
||||||
create a hardware watchpoint that is going to have the mask
|
create a hardware watchpoint that is going to have the mask
|
||||||
facility. */
|
facility. */
|
||||||
struct value *mask_value, *mark;
|
struct value *mask_value;
|
||||||
|
|
||||||
if (use_mask)
|
if (use_mask)
|
||||||
error(_("You can specify only one mask."));
|
error(_("You can specify only one mask."));
|
||||||
|
|
||||||
use_mask = just_location = true;
|
use_mask = just_location = true;
|
||||||
|
|
||||||
mark = value_mark ();
|
scoped_value_mark mark;
|
||||||
mask_value = parse_to_comma_and_eval (&value_start);
|
mask_value = parse_to_comma_and_eval (&value_start);
|
||||||
mask = value_as_address (mask_value);
|
mask = value_as_address (mask_value);
|
||||||
value_free_to_mark (mark);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* We didn't recognize what we found. We should stop here. */
|
/* 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)
|
execute_control_command_1 (struct command_line *cmd, int from_tty)
|
||||||
{
|
{
|
||||||
struct command_line *current;
|
struct command_line *current;
|
||||||
struct value *val;
|
|
||||||
struct value *val_mark;
|
|
||||||
int loop;
|
int loop;
|
||||||
enum command_control_type ret;
|
enum command_control_type ret;
|
||||||
|
|
||||||
|
@ -567,10 +565,11 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
|
||||||
QUIT;
|
QUIT;
|
||||||
|
|
||||||
/* Evaluate the expression. */
|
/* Evaluate the expression. */
|
||||||
val_mark = value_mark ();
|
{
|
||||||
val = evaluate_expression (expr.get ());
|
scoped_value_mark mark;
|
||||||
cond_result = value_true (val);
|
value *val = evaluate_expression (expr.get ());
|
||||||
value_free_to_mark (val_mark);
|
cond_result = value_true (val);
|
||||||
|
}
|
||||||
|
|
||||||
/* If the value is false, then break out of the loop. */
|
/* If the value is false, then break out of the loop. */
|
||||||
if (!cond_result)
|
if (!cond_result)
|
||||||
|
@ -621,16 +620,17 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
|
||||||
ret = simple_control;
|
ret = simple_control;
|
||||||
|
|
||||||
/* Evaluate the conditional. */
|
/* 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
|
/* Choose which arm to take commands from based on the value
|
||||||
of the conditional expression. */
|
of the conditional expression. */
|
||||||
if (value_true (val))
|
if (value_true (val))
|
||||||
current = cmd->body_list_0.get ();
|
current = cmd->body_list_0.get ();
|
||||||
else if (cmd->body_list_1 != nullptr)
|
else if (cmd->body_list_1 != nullptr)
|
||||||
current = cmd->body_list_1.get ();
|
current = cmd->body_list_1.get ();
|
||||||
value_free_to_mark (val_mark);
|
}
|
||||||
|
|
||||||
/* Execute commands in the given arm. */
|
/* Execute commands in the given arm. */
|
||||||
while (current)
|
while (current)
|
||||||
|
|
|
@ -3062,7 +3062,7 @@ static void
|
||||||
info_port_rights (const char *args, mach_port_type_t only)
|
info_port_rights (const char *args, mach_port_type_t only)
|
||||||
{
|
{
|
||||||
struct inf *inf = active_inf ();
|
struct inf *inf = active_inf ();
|
||||||
struct value *vmark = value_mark ();
|
scoped_value_mark vmark;
|
||||||
|
|
||||||
if (args)
|
if (args)
|
||||||
/* Explicit list of port rights. */
|
/* Explicit list of port rights. */
|
||||||
|
@ -3088,8 +3088,6 @@ info_port_rights (const char *args, mach_port_type_t only)
|
||||||
if (err)
|
if (err)
|
||||||
error (_("%s."), safe_strerror (err));
|
error (_("%s."), safe_strerror (err));
|
||||||
}
|
}
|
||||||
|
|
||||||
value_free_to_mark (vmark);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -147,7 +147,8 @@ lval_func_read (struct value *v)
|
||||||
static void
|
static void
|
||||||
lval_func_write (struct value *v, struct value *fromval)
|
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 lval_closure *c = (struct lval_closure *) value_computed_closure (v);
|
||||||
struct type *type = check_typedef (value_type (v));
|
struct type *type = check_typedef (value_type (v));
|
||||||
struct type *eltype = check_typedef (value_type (c->val))->target_type ();
|
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);
|
elsize);
|
||||||
value_assign (to_elm_val, from_elm_val);
|
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
|
/* 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))
|
else if (gdbarch_pseudo_register_read_value_p (m_descr->gdbarch))
|
||||||
{
|
{
|
||||||
struct value *mark, *computed;
|
struct value *computed;
|
||||||
enum register_status result = REG_VALID;
|
enum register_status result = REG_VALID;
|
||||||
|
|
||||||
mark = value_mark ();
|
scoped_value_mark mark;
|
||||||
|
|
||||||
computed = gdbarch_pseudo_register_read_value (m_descr->gdbarch,
|
computed = gdbarch_pseudo_register_read_value (m_descr->gdbarch,
|
||||||
this, regnum);
|
this, regnum);
|
||||||
|
@ -724,8 +724,6 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf)
|
||||||
result = REG_UNAVAILABLE;
|
result = REG_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_free_to_mark (mark);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1615,7 +1615,7 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
|
||||||
|
|
||||||
value *val = allocate_value (type1);
|
value *val = allocate_value (type1);
|
||||||
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
|
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++)
|
for (i = 0; i < high_bound1 - low_bound1 + 1; i++)
|
||||||
{
|
{
|
||||||
value *tmp = value_binop (value_subscript (val1, 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),
|
copy (value_contents_all (tmp),
|
||||||
val_contents.slice (i * elsize, elsize));
|
val_contents.slice (i * elsize, elsize));
|
||||||
}
|
}
|
||||||
value_free_to_mark (mark);
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue