mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 22:48:57 +08:00
Introduce set_lval method on value
This introduces the set_lval method on value, one step toward removing deprecated_lval_hack. Ultimately I think the goal should be for some of these set_* methods to be replaced with constructors; but I haven't done this, as the series is already too long. Other 'deprecated' methods can probably be handled the same way. Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
@ -2783,7 +2783,7 @@ aarch64_pseudo_read_value (struct gdbarch *gdbarch, readable_regcache *regcache,
|
||||
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
|
||||
struct value *result_value = value::allocate (register_type (gdbarch, regnum));
|
||||
|
||||
VALUE_LVAL (result_value) = lval_register;
|
||||
result_value->set_lval (lval_register);
|
||||
VALUE_REGNUM (result_value) = regnum;
|
||||
|
||||
if (is_w_pseudo_register (gdbarch, regnum))
|
||||
|
@ -4356,7 +4356,7 @@ ensure_lval (struct value *val)
|
||||
const CORE_ADDR addr =
|
||||
value_as_long (value_allocate_space_in_inferior (len));
|
||||
|
||||
VALUE_LVAL (val) = lval_memory;
|
||||
val->set_lval (lval_memory);
|
||||
val->set_address (addr);
|
||||
write_memory (addr, val->contents ().data (), len);
|
||||
}
|
||||
@ -10854,7 +10854,7 @@ ada_var_msym_value_operation::evaluate_for_cast (struct type *expect_type,
|
||||
{
|
||||
if (val->lazy ())
|
||||
val->fetch_lazy ();
|
||||
VALUE_LVAL (val) = not_lval;
|
||||
val->set_lval (not_lval);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@ -10876,7 +10876,7 @@ ada_var_value_operation::evaluate_for_cast (struct type *expect_type,
|
||||
{
|
||||
if (val->lazy ())
|
||||
val->fetch_lazy ();
|
||||
VALUE_LVAL (val) = not_lval;
|
||||
val->set_lval (not_lval);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
|
||||
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
|
||||
|
||||
value *result_value = value::allocate (register_type (gdbarch, regnum));
|
||||
VALUE_LVAL (result_value) = lval_register;
|
||||
result_value->set_lval (lval_register);
|
||||
VALUE_REGNUM (result_value) = regnum;
|
||||
gdb_byte *buf = result_value->contents_raw ().data ();
|
||||
|
||||
|
@ -923,7 +923,7 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
name_at_pc = NULL;
|
||||
|
||||
function = value::allocate (func_func_type);
|
||||
VALUE_LVAL (function) = lval_memory;
|
||||
function->set_lval (lval_memory);
|
||||
function->set_address (pc);
|
||||
|
||||
/* STT_GNU_IFUNC resolver functions usually receive the HWCAP vector as
|
||||
@ -1034,7 +1034,7 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
|
||||
gdb_assert (b->loc->next == NULL);
|
||||
|
||||
func_func = value::allocate (func_func_type);
|
||||
VALUE_LVAL (func_func) = lval_memory;
|
||||
func_func->set_lval (lval_memory);
|
||||
func_func->set_address (b->loc->related_address);
|
||||
|
||||
value = value::allocate (value_type);
|
||||
|
@ -2879,7 +2879,7 @@ var_msym_value_operation::evaluate_for_cast (struct type *to_type,
|
||||
{
|
||||
if (val->lazy ())
|
||||
val->fetch_lazy ();
|
||||
VALUE_LVAL (val) = not_lval;
|
||||
val->set_lval (not_lval);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@ -2900,7 +2900,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type,
|
||||
{
|
||||
if (val->lazy ())
|
||||
val->fetch_lazy ();
|
||||
VALUE_LVAL (val) = not_lval;
|
||||
val->set_lval (not_lval);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ value_of_register_lazy (frame_info_ptr frame, int regnum)
|
||||
gdb_assert (frame_id_p (get_frame_id (next_frame)));
|
||||
|
||||
reg_val = value::allocate_lazy (register_type (gdbarch, regnum));
|
||||
VALUE_LVAL (reg_val) = lval_register;
|
||||
reg_val->set_lval (lval_register);
|
||||
VALUE_REGNUM (reg_val) = regnum;
|
||||
VALUE_NEXT_FRAME_ID (reg_val) = get_frame_id (next_frame);
|
||||
|
||||
@ -589,7 +589,7 @@ language_defn::read_var_value (struct symbol *var,
|
||||
v = value::allocate (type);
|
||||
store_signed_integer (v->contents_raw ().data (), type->length (),
|
||||
type_byte_order (type), var->value_longest ());
|
||||
VALUE_LVAL (v) = not_lval;
|
||||
v->set_lval (not_lval);
|
||||
return v;
|
||||
|
||||
case LOC_LABEL:
|
||||
@ -616,7 +616,7 @@ language_defn::read_var_value (struct symbol *var,
|
||||
struct type *void_ptr_type
|
||||
= builtin_type (var->arch ())->builtin_data_ptr;
|
||||
v = value_cast_pointers (void_ptr_type, v, 0);
|
||||
VALUE_LVAL (v) = not_lval;
|
||||
v->set_lval (not_lval);
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -629,7 +629,7 @@ language_defn::read_var_value (struct symbol *var,
|
||||
v = value::allocate (type);
|
||||
memcpy (v->contents_raw ().data (), var->value_bytes (),
|
||||
type->length ());
|
||||
VALUE_LVAL (v) = not_lval;
|
||||
v->set_lval (not_lval);
|
||||
return v;
|
||||
|
||||
case LOC_STATIC:
|
||||
@ -804,7 +804,7 @@ default_value_from_register (struct gdbarch *gdbarch, struct type *type,
|
||||
struct value *value = value::allocate (type);
|
||||
frame_info_ptr frame;
|
||||
|
||||
VALUE_LVAL (value) = lval_register;
|
||||
value->set_lval (lval_register);
|
||||
frame = frame_find_by_id (frame_id);
|
||||
|
||||
if (frame == NULL)
|
||||
@ -896,7 +896,7 @@ value_from_register (struct type *type, int regnum, frame_info_ptr frame)
|
||||
is that gdbarch_register_to_value populates the entire value
|
||||
including the location. */
|
||||
v = value::allocate (type);
|
||||
VALUE_LVAL (v) = lval_register;
|
||||
v->set_lval (lval_register);
|
||||
VALUE_NEXT_FRAME_ID (v) = get_frame_id (get_next_frame_sentinel_okay (frame));
|
||||
VALUE_REGNUM (v) = regnum;
|
||||
ok = gdbarch_register_to_value (gdbarch, frame, regnum, type1,
|
||||
|
@ -3558,7 +3558,7 @@ i386_pseudo_register_read_value (struct gdbarch *gdbarch,
|
||||
struct value *result;
|
||||
|
||||
result = value::allocate (register_type (gdbarch, regnum));
|
||||
VALUE_LVAL (result) = lval_register;
|
||||
result->set_lval (lval_register);
|
||||
VALUE_REGNUM (result) = regnum;
|
||||
|
||||
i386_pseudo_register_read_into_value (gdbarch, regcache, regnum, result);
|
||||
|
@ -744,7 +744,7 @@ readable_regcache::cooked_read_value (int regnum)
|
||||
struct value *result;
|
||||
|
||||
result = value::allocate (register_type (m_descr->gdbarch, regnum));
|
||||
VALUE_LVAL (result) = lval_register;
|
||||
result->set_lval (lval_register);
|
||||
VALUE_REGNUM (result) = regnum;
|
||||
|
||||
/* It is more efficient in general to do this delegation in this
|
||||
|
@ -350,7 +350,7 @@ rust_val_print_slice (struct value *val, struct ui_file *stream, int recurse,
|
||||
struct type *array_type = lookup_array_range_type (elt_type, 0,
|
||||
llen - 1);
|
||||
struct value *array = value::allocate_lazy (array_type);
|
||||
VALUE_LVAL (array) = lval_memory;
|
||||
array->set_lval (lval_memory);
|
||||
array->set_address (value_as_address (base));
|
||||
array->fetch_lazy ();
|
||||
generic_value_print (array, stream, recurse, options,
|
||||
|
@ -192,7 +192,7 @@ value_subscript (struct value *array, LONGEST index)
|
||||
{
|
||||
struct value *val = value::allocate (elt_type);
|
||||
val->mark_bytes_unavailable (0, elt_size);
|
||||
VALUE_LVAL (val) = lval_memory;
|
||||
val->set_lval (lval_memory);
|
||||
val->set_address (array->address () + elt_size * index);
|
||||
return val;
|
||||
}
|
||||
|
@ -1024,7 +1024,7 @@ struct value *
|
||||
value_at_non_lval (struct type *type, CORE_ADDR addr)
|
||||
{
|
||||
struct value *result = value_at (type, addr);
|
||||
VALUE_LVAL (result) = not_lval;
|
||||
result->set_lval (not_lval);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1373,7 +1373,7 @@ value_repeat (struct value *arg1, int count)
|
||||
|
||||
val = allocate_repeat_value (arg1->enclosing_type (), count);
|
||||
|
||||
VALUE_LVAL (val) = lval_memory;
|
||||
val->set_lval (lval_memory);
|
||||
val->set_address (arg1->address ());
|
||||
|
||||
read_value_memory (val, 0, val->stack (), val->address (),
|
||||
|
20
gdb/value.c
20
gdb/value.c
@ -975,7 +975,7 @@ value::allocate_computed (struct type *type,
|
||||
{
|
||||
struct value *v = value::allocate_lazy (type);
|
||||
|
||||
VALUE_LVAL (v) = lval_computed;
|
||||
v->set_lval (lval_computed);
|
||||
v->m_location.computed.funcs = funcs;
|
||||
v->m_location.computed.closure = closure;
|
||||
|
||||
@ -1478,7 +1478,7 @@ value::copy () const
|
||||
|
||||
val = value::allocate_lazy (encl_type);
|
||||
val->m_type = m_type;
|
||||
VALUE_LVAL (val) = m_lval;
|
||||
val->set_lval (m_lval);
|
||||
val->m_location = m_location;
|
||||
val->m_offset = m_offset;
|
||||
val->m_bitpos = m_bitpos;
|
||||
@ -1583,9 +1583,9 @@ value::set_component_location (const struct value *whole)
|
||||
gdb_assert (whole->m_lval != lval_xcallable);
|
||||
|
||||
if (whole->m_lval == lval_internalvar)
|
||||
VALUE_LVAL (this) = lval_internalvar_component;
|
||||
m_lval = lval_internalvar_component;
|
||||
else
|
||||
VALUE_LVAL (this) = whole->m_lval;
|
||||
m_lval = whole->m_lval;
|
||||
|
||||
m_location = whole->m_location;
|
||||
if (whole->m_lval == lval_computed)
|
||||
@ -1629,7 +1629,7 @@ value::set_component_location (const struct value *whole)
|
||||
if (VALUE_LVAL (this) == lval_internalvar_component)
|
||||
{
|
||||
gdb_assert (lazy ());
|
||||
VALUE_LVAL (this) = lval_memory;
|
||||
m_lval = lval_memory;
|
||||
}
|
||||
else
|
||||
gdb_assert (VALUE_LVAL (this) == lval_memory);
|
||||
@ -2067,7 +2067,7 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
|
||||
if (var->kind != INTERNALVAR_MAKE_VALUE
|
||||
&& val->lval () != lval_computed)
|
||||
{
|
||||
VALUE_LVAL (val) = lval_internalvar;
|
||||
val->set_lval (lval_internalvar);
|
||||
VALUE_INTERNALVAR (val) = var;
|
||||
}
|
||||
|
||||
@ -2987,7 +2987,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
|
||||
}
|
||||
|
||||
v = value::allocate (ftype);
|
||||
VALUE_LVAL (v) = lval_memory;
|
||||
v->set_lval (lval_memory);
|
||||
if (sym)
|
||||
{
|
||||
v->set_address (sym->value_block ()->entry_pc ());
|
||||
@ -3333,7 +3333,7 @@ value::zero (struct type *type, enum lval_type lv)
|
||||
{
|
||||
struct value *val = value::allocate_lazy (type);
|
||||
|
||||
VALUE_LVAL (val) = (lv == lval_computed ? not_lval : lv);
|
||||
val->set_lval (lv == lval_computed ? not_lval : lv);
|
||||
val->m_is_zero = true;
|
||||
return val;
|
||||
}
|
||||
@ -3408,7 +3408,7 @@ value_from_contents_and_address_unresolved (struct type *type,
|
||||
v = value::allocate_lazy (type);
|
||||
else
|
||||
v = value_from_contents (type, valaddr);
|
||||
VALUE_LVAL (v) = lval_memory;
|
||||
v->set_lval (lval_memory);
|
||||
v->set_address (address);
|
||||
return v;
|
||||
}
|
||||
@ -3437,7 +3437,7 @@ value_from_contents_and_address (struct type *type,
|
||||
if (TYPE_DATA_LOCATION (resolved_type_no_typedef) != NULL
|
||||
&& TYPE_DATA_LOCATION_KIND (resolved_type_no_typedef) == PROP_CONST)
|
||||
address = TYPE_DATA_LOCATION_ADDR (resolved_type_no_typedef);
|
||||
VALUE_LVAL (v) = lval_memory;
|
||||
v->set_lval (lval_memory);
|
||||
v->set_address (address);
|
||||
return v;
|
||||
}
|
||||
|
@ -335,6 +335,10 @@ public:
|
||||
enum lval_type lval () const
|
||||
{ return m_lval; }
|
||||
|
||||
/* Set the 'lval' of this value. */
|
||||
void set_lval (lval_type val)
|
||||
{ m_lval = val; }
|
||||
|
||||
/* Set or return field indicating whether a variable is initialized or
|
||||
not, based on debugging information supplied by the compiler.
|
||||
1 = initialized; 0 = uninitialized. */
|
||||
|
Reference in New Issue
Block a user