Remove deprecated_lval_hack

This removes deprecated_lval_hack and the VALUE_LVAL macro, replacing
all uses with a call to value::lval.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey 2023-02-09 06:55:48 -07:00
parent 6f9c9d71c2
commit 736355f2e1
28 changed files with 112 additions and 122 deletions

View file

@ -559,7 +559,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
result = value::allocate_optimized_out (type); result = value::allocate_optimized_out (type);
else if (val->lazy () else if (val->lazy ()
/* Be careful not to make a lazy not_lval value. */ /* Be careful not to make a lazy not_lval value. */
|| (VALUE_LVAL (val) != not_lval || (val->lval () != not_lval
&& type->length () > val->type ()->length ())) && type->length () > val->type ()->length ()))
result = value::allocate_lazy (type); result = value::allocate_lazy (type);
else else
@ -570,7 +570,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
result->set_component_location (val); result->set_component_location (val);
result->set_bitsize (val->bitsize ()); result->set_bitsize (val->bitsize ());
result->set_bitpos (val->bitpos ()); result->set_bitpos (val->bitpos ());
if (VALUE_LVAL (result) == lval_memory) if (result->lval () == lval_memory)
result->set_address (val->address ()); result->set_address (val->address ());
return result; return result;
} }
@ -2810,7 +2810,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
v = value::allocate (type); v = value::allocate (type);
src = valaddr + offset; src = valaddr + offset;
} }
else if (VALUE_LVAL (obj) == lval_memory && obj->lazy ()) else if (obj->lval () == lval_memory && obj->lazy ())
{ {
int src_len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8; int src_len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8;
gdb_byte *buf; gdb_byte *buf;
@ -2891,7 +2891,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
if (!toval->deprecated_modifiable ()) if (!toval->deprecated_modifiable ())
error (_("Left operand of assignment is not a modifiable lvalue.")); error (_("Left operand of assignment is not a modifiable lvalue."));
if (VALUE_LVAL (toval) == lval_memory if (toval->lval () == lval_memory
&& bits > 0 && bits > 0
&& (type->code () == TYPE_CODE_FLT && (type->code () == TYPE_CODE_FLT
|| type->code () == TYPE_CODE_STRUCT)) || type->code () == TYPE_CODE_STRUCT))
@ -4349,8 +4349,8 @@ ada_read_renaming_var_value (struct symbol *renaming_sym,
static struct value * static struct value *
ensure_lval (struct value *val) ensure_lval (struct value *val)
{ {
if (VALUE_LVAL (val) == not_lval if (val->lval () == not_lval
|| VALUE_LVAL (val) == lval_internalvar) || val->lval () == lval_internalvar)
{ {
int len = ada_check_typedef (val->type ())->length (); int len = ada_check_typedef (val->type ())->length ();
const CORE_ADDR addr = const CORE_ADDR addr =
@ -4523,7 +4523,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
result = desc_data (actual); result = desc_data (actual);
else if (formal_type->code () != TYPE_CODE_PTR) else if (formal_type->code () != TYPE_CODE_PTR)
{ {
if (VALUE_LVAL (actual) != lval_memory) if (actual->lval () != lval_memory)
{ {
struct value *val; struct value *val;
@ -8841,7 +8841,7 @@ ada_to_fixed_value_create (struct type *type0, CORE_ADDR address,
if (type == type0 && val0 != NULL) if (type == type0 && val0 != NULL)
return val0; return val0;
if (VALUE_LVAL (val0) != lval_memory) if (val0->lval () != lval_memory)
{ {
/* Our value does not live in memory; it could be a convenience /* Our value does not live in memory; it could be a convenience
variable, for instance. Create a not_lval value using val0's variable, for instance. Create a not_lval value using val0's
@ -9771,12 +9771,12 @@ ada_assign_operation::evaluate (struct type *expect_type,
In the case of assigning to a convenience variable, the lhs In the case of assigning to a convenience variable, the lhs
should be exactly the result of the evaluation of the rhs. */ should be exactly the result of the evaluation of the rhs. */
struct type *type = arg1->type (); struct type *type = arg1->type ();
if (VALUE_LVAL (arg1) == lval_internalvar) if (arg1->lval () == lval_internalvar)
type = NULL; type = NULL;
value *arg2 = std::get<1> (m_storage)->evaluate (type, exp, noside); value *arg2 = std::get<1> (m_storage)->evaluate (type, exp, noside);
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
if (VALUE_LVAL (arg1) == lval_internalvar) if (arg1->lval () == lval_internalvar)
{ {
/* Nothing. */ /* Nothing. */
} }
@ -10279,7 +10279,7 @@ ada_ternop_slice (struct expression *exp,
convert to a pointer. */ convert to a pointer. */
if (array->type ()->code () == TYPE_CODE_REF if (array->type ()->code () == TYPE_CODE_REF
|| (array->type ()->code () == TYPE_CODE_ARRAY || (array->type ()->code () == TYPE_CODE_ARRAY
&& VALUE_LVAL (array) == lval_memory)) && array->lval () == lval_memory))
array = value_addr (array); array = value_addr (array);
if (noside == EVAL_AVOID_SIDE_EFFECTS if (noside == EVAL_AVOID_SIDE_EFFECTS
@ -10850,7 +10850,7 @@ ada_var_msym_value_operation::evaluate_for_cast (struct type *expect_type,
/* Follow the Ada language semantics that do not allow taking /* Follow the Ada language semantics that do not allow taking
an address of the result of a cast (view conversion in Ada). */ an address of the result of a cast (view conversion in Ada). */
if (VALUE_LVAL (val) == lval_memory) if (val->lval () == lval_memory)
{ {
if (val->lazy ()) if (val->lazy ())
val->fetch_lazy (); val->fetch_lazy ();
@ -10872,7 +10872,7 @@ ada_var_value_operation::evaluate_for_cast (struct type *expect_type,
/* Follow the Ada language semantics that do not allow taking /* Follow the Ada language semantics that do not allow taking
an address of the result of a cast (view conversion in Ada). */ an address of the result of a cast (view conversion in Ada). */
if (VALUE_LVAL (val) == lval_memory) if (val->lval () == lval_memory)
{ {
if (val->lazy ()) if (val->lazy ())
val->fetch_lazy (); val->fetch_lazy ();
@ -11169,7 +11169,7 @@ ada_funcall_operation::evaluate (struct type *expect_type,
callee = ada_to_fixed_value (coerce_ref (callee)); callee = ada_to_fixed_value (coerce_ref (callee));
} }
else if (callee->type ()->code () == TYPE_CODE_ARRAY else if (callee->type ()->code () == TYPE_CODE_ARRAY
&& VALUE_LVAL (callee) == lval_memory) && callee->lval () == lval_memory)
callee = value_addr (callee); callee = value_addr (callee);
struct type *type = ada_check_typedef (callee->type ()); struct type *type = ada_check_typedef (callee->type ());

View file

@ -2074,7 +2074,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
must watch it. If the first value returned is must watch it. If the first value returned is
still lazy, that means an error occurred reading it; still lazy, that means an error occurred reading it;
watch it anyway in case it becomes readable. */ watch it anyway in case it becomes readable. */
if (VALUE_LVAL (v) == lval_memory if (v->lval () == lval_memory
&& (v == val_chain[0] || ! v->lazy ())) && (v == val_chain[0] || ! v->lazy ()))
{ {
struct type *vtype = check_typedef (v->type ()); struct type *vtype = check_typedef (v->type ());
@ -10412,7 +10412,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
{ {
struct value *v = iter.get (); struct value *v = iter.get ();
if (VALUE_LVAL (v) == lval_memory) if (v->lval () == lval_memory)
{ {
if (v != head && v->lazy ()) if (v != head && v->lazy ())
/* A lazy memory lvalue in the chain is one that GDB never /* A lazy memory lvalue in the chain is one that GDB never
@ -10450,10 +10450,10 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
} }
} }
} }
else if (VALUE_LVAL (v) != not_lval else if (v->lval () != not_lval
&& v->deprecated_modifiable () == 0) && v->deprecated_modifiable () == 0)
return 0; /* These are values from the history (e.g., $1). */ return 0; /* These are values from the history (e.g., $1). */
else if (VALUE_LVAL (v) == lval_register) else if (v->lval () == lval_register)
return 0; /* Cannot watch a register with a HW watchpoint. */ return 0; /* Cannot watch a register with a HW watchpoint. */
} }

View file

@ -294,8 +294,8 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
C struct hack. So, only do this if either no length was C struct hack. So, only do this if either no length was
specified, or the length is within the existing bounds. This specified, or the length is within the existing bounds. This
avoids running off the end of the value's contents. */ avoids running off the end of the value's contents. */
if ((VALUE_LVAL (value) == not_lval if ((value->lval () == not_lval
|| VALUE_LVAL (value) == lval_internalvar || value->lval () == lval_internalvar
|| type->code () == TYPE_CODE_ARRAY) || type->code () == TYPE_CODE_ARRAY)
&& fetchlimit != UINT_MAX && fetchlimit != UINT_MAX
&& (*length < 0 || *length <= fetchlimit)) && (*length < 0 || *length <= fetchlimit))
@ -328,7 +328,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
CORE_ADDR addr; CORE_ADDR addr;
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
{ {
if (VALUE_LVAL (value) != lval_memory) if (value->lval () != lval_memory)
error (_("Attempt to take address of value " error (_("Attempt to take address of value "
"not located in memory.")); "not located in memory."));
addr = value->address (); addr = value->address ();

View file

@ -230,7 +230,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
{ {
CORE_ADDR vaddr; CORE_ADDR vaddr;
if (VALUE_LVAL (val)) if (val->lval ())
{ {
vaddr = val->address (); vaddr = val->address ();
} }

View file

@ -156,7 +156,7 @@ convert_one_symbol (compile_c_instance *context,
} }
val = read_var_value (sym.symbol, sym.block, frame); val = read_var_value (sym.symbol, sym.block, frame);
if (VALUE_LVAL (val) != lval_memory) if (val->lval () != lval_memory)
error (_("Symbol \"%s\" cannot be used for compilation " error (_("Symbol \"%s\" cannot be used for compilation "
"evaluation as its address has not been found."), "evaluation as its address has not been found."),
sym.symbol->print_name ()); sym.symbol->print_name ());

View file

@ -150,7 +150,7 @@ convert_one_symbol (compile_cplus_instance *instance,
} }
val = read_var_value (sym.symbol, sym.block, frame); val = read_var_value (sym.symbol, sym.block, frame);
if (VALUE_LVAL (val) != lval_memory) if (val->lval () != lval_memory)
error (_("Symbol \"%s\" cannot be used for compilation " error (_("Symbol \"%s\" cannot be used for compilation "
"evaluation as its address has not been found."), "evaluation as its address has not been found."),
sym.symbol->print_name ()); sym.symbol->print_name ());

View file

@ -642,7 +642,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
sym->print_name ()); sym->print_name ());
val = read_var_value (sym, NULL, frame); val = read_var_value (sym, NULL, frame);
if (VALUE_LVAL (val) != lval_memory) if (val->lval () != lval_memory)
error (_("Symbol \"%s\" cannot be used for compilation evaluation " error (_("Symbol \"%s\" cannot be used for compilation evaluation "
"as its address has not been found."), "as its address has not been found."),
sym->print_name ()); sym->print_name ());

View file

@ -235,7 +235,7 @@ execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size,
ctx.push_address (initial, initial_in_stack_memory); ctx.push_address (initial, initial_in_stack_memory);
value *result_val = ctx.evaluate (exp, len, true, nullptr, this_frame); value *result_val = ctx.evaluate (exp, len, true, nullptr, this_frame);
if (VALUE_LVAL (result_val) == lval_memory) if (result_val->lval () == lval_memory)
return result_val->address (); return result_val->address ();
else else
return value_as_address (result_val); return value_as_address (result_val);

View file

@ -684,7 +684,7 @@ call_site_target::iterate_over_addresses
dwarf_block->per_cu, dwarf_block->per_cu,
dwarf_block->per_objfile); dwarf_block->per_objfile);
/* DW_AT_call_target is a DWARF expression, not a DWARF location. */ /* DW_AT_call_target is a DWARF expression, not a DWARF location. */
if (VALUE_LVAL (val) == lval_memory) if (val->lval () == lval_memory)
callback (val->address ()); callback (val->address ());
else else
callback (value_as_address (val)); callback (value_as_address (val));
@ -1612,11 +1612,11 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
if (result->optimized_out ()) if (result->optimized_out ())
return 0; return 0;
if (VALUE_LVAL (result) == lval_memory) if (result->lval () == lval_memory)
*valp = result->address (); *valp = result->address ();
else else
{ {
if (VALUE_LVAL (result) == not_lval) if (result->lval () == not_lval)
*is_reference = false; *is_reference = false;
*valp = value_as_address (result); *valp = value_as_address (result);

View file

@ -1224,7 +1224,7 @@ eval_op_structop_struct (struct type *expect_type, struct expression *exp,
struct value *arg3 = value_struct_elt (&arg1, {}, string, struct value *arg3 = value_struct_elt (&arg1, {}, string,
NULL, "structure"); NULL, "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
arg3 = value::zero (arg3->type (), VALUE_LVAL (arg3)); arg3 = value::zero (arg3->type (), arg3->lval ());
return arg3; return arg3;
} }
@ -1280,7 +1280,7 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
struct value *arg3 = value_struct_elt (&arg1, {}, string, struct value *arg3 = value_struct_elt (&arg1, {}, string,
NULL, "structure pointer"); NULL, "structure pointer");
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
arg3 = value::zero (arg3->type (), VALUE_LVAL (arg3)); arg3 = value::zero (arg3->type (), arg3->lval ());
return arg3; return arg3;
} }
@ -1447,7 +1447,7 @@ eval_op_subscript (struct type *expect_type, struct expression *exp,
} }
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value::zero (type->target_type (), VALUE_LVAL (arg1)); return value::zero (type->target_type (), arg1->lval ());
else else
return value_subscript (arg1, value_as_long (arg2)); return value_subscript (arg1, value_as_long (arg2));
} }
@ -2590,7 +2590,7 @@ evaluate_subexp_for_address_base (struct expression *exp, enum noside noside,
if (TYPE_IS_REFERENCE (type)) if (TYPE_IS_REFERENCE (type))
return value::zero (lookup_pointer_type (type->target_type ()), return value::zero (lookup_pointer_type (type->target_type ()),
not_lval); not_lval);
else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x)) else if (x->lval () == lval_memory || value_must_coerce_to_target (x))
return value::zero (lookup_pointer_type (x->type ()), return value::zero (lookup_pointer_type (x->type ()),
not_lval); not_lval);
else else
@ -2875,7 +2875,7 @@ var_msym_value_operation::evaluate_for_cast (struct type *to_type,
val = value_cast (to_type, val); val = value_cast (to_type, val);
/* Don't allow e.g. '&(int)var_with_no_debug_info'. */ /* Don't allow e.g. '&(int)var_with_no_debug_info'. */
if (VALUE_LVAL (val) == lval_memory) if (val->lval () == lval_memory)
{ {
if (val->lazy ()) if (val->lazy ())
val->fetch_lazy (); val->fetch_lazy ();
@ -2896,7 +2896,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type,
val = value_cast (to_type, val); val = value_cast (to_type, val);
/* Don't allow e.g. '&(int)var_with_no_debug_info'. */ /* Don't allow e.g. '&(int)var_with_no_debug_info'. */
if (VALUE_LVAL (val) == lval_memory) if (val->lval () == lval_memory)
{ {
if (val->lazy ()) if (val->lazy ())
val->fetch_lazy (); val->fetch_lazy ();

View file

@ -1889,7 +1889,7 @@ public:
expected type. This avoids a weird case where re-assigning a expected type. This avoids a weird case where re-assigning a
string or array to an internal variable could error with "Too string or array to an internal variable could error with "Too
many array elements". */ many array elements". */
struct type *xtype = (VALUE_LVAL (lhs) == lval_internalvar struct type *xtype = (lhs->lval () == lval_internalvar
? nullptr ? nullptr
: lhs->type ()); : lhs->type ());
value *rhs = std::get<1> (m_storage)->evaluate (xtype, exp, noside); value *rhs = std::get<1> (m_storage)->evaluate (xtype, exp, noside);

View file

@ -1363,7 +1363,7 @@ fortran_undetermined::value_subarray (value *array,
if (index < lb if (index < lb
|| (dim_type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED || (dim_type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED
&& index > ub) && index > ub)
|| (VALUE_LVAL (array) != lval_memory || (array->lval () != lval_memory
&& dim_type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED)) && dim_type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED))
{ {
if (type_not_associated (dim_type)) if (type_not_associated (dim_type))
@ -1460,7 +1460,7 @@ fortran_undetermined::value_subarray (value *array,
} }
else else
{ {
if (VALUE_LVAL (array) == lval_memory) if (array->lval () == lval_memory)
{ {
/* If the value we're taking a slice from is not yet loaded, or /* If the value we're taking a slice from is not yet loaded, or
the requested slice is outside the values content range then the requested slice is outside the values content range then
@ -1637,7 +1637,7 @@ fortran_structop_operation::evaluate (struct type *expect_type,
= gdb::make_array_view (valaddr, elt_type->length ()); = gdb::make_array_view (valaddr, elt_type->length ());
elt_type = resolve_dynamic_type (elt_type, view, address); elt_type = resolve_dynamic_type (elt_type, view, address);
} }
elt = value::zero (elt_type, VALUE_LVAL (elt)); elt = value::zero (elt_type, elt->lval ());
} }
return elt; return elt;
@ -1872,7 +1872,7 @@ fortran_argument_convert (struct value *value, bool is_artificial)
{ {
/* If the value is not in the inferior e.g. registers values, /* If the value is not in the inferior e.g. registers values,
convenience variables and user input. */ convenience variables and user input. */
if (VALUE_LVAL (value) != lval_memory) if (value->lval () != lval_memory)
{ {
struct type *type = value->type (); struct type *type = value->type ();
const int length = type->length (); const int length = type->length ();

View file

@ -846,7 +846,7 @@ read_frame_register_value (struct value *value, frame_info_ptr frame)
int regnum = VALUE_REGNUM (value); int regnum = VALUE_REGNUM (value);
int len = type_length_units (check_typedef (value->type ())); int len = type_length_units (check_typedef (value->type ()));
gdb_assert (VALUE_LVAL (value) == lval_register); gdb_assert (value->lval () == lval_register);
/* Skip registers wholly inside of REG_OFFSET. */ /* Skip registers wholly inside of REG_OFFSET. */
while (reg_offset >= register_size (gdbarch, regnum)) while (reg_offset >= register_size (gdbarch, regnum))

View file

@ -930,7 +930,7 @@ frame_find_by_id (struct frame_id id)
and get_prev_frame performs a series of checks that are relatively and get_prev_frame performs a series of checks that are relatively
expensive). This optimization is particularly useful when this function expensive). This optimization is particularly useful when this function
is called from another function (such as value_fetch_lazy, case is called from another function (such as value_fetch_lazy, case
VALUE_LVAL (val) == lval_register) which already loops over all frames, val->lval () == lval_register) which already loops over all frames,
making the overall behavior O(n^2). */ making the overall behavior O(n^2). */
frame = frame_stash_find (id); frame = frame_stash_find (id);
if (frame) if (frame)
@ -1191,7 +1191,7 @@ frame_register_unwind (frame_info_ptr next_frame, int regnum,
*optimizedp = value->optimized_out (); *optimizedp = value->optimized_out ();
*unavailablep = !value->entirely_available (); *unavailablep = !value->entirely_available ();
*lvalp = VALUE_LVAL (value); *lvalp = value->lval ();
*addrp = value->address (); *addrp = value->address ();
if (*lvalp == lval_register) if (*lvalp == lval_register)
*realnump = VALUE_REGNUM (value); *realnump = VALUE_REGNUM (value);
@ -1296,10 +1296,10 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
} }
else else
{ {
if (VALUE_LVAL (value) == lval_register) if (value->lval () == lval_register)
gdb_printf (&debug_file, " register=%d", gdb_printf (&debug_file, " register=%d",
VALUE_REGNUM (value)); VALUE_REGNUM (value));
else if (VALUE_LVAL (value) == lval_memory) else if (value->lval () == lval_memory)
gdb_printf (&debug_file, " address=%s", gdb_printf (&debug_file, " address=%s",
paddress (gdbarch, paddress (gdbarch,
value->address ())); value->address ()));

View file

@ -4908,7 +4908,7 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
if (TYPE_IS_REFERENCE (parm) && value != NULL) if (TYPE_IS_REFERENCE (parm) && value != NULL)
{ {
if (VALUE_LVAL (value) == not_lval) if (value->lval () == not_lval)
{ {
/* Rvalues should preferably bind to rvalue references or const /* Rvalues should preferably bind to rvalue references or const
lvalue references. */ lvalue references. */

View file

@ -343,7 +343,7 @@ find_function_addr (struct value *function,
int found_descriptor = 0; int found_descriptor = 0;
funaddr = 0; /* pacify "gcc -Werror" */ funaddr = 0; /* pacify "gcc -Werror" */
if (VALUE_LVAL (function) == lval_memory) if (function->lval () == lval_memory)
{ {
CORE_ADDR nfunaddr; CORE_ADDR nfunaddr;

View file

@ -104,7 +104,7 @@ eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
} }
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value::zero (type->target_type (), VALUE_LVAL (arg1)); return value::zero (type->target_type (), arg1->lval ());
else else
return value_subscript (arg1, value_as_long (arg2)); return value_subscript (arg1, value_as_long (arg2));
} }

View file

@ -300,7 +300,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
else else
{ {
/* Check whether to create a lvalue or not. */ /* Check whether to create a lvalue or not. */
if (VALUE_LVAL (val) != not_lval && !array_has_dups (indices, n)) if (val->lval () != not_lval && !array_has_dups (indices, n))
{ {
struct lval_closure *c = allocate_lval_closure (indices, n, val); struct lval_closure *c = allocate_lval_closure (indices, n, val);
ret = value::allocate_computed (dst_type, &opencl_value_funcs, c); ret = value::allocate_computed (dst_type, &opencl_value_funcs, c);
@ -687,7 +687,7 @@ eval_opencl_assign (struct type *expect_type, struct expression *exp,
struct type *type1 = arg1->type (); struct type *type1 = arg1->type ();
if (arg1->deprecated_modifiable () if (arg1->deprecated_modifiable ()
&& VALUE_LVAL (arg1) != lval_internalvar) && arg1->lval () != lval_internalvar)
arg2 = opencl_value_cast (type1, arg2); arg2 = opencl_value_cast (type1, arg2);
return value_assign (arg1, arg2); return value_assign (arg1, arg2);
@ -714,7 +714,7 @@ opencl_structop_operation::evaluate (struct type *expect_type,
NULL, "structure"); NULL, "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
v = value::zero (v->type (), VALUE_LVAL (v)); v = value::zero (v->type (), v->lval ());
return v; return v;
} }
} }

View file

@ -2455,9 +2455,9 @@ ppc_linux_nat_target::num_memory_accesses (const std::vector<value_ref_ptr>
struct value *v = iter.get (); struct value *v = iter.get ();
/* Constants and values from the history are fine. */ /* Constants and values from the history are fine. */
if (VALUE_LVAL (v) == not_lval || v->->deprecated_modifiable () == 0) if (v->lval () == not_lval || v->->deprecated_modifiable () == 0)
continue; continue;
else if (VALUE_LVAL (v) == lval_memory) else if (v->lval () == lval_memory)
{ {
/* A lazy memory lvalue is one that GDB never needed to fetch; /* A lazy memory lvalue is one that GDB never needed to fetch;
we either just used its address (e.g., `a' in `a.b') or we either just used its address (e.g., `a' in `a.b') or
@ -2509,7 +2509,7 @@ ppc_linux_nat_target::check_condition (CORE_ADDR watch_addr,
return 0; return 0;
if (num_accesses_left == 1 && num_accesses_right == 0 if (num_accesses_left == 1 && num_accesses_right == 0
&& VALUE_LVAL (left_val) == lval_memory && left_val->lval () == lval_memory
&& left_val->address () == watch_addr) && left_val->address () == watch_addr)
{ {
*data_value = value_as_long (right_val); *data_value = value_as_long (right_val);
@ -2519,7 +2519,7 @@ ppc_linux_nat_target::check_condition (CORE_ADDR watch_addr,
*len = check_typedef (left_val->type ())->length (); *len = check_typedef (left_val->type ())->length ();
} }
else if (num_accesses_left == 0 && num_accesses_right == 1 else if (num_accesses_left == 0 && num_accesses_right == 1
&& VALUE_LVAL (right_val) == lval_memory && right_val->lval () == lval_memory
&& right_val->address () == watch_addr) && right_val->address () == watch_addr)
{ {
*data_value = value_as_long (left_val); *data_value = value_as_long (left_val);

View file

@ -297,7 +297,7 @@ print_formatted (struct value *val, int size,
struct type *type = check_typedef (val->type ()); struct type *type = check_typedef (val->type ());
int len = type->length (); int len = type->length ();
if (VALUE_LVAL (val) == lval_memory) if (val->lval () == lval_memory)
next_address = val->address () + len; next_address = val->address () + len;
if (size) if (size)
@ -1904,7 +1904,7 @@ x_command (const char *exp, int from_tty)
/* In rvalue contexts, such as this, functions are coerced into /* In rvalue contexts, such as this, functions are coerced into
pointers to functions. This makes "x/i main" work. */ pointers to functions. This makes "x/i main" work. */
if (val->type ()->code () == TYPE_CODE_FUNC if (val->type ()->code () == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory) && val->lval () == lval_memory)
next_address = val->address (); next_address = val->address ();
else else
next_address = value_as_address (val); next_address = value_as_address (val);
@ -2446,7 +2446,7 @@ printf_c_string (struct ui_file *stream, const char *format,
const gdb_byte *str; const gdb_byte *str;
if (value->type ()->code () != TYPE_CODE_PTR if (value->type ()->code () != TYPE_CODE_PTR
&& VALUE_LVAL (value) == lval_internalvar && value->lval () == lval_internalvar
&& c_is_string_type_p (value->type ())) && c_is_string_type_p (value->type ()))
{ {
size_t len = value->type ()->length (); size_t len = value->type ()->length ();
@ -2518,7 +2518,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
"wchar_t", NULL, 0); "wchar_t", NULL, 0);
int wcwidth = wctype->length (); int wcwidth = wctype->length ();
if (VALUE_LVAL (value) == lval_internalvar if (value->lval () == lval_internalvar
&& c_is_string_type_p (value->type ())) && c_is_string_type_p (value->type ()))
{ {
str = value->contents ().data (); str = value->contents ().data ();

View file

@ -272,7 +272,7 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args)
{ {
struct value *user_reg_value struct value *user_reg_value
= value_of_user_reg (regnum, pending_frame->frame_info); = value_of_user_reg (regnum, pending_frame->frame_info);
if (VALUE_LVAL (user_reg_value) == lval_register) if (user_reg_value->lval () == lval_register)
regnum = VALUE_REGNUM (user_reg_value); regnum = VALUE_REGNUM (user_reg_value);
if (regnum >= gdbarch_num_cooked_regs (pending_frame->gdbarch)) if (regnum >= gdbarch_num_cooked_regs (pending_frame->gdbarch))
{ {

View file

@ -1204,7 +1204,7 @@ rust_subscript (struct type *expect_type, struct expression *exp,
else else
new_type = base_type; new_type = base_type;
return value::zero (new_type, VALUE_LVAL (lhs)); return value::zero (new_type, lhs->lval ());
} }
else else
{ {
@ -1470,7 +1470,7 @@ rust_structop::evaluate (struct type *expect_type,
else else
result = value_struct_elt (&lhs, {}, field_name, NULL, "structure"); result = value_struct_elt (&lhs, {}, field_name, NULL, "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
result = value::zero (result->type (), VALUE_LVAL (result)); result = value::zero (result->type (), result->lval ());
return result; return result;
} }

View file

@ -1710,7 +1710,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
if (!value->optimized_out () && value->entirely_available ()) if (!value->optimized_out () && value->entirely_available ())
{ {
if (VALUE_LVAL (value) == not_lval) if (value->lval () == not_lval)
{ {
CORE_ADDR sp; CORE_ADDR sp;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@ -1723,13 +1723,13 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
gdb_puts (paddress (gdbarch, sp)); gdb_puts (paddress (gdbarch, sp));
gdb_printf ("\n"); gdb_printf ("\n");
} }
else if (VALUE_LVAL (value) == lval_memory) else if (value->lval () == lval_memory)
{ {
gdb_printf (" Previous frame's sp at "); gdb_printf (" Previous frame's sp at ");
gdb_puts (paddress (gdbarch, value->address ())); gdb_puts (paddress (gdbarch, value->address ()));
gdb_printf ("\n"); gdb_printf ("\n");
} }
else if (VALUE_LVAL (value) == lval_register) else if (value->lval () == lval_register)
{ {
gdb_printf (" Previous frame's sp in %s\n", gdb_printf (" Previous frame's sp in %s\n",
gdbarch_register_name (gdbarch, gdbarch_register_name (gdbarch,

View file

@ -93,7 +93,7 @@ value_ptradd (struct value *arg1, LONGEST arg2)
result = value_from_pointer (valptrtype, result = value_from_pointer (valptrtype,
value_as_address (arg1) + sz * arg2); value_as_address (arg1) + sz * arg2);
if (VALUE_LVAL (result) != lval_internalvar) if (result->lval () != lval_internalvar)
result->set_component_location (arg1); result->set_component_location (arg1);
return result; return result;
} }
@ -159,7 +159,7 @@ value_subscript (struct value *array, LONGEST index)
if (!lowerbound.has_value ()) if (!lowerbound.has_value ())
lowerbound = 0; lowerbound = 0;
if (VALUE_LVAL (array) != lval_memory) if (array->lval () != lval_memory)
return value_subscripted_rvalue (array, index, *lowerbound); return value_subscripted_rvalue (array, index, *lowerbound);
gdb::optional<LONGEST> upperbound gdb::optional<LONGEST> upperbound
@ -235,7 +235,7 @@ value_subscripted_rvalue (struct value *array, LONGEST index,
if (index < lowerbound if (index < lowerbound
|| (!array_upper_bound_undefined || (!array_upper_bound_undefined
&& elt_offs >= type_length_units (array_type)) && elt_offs >= type_length_units (array_type))
|| (VALUE_LVAL (array) != lval_memory && array_upper_bound_undefined)) || (array->lval () != lval_memory && array_upper_bound_undefined))
{ {
if (type_not_associated (array_type)) if (type_not_associated (array_type))
error (_("no such vector element (vector not associated)")); error (_("no such vector element (vector not associated)"));
@ -532,7 +532,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
if (return_type == NULL) if (return_type == NULL)
error (_("Xmethod is missing return type.")); error (_("Xmethod is missing return type."));
return value::zero (return_type, VALUE_LVAL (arg1)); return value::zero (return_type, arg1->lval ());
} }
return argvec[0]->call_xmethod (argvec.slice (1)); return argvec[0]->call_xmethod (argvec.slice (1));
} }
@ -541,7 +541,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
struct type *return_type; struct type *return_type;
return_type = check_typedef (argvec[0]->type ())->target_type (); return_type = check_typedef (argvec[0]->type ())->target_type ();
return value::zero (return_type, VALUE_LVAL (arg1)); return value::zero (return_type, arg1->lval ());
} }
return call_function_by_hand (argvec[0], NULL, return call_function_by_hand (argvec[0], NULL,
argvec.slice (1, 2 - static_memfuncp)); argvec.slice (1, 2 - static_memfuncp));
@ -645,7 +645,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
if (return_type == NULL) if (return_type == NULL)
error (_("Xmethod is missing return type.")); error (_("Xmethod is missing return type."));
return value::zero (return_type, VALUE_LVAL (arg1)); return value::zero (return_type, arg1->lval ());
} }
return argvec[0]->call_xmethod (argvec[1]); return argvec[0]->call_xmethod (argvec[1]);
} }
@ -654,7 +654,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
struct type *return_type; struct type *return_type;
return_type = check_typedef (argvec[0]->type ())->target_type (); return_type = check_typedef (argvec[0]->type ())->target_type ();
return value::zero (return_type, VALUE_LVAL (arg1)); return value::zero (return_type, arg1->lval ());
} }
return call_function_by_hand (argvec[0], NULL, return call_function_by_hand (argvec[0], NULL,
argvec.slice (1, nargs)); argvec.slice (1, nargs));

View file

@ -653,7 +653,7 @@ value_cast (struct type *type, struct value *arg2)
arg2->set_pointed_to_offset (0); /* pai: chk_val */ arg2->set_pointed_to_offset (0); /* pai: chk_val */
return arg2; return arg2;
} }
else if (VALUE_LVAL (arg2) == lval_memory) else if (arg2->lval () == lval_memory)
return value_at_lazy (to_type, arg2->address ()); return value_at_lazy (to_type, arg2->address ());
else else
{ {
@ -971,7 +971,7 @@ value_one (struct type *type)
} }
/* value_one result is never used for assignments to. */ /* value_one result is never used for assignments to. */
gdb_assert (VALUE_LVAL (val) == not_lval); gdb_assert (val->lval () == not_lval);
return val; return val;
} }
@ -1095,7 +1095,7 @@ value_assign (struct value *toval, struct value *fromval)
toval = coerce_ref (toval); toval = coerce_ref (toval);
type = toval->type (); type = toval->type ();
if (VALUE_LVAL (toval) != lval_internalvar) if (toval->lval () != lval_internalvar)
fromval = value_cast (type, fromval); fromval = value_cast (type, fromval);
else else
{ {
@ -1112,7 +1112,7 @@ value_assign (struct value *toval, struct value *fromval)
and then restore the new frame afterwards. */ and then restore the new frame afterwards. */
old_frame = get_frame_id (deprecated_safe_get_selected_frame ()); old_frame = get_frame_id (deprecated_safe_get_selected_frame ());
switch (VALUE_LVAL (toval)) switch (toval->lval ())
{ {
case lval_internalvar: case lval_internalvar:
set_internalvar (VALUE_INTERNALVAR (toval), fromval); set_internalvar (VALUE_INTERNALVAR (toval), fromval);
@ -1292,7 +1292,7 @@ value_assign (struct value *toval, struct value *fromval)
cause the frame cache and regcache to be out of date. Assigning to memory cause the frame cache and regcache to be out of date. Assigning to memory
also can. We just do this on all assignments to registers or also can. We just do this on all assignments to registers or
memory, for simplicity's sake; I doubt the slowdown matters. */ memory, for simplicity's sake; I doubt the slowdown matters. */
switch (VALUE_LVAL (toval)) switch (toval->lval ())
{ {
case lval_memory: case lval_memory:
case lval_register: case lval_register:
@ -1366,7 +1366,7 @@ value_repeat (struct value *arg1, int count)
{ {
struct value *val; struct value *val;
if (VALUE_LVAL (arg1) != lval_memory) if (arg1->lval () != lval_memory)
error (_("Only values in memory can be extended with '@'.")); error (_("Only values in memory can be extended with '@'."));
if (count < 1) if (count < 1)
error (_("Invalid number %d of repetitions."), count); error (_("Invalid number %d of repetitions."), count);
@ -1406,7 +1406,7 @@ address_of_variable (struct symbol *var, const struct block *b)
val = value_of_variable (var, b); val = value_of_variable (var, b);
type = val->type (); type = val->type ();
if ((VALUE_LVAL (val) == lval_memory && val->lazy ()) if ((val->lval () == lval_memory && val->lazy ())
|| type->code () == TYPE_CODE_FUNC) || type->code () == TYPE_CODE_FUNC)
{ {
CORE_ADDR addr = val->address (); CORE_ADDR addr = val->address ();
@ -1415,7 +1415,7 @@ address_of_variable (struct symbol *var, const struct block *b)
} }
/* Not a memory address; check what the problem was. */ /* Not a memory address; check what the problem was. */
switch (VALUE_LVAL (val)) switch (val->lval ())
{ {
case lval_register: case lval_register:
{ {
@ -1452,9 +1452,9 @@ value_must_coerce_to_target (struct value *val)
struct type *valtype; struct type *valtype;
/* The only lval kinds which do not live in target memory. */ /* The only lval kinds which do not live in target memory. */
if (VALUE_LVAL (val) != not_lval if (val->lval () != not_lval
&& VALUE_LVAL (val) != lval_internalvar && val->lval () != lval_internalvar
&& VALUE_LVAL (val) != lval_xcallable) && val->lval () != lval_xcallable)
return false; return false;
valtype = check_typedef (val->type ()); valtype = check_typedef (val->type ());
@ -1522,7 +1522,7 @@ value_coerce_array (struct value *arg1)
be a good time to do so. */ be a good time to do so. */
arg1 = value_coerce_to_target (arg1); arg1 = value_coerce_to_target (arg1);
if (VALUE_LVAL (arg1) != lval_memory) if (arg1->lval () != lval_memory)
error (_("Attempt to take address of value not located in memory.")); error (_("Attempt to take address of value not located in memory."));
return value_from_pointer (lookup_pointer_type (type->target_type ()), return value_from_pointer (lookup_pointer_type (type->target_type ()),
@ -1537,7 +1537,7 @@ value_coerce_function (struct value *arg1)
{ {
struct value *retval; struct value *retval;
if (VALUE_LVAL (arg1) != lval_memory) if (arg1->lval () != lval_memory)
error (_("Attempt to take address of value not located in memory.")); error (_("Attempt to take address of value not located in memory."));
retval = value_from_pointer (lookup_pointer_type (arg1->type ()), retval = value_from_pointer (lookup_pointer_type (arg1->type ()),
@ -1586,7 +1586,7 @@ value_addr (struct value *arg1)
then this would be a good time to force it to memory. */ then this would be a good time to force it to memory. */
arg1 = value_coerce_to_target (arg1); arg1 = value_coerce_to_target (arg1);
if (VALUE_LVAL (arg1) != lval_memory) if (arg1->lval () != lval_memory)
error (_("Attempt to take address of value not located in memory.")); error (_("Attempt to take address of value not located in memory."));
/* Get target memory address. */ /* Get target memory address. */
@ -1637,7 +1637,7 @@ value_ind (struct value *arg1)
base_type = check_typedef (arg1->type ()); base_type = check_typedef (arg1->type ());
if (VALUE_LVAL (arg1) == lval_computed) if (arg1->lval () == lval_computed)
{ {
const struct lval_funcs *funcs = arg1->computed_funcs (); const struct lval_funcs *funcs = arg1->computed_funcs ();
@ -3963,7 +3963,7 @@ value_full_object (struct value *argp,
} }
/* Check if object is in memory. */ /* Check if object is in memory. */
if (VALUE_LVAL (argp) != lval_memory) if (argp->lval () != lval_memory)
{ {
warning (_("Couldn't retrieve complete object of RTTI " warning (_("Couldn't retrieve complete object of RTTI "
"type %s; object may be in register(s)."), "type %s; object may be in register(s)."),
@ -4077,7 +4077,7 @@ value_slice (struct value *array, int lowbound, int length)
slice_range_type); slice_range_type);
slice_type->set_code (array_type->code ()); slice_type->set_code (array_type->code ());
if (VALUE_LVAL (array) == lval_memory && array->lazy ()) if (array->lval () == lval_memory && array->lazy ())
slice = value::allocate_lazy (slice_type); slice = value::allocate_lazy (slice_type);
else else
{ {

View file

@ -149,14 +149,14 @@ static struct cmd_list_element *functionlist;
value::~value () value::~value ()
{ {
if (VALUE_LVAL (this) == lval_computed) if (this->lval () == lval_computed)
{ {
const struct lval_funcs *funcs = m_location.computed.funcs; const struct lval_funcs *funcs = m_location.computed.funcs;
if (funcs->free_closure) if (funcs->free_closure)
funcs->free_closure (this); funcs->free_closure (this);
} }
else if (VALUE_LVAL (this) == lval_xcallable) else if (this->lval () == lval_xcallable)
delete m_location.xm_worker; delete m_location.xm_worker;
} }
@ -1262,9 +1262,9 @@ value::optimized_out ()
{ {
/* See if we can compute the result without fetching the /* See if we can compute the result without fetching the
value. */ value. */
if (VALUE_LVAL (this) == lval_memory) if (this->lval () == lval_memory)
return false; return false;
else if (VALUE_LVAL (this) == lval_computed) else if (this->lval () == lval_computed)
{ {
const struct lval_funcs *funcs = m_location.computed.funcs; const struct lval_funcs *funcs = m_location.computed.funcs;
@ -1515,7 +1515,7 @@ value::copy () const
gdb::copy (arg_view, val_contents); gdb::copy (arg_view, val_contents);
} }
if (VALUE_LVAL (val) == lval_computed) if (val->lval () == lval_computed)
{ {
const struct lval_funcs *funcs = val->m_location.computed.funcs; const struct lval_funcs *funcs = val->m_location.computed.funcs;
@ -1549,7 +1549,7 @@ make_cv_value (int cnst, int voltl, struct value *v)
struct value * struct value *
value::non_lval () value::non_lval ()
{ {
if (VALUE_LVAL (this) != not_lval) if (this->lval () != not_lval)
{ {
struct type *enc_type = enclosing_type (); struct type *enc_type = enclosing_type ();
struct value *val = value::allocate (enc_type); struct value *val = value::allocate (enc_type);
@ -1568,7 +1568,7 @@ value::non_lval ()
void void
value::force_lval (CORE_ADDR addr) value::force_lval (CORE_ADDR addr)
{ {
gdb_assert (VALUE_LVAL (this) == not_lval); gdb_assert (this->lval () == not_lval);
write_memory (addr, contents_raw ().data (), type ()->length ()); write_memory (addr, contents_raw ().data (), type ()->length ());
m_lval = lval_memory; m_lval = lval_memory;
@ -1626,13 +1626,13 @@ value::set_component_location (const struct value *whole)
carry around both the parent value contents, and the contents of carry around both the parent value contents, and the contents of
any dynamic fields within the parent. This is a substantial any dynamic fields within the parent. This is a substantial
change to how values work in GDB. */ change to how values work in GDB. */
if (VALUE_LVAL (this) == lval_internalvar_component) if (this->lval () == lval_internalvar_component)
{ {
gdb_assert (lazy ()); gdb_assert (lazy ());
m_lval = lval_memory; m_lval = lval_memory;
} }
else else
gdb_assert (VALUE_LVAL (this) == lval_memory); gdb_assert (this->lval () == lval_memory);
set_address (TYPE_DATA_LOCATION_ADDR (type)); set_address (TYPE_DATA_LOCATION_ADDR (type));
} }
} }
@ -2159,7 +2159,7 @@ set_internalvar (struct internalvar *var, struct value *val)
break; break;
case TYPE_CODE_INTERNAL_FUNCTION: case TYPE_CODE_INTERNAL_FUNCTION:
gdb_assert (VALUE_LVAL (val) == lval_internalvar); gdb_assert (val->lval () == lval_internalvar);
new_kind = INTERNALVAR_FUNCTION; new_kind = INTERNALVAR_FUNCTION;
get_internalvar_function (VALUE_INTERNALVAR (val), get_internalvar_function (VALUE_INTERNALVAR (val),
&new_data.fn.function); &new_data.fn.function);
@ -2282,7 +2282,7 @@ value_internal_function_name (struct value *val)
struct internal_function *ifn; struct internal_function *ifn;
int result; int result;
gdb_assert (VALUE_LVAL (val) == lval_internalvar); gdb_assert (val->lval () == lval_internalvar);
result = get_internalvar_function (VALUE_INTERNALVAR (val), &ifn); result = get_internalvar_function (VALUE_INTERNALVAR (val), &ifn);
gdb_assert (result); gdb_assert (result);
@ -2297,7 +2297,7 @@ call_internal_function (struct gdbarch *gdbarch,
struct internal_function *ifn; struct internal_function *ifn;
int result; int result;
gdb_assert (VALUE_LVAL (func) == lval_internalvar); gdb_assert (func->lval () == lval_internalvar);
result = get_internalvar_function (VALUE_INTERNALVAR (func), &ifn); result = get_internalvar_function (VALUE_INTERNALVAR (func), &ifn);
gdb_assert (result); gdb_assert (result);
@ -2888,7 +2888,7 @@ value::primitive_field (LONGEST offset, int fieldno, struct type *arg_type)
LONGEST boffset; LONGEST boffset;
/* Lazy register values with offsets are not supported. */ /* Lazy register values with offsets are not supported. */
if (VALUE_LVAL (this) == lval_register && lazy ()) if (this->lval () == lval_register && lazy ())
fetch_lazy (); fetch_lazy ();
/* We special case virtual inheritance here because this /* We special case virtual inheritance here because this
@ -2932,7 +2932,7 @@ value::primitive_field (LONGEST offset, int fieldno, struct type *arg_type)
/ (HOST_CHAR_BIT * unit_size)); / (HOST_CHAR_BIT * unit_size));
/* Lazy register values with offsets are not supported. */ /* Lazy register values with offsets are not supported. */
if (VALUE_LVAL (this) == lval_register && lazy ()) if (this->lval () == lval_register && lazy ())
fetch_lazy (); fetch_lazy ();
if (lazy ()) if (lazy ())
@ -3526,7 +3526,7 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset)
{ {
struct value *v; struct value *v;
if (VALUE_LVAL (whole) == lval_memory && whole->lazy ()) if (whole->lval () == lval_memory && whole->lazy ())
v = value::allocate_lazy (type); v = value::allocate_lazy (type);
else else
{ {
@ -3761,7 +3761,7 @@ value::fetch_lazy_register ()
refer to the entire register. */ refer to the entire register. */
gdb_assert (offset () == 0); gdb_assert (offset () == 0);
while (VALUE_LVAL (new_val) == lval_register && new_val->lazy ()) while (new_val->lval () == lval_register && new_val->lazy ())
{ {
struct frame_id next_frame_id = VALUE_NEXT_FRAME_ID (new_val); struct frame_id next_frame_id = VALUE_NEXT_FRAME_ID (new_val);
@ -3796,7 +3796,7 @@ value::fetch_lazy_register ()
sniffer trying to unwind), bypassing its validations. In sniffer trying to unwind), bypassing its validations. In
any case, it should always be an internal error to end up any case, it should always be an internal error to end up
in this situation. */ in this situation. */
if (VALUE_LVAL (new_val) == lval_register if (new_val->lval () == lval_register
&& new_val->lazy () && new_val->lazy ()
&& VALUE_NEXT_FRAME_ID (new_val) == next_frame_id) && VALUE_NEXT_FRAME_ID (new_val) == next_frame_id)
internal_error (_("infinite loop while fetching a register")); internal_error (_("infinite loop while fetching a register"));
@ -3840,10 +3840,10 @@ value::fetch_lazy_register ()
int i; int i;
gdb::array_view<const gdb_byte> buf = new_val->contents (); gdb::array_view<const gdb_byte> buf = new_val->contents ();
if (VALUE_LVAL (new_val) == lval_register) if (new_val->lval () == lval_register)
gdb_printf (&debug_file, " register=%d", gdb_printf (&debug_file, " register=%d",
VALUE_REGNUM (new_val)); VALUE_REGNUM (new_val));
else if (VALUE_LVAL (new_val) == lval_memory) else if (new_val->lval () == lval_memory)
gdb_printf (&debug_file, " address=%s", gdb_printf (&debug_file, " address=%s",
paddress (gdbarch, paddress (gdbarch,
new_val->address ())); new_val->address ()));
@ -3883,11 +3883,11 @@ value::fetch_lazy ()
} }
else if (bitsize ()) else if (bitsize ())
fetch_lazy_bitfield (); fetch_lazy_bitfield ();
else if (VALUE_LVAL (this) == lval_memory) else if (this->lval () == lval_memory)
fetch_lazy_memory (); fetch_lazy_memory ();
else if (VALUE_LVAL (this) == lval_register) else if (this->lval () == lval_register)
fetch_lazy_register (); fetch_lazy_register ();
else if (VALUE_LVAL (this) == lval_computed else if (this->lval () == lval_computed
&& computed_funcs ()->read != NULL) && computed_funcs ()->read != NULL)
computed_funcs ()->read (this); computed_funcs ()->read (this);
else else

View file

@ -329,9 +329,6 @@ public:
uses. */ uses. */
void *computed_closure () const; void *computed_closure () const;
enum lval_type *deprecated_lval_hack ()
{ return &m_lval; }
enum lval_type lval () const enum lval_type lval () const
{ return m_lval; } { return m_lval; }
@ -952,13 +949,6 @@ struct lval_funcs
extern void error_value_optimized_out (void); extern void error_value_optimized_out (void);
/* While the following fields are per- VALUE .CONTENT .PIECE (i.e., a
single value might have multiple LVALs), this hacked interface is
limited to just the first PIECE. Expect further change. */
/* Type of value; either not an lval, or one of the various different
possible kinds of lval. */
#define VALUE_LVAL(val) (*((val)->deprecated_lval_hack ()))
/* Pointer to internal variable. */ /* Pointer to internal variable. */
#define VALUE_INTERNALVAR(val) (*((val)->deprecated_internalvar_hack ())) #define VALUE_INTERNALVAR(val) (*((val)->deprecated_internalvar_hack ()))

View file

@ -2270,7 +2270,7 @@ varobj_editable_p (const struct varobj *var)
struct type *type; struct type *type;
if (!(var->root->is_valid && var->value != nullptr if (!(var->root->is_valid && var->value != nullptr
&& VALUE_LVAL (var->value.get ()))) && var->value.get ()->lval ()))
return false; return false;
type = varobj_get_value_type (var); type = varobj_get_value_type (var);