Turn value_lazy and set_value_lazy functions into methods
This changes the value_lazy and set_value_lazy functions to be methods of value. Much of this patch was written by script. Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
parent
391f86284f
commit
3ee3b2700d
22 changed files with 87 additions and 96 deletions
|
@ -557,7 +557,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
|
||||||
|
|
||||||
if (value_optimized_out (val))
|
if (value_optimized_out (val))
|
||||||
result = allocate_optimized_out_value (type);
|
result = allocate_optimized_out_value (type);
|
||||||
else if (value_lazy (val)
|
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
|
|| (VALUE_LVAL (val) != not_lval
|
||||||
&& type->length () > val->type ()->length ()))
|
&& type->length () > val->type ()->length ()))
|
||||||
|
@ -2810,7 +2810,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
|
||||||
v = allocate_value (type);
|
v = allocate_value (type);
|
||||||
src = valaddr + offset;
|
src = valaddr + offset;
|
||||||
}
|
}
|
||||||
else if (VALUE_LVAL (obj) == lval_memory && value_lazy (obj))
|
else if (VALUE_LVAL (obj) == 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;
|
||||||
|
@ -10852,7 +10852,7 @@ ada_var_msym_value_operation::evaluate_for_cast (struct type *expect_type,
|
||||||
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 (VALUE_LVAL (val) == lval_memory)
|
||||||
{
|
{
|
||||||
if (value_lazy (val))
|
if (val->lazy ())
|
||||||
value_fetch_lazy (val);
|
value_fetch_lazy (val);
|
||||||
VALUE_LVAL (val) = not_lval;
|
VALUE_LVAL (val) = not_lval;
|
||||||
}
|
}
|
||||||
|
@ -10874,7 +10874,7 @@ ada_var_value_operation::evaluate_for_cast (struct type *expect_type,
|
||||||
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 (VALUE_LVAL (val) == lval_memory)
|
||||||
{
|
{
|
||||||
if (value_lazy (val))
|
if (val->lazy ())
|
||||||
value_fetch_lazy (val);
|
value_fetch_lazy (val);
|
||||||
VALUE_LVAL (val) = not_lval;
|
VALUE_LVAL (val) = not_lval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -982,7 +982,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
|
||||||
if (ada_is_tagged_type (deref_val->type (), 1))
|
if (ada_is_tagged_type (deref_val->type (), 1))
|
||||||
deref_val = ada_tag_value_at_base_address (deref_val);
|
deref_val = ada_tag_value_at_base_address (deref_val);
|
||||||
|
|
||||||
if (value_lazy (deref_val))
|
if (deref_val->lazy ())
|
||||||
value_fetch_lazy (deref_val);
|
value_fetch_lazy (deref_val);
|
||||||
|
|
||||||
common_val_print (deref_val, stream, recurse + 1,
|
common_val_print (deref_val, stream, recurse + 1,
|
||||||
|
|
|
@ -2076,7 +2076,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
|
||||||
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 (VALUE_LVAL (v) == lval_memory
|
||||||
&& (v == val_chain[0] || ! value_lazy (v)))
|
&& (v == val_chain[0] || ! v->lazy ()))
|
||||||
{
|
{
|
||||||
struct type *vtype = check_typedef (v->type ());
|
struct type *vtype = check_typedef (v->type ());
|
||||||
|
|
||||||
|
@ -10415,7 +10415,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
|
||||||
|
|
||||||
if (VALUE_LVAL (v) == lval_memory)
|
if (VALUE_LVAL (v) == lval_memory)
|
||||||
{
|
{
|
||||||
if (v != head && value_lazy (v))
|
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
|
||||||
needed to fetch; we either just used its address (e.g.,
|
needed to fetch; we either just used its address (e.g.,
|
||||||
`a' in `a.b') or we never needed it at all (e.g., `a'
|
`a' in `a.b') or we never needed it at all (e.g., `a'
|
||||||
|
|
|
@ -506,14 +506,14 @@ c_value_of_variable (const struct varobj *var,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (var->not_fetched && value_lazy (var->value.get ()))
|
if (var->not_fetched && var->value.get ()->lazy ())
|
||||||
/* Frozen variable and no value yet. We don't
|
/* Frozen variable and no value yet. We don't
|
||||||
implicitly fetch the value. MI response will
|
implicitly fetch the value. MI response will
|
||||||
use empty string for the value, which is OK. */
|
use empty string for the value, which is OK. */
|
||||||
return std::string ();
|
return std::string ();
|
||||||
|
|
||||||
gdb_assert (varobj_value_is_changeable_p (var));
|
gdb_assert (varobj_value_is_changeable_p (var));
|
||||||
gdb_assert (!value_lazy (var->value.get ()));
|
gdb_assert (!var->value.get ()->lazy ());
|
||||||
|
|
||||||
/* If the specified format is the current one,
|
/* If the specified format is the current one,
|
||||||
we can reuse print_value. */
|
we can reuse print_value. */
|
||||||
|
|
|
@ -1366,7 +1366,7 @@ value_of_dwarf_reg_entry (struct type *type, frame_info_ptr frame,
|
||||||
memcpy (value_contents_raw (val).data (),
|
memcpy (value_contents_raw (val).data (),
|
||||||
value_contents_raw (outer_val).data (),
|
value_contents_raw (outer_val).data (),
|
||||||
checked_type->length ());
|
checked_type->length ());
|
||||||
set_value_lazy (val, 0);
|
val->set_lazy (0);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ fetch_subexp_value (struct expression *exp,
|
||||||
have a non-lazy previous value to compare with. */
|
have a non-lazy previous value to compare with. */
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
if (!value_lazy (result))
|
if (!result->lazy ())
|
||||||
*valp = result;
|
*valp = result;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2877,7 +2877,7 @@ var_msym_value_operation::evaluate_for_cast (struct type *to_type,
|
||||||
/* 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 (VALUE_LVAL (val) == lval_memory)
|
||||||
{
|
{
|
||||||
if (value_lazy (val))
|
if (val->lazy ())
|
||||||
value_fetch_lazy (val);
|
value_fetch_lazy (val);
|
||||||
VALUE_LVAL (val) = not_lval;
|
VALUE_LVAL (val) = not_lval;
|
||||||
}
|
}
|
||||||
|
@ -2898,7 +2898,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type,
|
||||||
/* 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 (VALUE_LVAL (val) == lval_memory)
|
||||||
{
|
{
|
||||||
if (value_lazy (val))
|
if (val->lazy ())
|
||||||
value_fetch_lazy (val);
|
value_fetch_lazy (val);
|
||||||
VALUE_LVAL (val) = not_lval;
|
VALUE_LVAL (val) = not_lval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ public:
|
||||||
m_base_offset (base_offset),
|
m_base_offset (base_offset),
|
||||||
m_val (val)
|
m_val (val)
|
||||||
{
|
{
|
||||||
gdb_assert (!value_lazy (val));
|
gdb_assert (!val->lazy ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract an element of ELT_TYPE at offset (M_BASE_OFFSET + ELT_OFF)
|
/* Extract an element of ELT_TYPE at offset (M_BASE_OFFSET + ELT_OFF)
|
||||||
|
@ -1441,7 +1441,7 @@ fortran_undetermined::value_subarray (value *array,
|
||||||
/* Now copy the elements from the original ARRAY into the packed
|
/* Now copy the elements from the original ARRAY into the packed
|
||||||
array value DEST. */
|
array value DEST. */
|
||||||
struct value *dest = allocate_value (repacked_array_type);
|
struct value *dest = allocate_value (repacked_array_type);
|
||||||
if (value_lazy (array)
|
if (array->lazy ()
|
||||||
|| (total_offset + array_slice_type->length ()
|
|| (total_offset + array_slice_type->length ()
|
||||||
> check_typedef (array->type ())->length ()))
|
> check_typedef (array->type ())->length ()))
|
||||||
{
|
{
|
||||||
|
@ -1466,7 +1466,7 @@ fortran_undetermined::value_subarray (value *array,
|
||||||
the requested slice is outside the values content range then
|
the requested slice is outside the values content range then
|
||||||
just create a new lazy value pointing at the memory where the
|
just create a new lazy value pointing at the memory where the
|
||||||
contents we're looking for exist. */
|
contents we're looking for exist. */
|
||||||
if (value_lazy (array)
|
if (array->lazy ()
|
||||||
|| (total_offset + array_slice_type->length ()
|
|| (total_offset + array_slice_type->length ()
|
||||||
> check_typedef (array->type ())->length ()))
|
> check_typedef (array->type ())->length ()))
|
||||||
array = value_at_lazy (array_slice_type,
|
array = value_at_lazy (array_slice_type,
|
||||||
|
@ -1476,7 +1476,7 @@ fortran_undetermined::value_subarray (value *array,
|
||||||
(array_slice_type, value_contents (array).data () + total_offset,
|
(array_slice_type, value_contents (array).data () + total_offset,
|
||||||
value_address (array) + total_offset);
|
value_address (array) + total_offset);
|
||||||
}
|
}
|
||||||
else if (!value_lazy (array))
|
else if (!array->lazy ())
|
||||||
array = value_from_component (array, array_slice_type, total_offset);
|
array = value_from_component (array, array_slice_type, total_offset);
|
||||||
else
|
else
|
||||||
error (_("cannot subscript arrays that are not in memory"));
|
error (_("cannot subscript arrays that are not in memory"));
|
||||||
|
|
|
@ -1306,7 +1306,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
|
||||||
else
|
else
|
||||||
gdb_printf (&debug_file, " computed");
|
gdb_printf (&debug_file, " computed");
|
||||||
|
|
||||||
if (value_lazy (value))
|
if (value->lazy ())
|
||||||
gdb_printf (&debug_file, " lazy");
|
gdb_printf (&debug_file, " lazy");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -161,9 +161,9 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
|
||||||
arg1->set_offset (arg1->offset ()
|
arg1->set_offset (arg1->offset ()
|
||||||
+ value_as_long (value_field (entry, 0)));
|
+ value_as_long (value_field (entry, 0)));
|
||||||
|
|
||||||
if (!value_lazy (arg1))
|
if (!arg1->lazy ())
|
||||||
{
|
{
|
||||||
set_value_lazy (arg1, 1);
|
arg1->set_lazy (1);
|
||||||
value_fetch_lazy (arg1);
|
value_fetch_lazy (arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -965,7 +965,7 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
|
||||||
enum ext_lang_rc result = EXT_LANG_RC_NOP;
|
enum ext_lang_rc result = EXT_LANG_RC_NOP;
|
||||||
enum guile_string_repr_result print_result;
|
enum guile_string_repr_result print_result;
|
||||||
|
|
||||||
if (value_lazy (value))
|
if (value->lazy ())
|
||||||
value_fetch_lazy (value);
|
value_fetch_lazy (value);
|
||||||
|
|
||||||
/* No pretty-printer support for unavailable values. */
|
/* No pretty-printer support for unavailable values. */
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ gdbscm_value_lazy_p (SCM self)
|
||||||
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
|
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
|
||||||
struct value *value = v_smob->value;
|
struct value *value = v_smob->value;
|
||||||
|
|
||||||
return scm_from_bool (value_lazy (value));
|
return scm_from_bool (value->lazy ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (value-fetch-lazy! <gdb:value>) -> unspecified */
|
/* (value-fetch-lazy! <gdb:value>) -> unspecified */
|
||||||
|
@ -1247,7 +1247,7 @@ gdbscm_value_fetch_lazy_x (SCM self)
|
||||||
|
|
||||||
return gdbscm_wrap ([=]
|
return gdbscm_wrap ([=]
|
||||||
{
|
{
|
||||||
if (value_lazy (value))
|
if (value->lazy ())
|
||||||
value_fetch_lazy (value);
|
value_fetch_lazy (value);
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
});
|
});
|
||||||
|
|
|
@ -2462,7 +2462,7 @@ ppc_linux_nat_target::num_memory_accesses (const std::vector<value_ref_ptr>
|
||||||
/* 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
|
||||||
we never needed it at all (e.g., `a' in `a,b'). */
|
we never needed it at all (e.g., `a' in `a,b'). */
|
||||||
if (!value_lazy (v))
|
if (!v->lazy ())
|
||||||
found_memory_cnt++;
|
found_memory_cnt++;
|
||||||
}
|
}
|
||||||
/* Other kinds of values are not fine. */
|
/* Other kinds of values are not fine. */
|
||||||
|
|
|
@ -1943,7 +1943,7 @@ x_command (const char *exp, int from_tty)
|
||||||
as $__. If the last value has not been fetched from memory
|
as $__. If the last value has not been fetched from memory
|
||||||
then don't fetch it now; instead mark it by voiding the $__
|
then don't fetch it now; instead mark it by voiding the $__
|
||||||
variable. */
|
variable. */
|
||||||
if (value_lazy (last_examine_value.get ()))
|
if (last_examine_value.get ()->lazy ())
|
||||||
clear_internalvar (lookup_internalvar ("__"));
|
clear_internalvar (lookup_internalvar ("__"));
|
||||||
else
|
else
|
||||||
set_internalvar (lookup_internalvar ("__"), last_examine_value.get ());
|
set_internalvar (lookup_internalvar ("__"), last_examine_value.get ());
|
||||||
|
|
|
@ -578,7 +578,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
|
||||||
struct gdbarch *gdbarch = type->arch ();
|
struct gdbarch *gdbarch = type->arch ();
|
||||||
enum gdbpy_string_repr_result print_result;
|
enum gdbpy_string_repr_result print_result;
|
||||||
|
|
||||||
if (value_lazy (value))
|
if (value->lazy ())
|
||||||
value_fetch_lazy (value);
|
value_fetch_lazy (value);
|
||||||
|
|
||||||
/* No pretty-printer support for unavailable values. */
|
/* No pretty-printer support for unavailable values. */
|
||||||
|
|
|
@ -1219,7 +1219,7 @@ valpy_get_is_lazy (PyObject *self, void *closure)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
opt = value_lazy (value);
|
opt = value->lazy ();
|
||||||
}
|
}
|
||||||
catch (const gdb_exception &except)
|
catch (const gdb_exception &except)
|
||||||
{
|
{
|
||||||
|
@ -1240,7 +1240,7 @@ valpy_fetch_lazy (PyObject *self, PyObject *args)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (value_lazy (value))
|
if (value->lazy ())
|
||||||
value_fetch_lazy (value);
|
value_fetch_lazy (value);
|
||||||
}
|
}
|
||||||
catch (const gdb_exception &except)
|
catch (const gdb_exception &except)
|
||||||
|
|
10
gdb/stack.c
10
gdb/stack.c
|
@ -580,9 +580,9 @@ read_frame_arg (const frame_print_options &fp_opts,
|
||||||
{
|
{
|
||||||
struct type *type = val->type ();
|
struct type *type = val->type ();
|
||||||
|
|
||||||
if (value_lazy (val))
|
if (val->lazy ())
|
||||||
value_fetch_lazy (val);
|
value_fetch_lazy (val);
|
||||||
if (value_lazy (entryval))
|
if (entryval->lazy ())
|
||||||
value_fetch_lazy (entryval);
|
value_fetch_lazy (entryval);
|
||||||
|
|
||||||
if (value_contents_eq (val, 0, entryval, 0, type->length ()))
|
if (value_contents_eq (val, 0, entryval, 0, type->length ()))
|
||||||
|
@ -599,12 +599,12 @@ read_frame_arg (const frame_print_options &fp_opts,
|
||||||
struct type *type_deref;
|
struct type *type_deref;
|
||||||
|
|
||||||
val_deref = coerce_ref (val);
|
val_deref = coerce_ref (val);
|
||||||
if (value_lazy (val_deref))
|
if (val_deref->lazy ())
|
||||||
value_fetch_lazy (val_deref);
|
value_fetch_lazy (val_deref);
|
||||||
type_deref = val_deref->type ();
|
type_deref = val_deref->type ();
|
||||||
|
|
||||||
entryval_deref = coerce_ref (entryval);
|
entryval_deref = coerce_ref (entryval);
|
||||||
if (value_lazy (entryval_deref))
|
if (entryval_deref->lazy ())
|
||||||
value_fetch_lazy (entryval_deref);
|
value_fetch_lazy (entryval_deref);
|
||||||
|
|
||||||
/* If the reference addresses match but dereferenced
|
/* If the reference addresses match but dereferenced
|
||||||
|
@ -2749,7 +2749,7 @@ return_command (const char *retval_exp, int from_tty)
|
||||||
|
|
||||||
/* Make sure the value is fully evaluated. It may live in the
|
/* Make sure the value is fully evaluated. It may live in the
|
||||||
stack frame we're about to pop. */
|
stack frame we're about to pop. */
|
||||||
if (value_lazy (return_value))
|
if (return_value->lazy ())
|
||||||
value_fetch_lazy (return_value);
|
value_fetch_lazy (return_value);
|
||||||
|
|
||||||
if (thisfun != NULL)
|
if (thisfun != NULL)
|
||||||
|
|
|
@ -187,7 +187,7 @@ value_subscript (struct value *array, LONGEST index)
|
||||||
Instead mock up a new one and give it the original address. */
|
Instead mock up a new one and give it the original address. */
|
||||||
struct type *elt_type = check_typedef (tarray->target_type ());
|
struct type *elt_type = check_typedef (tarray->target_type ());
|
||||||
LONGEST elt_size = type_length_units (elt_type);
|
LONGEST elt_size = type_length_units (elt_type);
|
||||||
if (!value_lazy (array)
|
if (!array->lazy ()
|
||||||
&& !value_bytes_available (array, elt_size * index, elt_size))
|
&& !value_bytes_available (array, elt_size * index, elt_size))
|
||||||
{
|
{
|
||||||
struct value *val = allocate_value (elt_type);
|
struct value *val = allocate_value (elt_type);
|
||||||
|
|
|
@ -1343,7 +1343,7 @@ value_assign (struct value *toval, struct value *fromval)
|
||||||
information, but its contents are updated from FROMVAL. This
|
information, but its contents are updated from FROMVAL. This
|
||||||
implies the returned value is not lazy, even if TOVAL was. */
|
implies the returned value is not lazy, even if TOVAL was. */
|
||||||
val = value_copy (toval);
|
val = value_copy (toval);
|
||||||
set_value_lazy (val, 0);
|
val->set_lazy (0);
|
||||||
copy (value_contents (fromval), value_contents_raw (val));
|
copy (value_contents (fromval), value_contents_raw (val));
|
||||||
|
|
||||||
/* We copy over the enclosing type and pointed-to offset from FROMVAL
|
/* We copy over the enclosing type and pointed-to offset from FROMVAL
|
||||||
|
@ -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 && value_lazy (val))
|
if ((VALUE_LVAL (val) == lval_memory && val->lazy ())
|
||||||
|| type->code () == TYPE_CODE_FUNC)
|
|| type->code () == TYPE_CODE_FUNC)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr = value_address (val);
|
CORE_ADDR addr = value_address (val);
|
||||||
|
@ -4078,7 +4078,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 && value_lazy (array))
|
if (VALUE_LVAL (array) == lval_memory && array->lazy ())
|
||||||
slice = allocate_value_lazy (slice_type);
|
slice = allocate_value_lazy (slice_type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1043,7 +1043,7 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
|
||||||
get a fixed representation of our value. */
|
get a fixed representation of our value. */
|
||||||
value = ada_to_fixed_value (value);
|
value = ada_to_fixed_value (value);
|
||||||
|
|
||||||
if (value_lazy (value))
|
if (value->lazy ())
|
||||||
value_fetch_lazy (value);
|
value_fetch_lazy (value);
|
||||||
|
|
||||||
struct value_print_options local_opts = *options;
|
struct value_print_options local_opts = *options;
|
||||||
|
|
52
gdb/value.c
52
gdb/value.c
|
@ -1018,7 +1018,7 @@ allocate_optimized_out_value (struct type *type)
|
||||||
struct value *retval = allocate_value_lazy (type);
|
struct value *retval = allocate_value_lazy (type);
|
||||||
|
|
||||||
mark_value_bytes_optimized_out (retval, 0, type->length ());
|
mark_value_bytes_optimized_out (retval, 0, type->length ());
|
||||||
set_value_lazy (retval, 0);
|
retval->set_lazy (0);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1291,18 +1291,6 @@ value_contents_copy (struct value *dst, LONGEST dst_offset,
|
||||||
value_contents_copy_raw (dst, dst_offset, src, src_offset, length);
|
value_contents_copy_raw (dst, dst_offset, src, src_offset, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
value_lazy (const struct value *value)
|
|
||||||
{
|
|
||||||
return value->m_lazy;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
set_value_lazy (struct value *value, int val)
|
|
||||||
{
|
|
||||||
value->m_lazy = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
value_stack (const struct value *value)
|
value_stack (const struct value *value)
|
||||||
{
|
{
|
||||||
|
@ -1607,7 +1595,7 @@ value_copy (const value *arg)
|
||||||
val->m_parent = arg->m_parent;
|
val->m_parent = arg->m_parent;
|
||||||
val->m_limited_length = arg->m_limited_length;
|
val->m_limited_length = arg->m_limited_length;
|
||||||
|
|
||||||
if (!value_lazy (val)
|
if (!val->lazy ()
|
||||||
&& !(value_entirely_optimized_out (val)
|
&& !(value_entirely_optimized_out (val)
|
||||||
|| value_entirely_unavailable (val)))
|
|| value_entirely_unavailable (val)))
|
||||||
{
|
{
|
||||||
|
@ -1740,7 +1728,7 @@ set_value_component_location (struct value *component,
|
||||||
change to how values work in GDB. */
|
change to how values work in GDB. */
|
||||||
if (VALUE_LVAL (component) == lval_internalvar_component)
|
if (VALUE_LVAL (component) == lval_internalvar_component)
|
||||||
{
|
{
|
||||||
gdb_assert (value_lazy (component));
|
gdb_assert (component->lazy ());
|
||||||
VALUE_LVAL (component) = lval_memory;
|
VALUE_LVAL (component) = lval_memory;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1764,7 +1752,7 @@ record_latest_value (struct value *val)
|
||||||
In particular, "set $1 = 50" should not affect the variable from which
|
In particular, "set $1 = 50" should not affect the variable from which
|
||||||
the value was taken, and fast watchpoints should be able to assume that
|
the value was taken, and fast watchpoints should be able to assume that
|
||||||
a value on the value history never changes. */
|
a value on the value history never changes. */
|
||||||
if (value_lazy (val))
|
if (val->lazy ())
|
||||||
{
|
{
|
||||||
/* We know that this is a _huge_ array, any attempt to fetch this
|
/* We know that this is a _huge_ array, any attempt to fetch this
|
||||||
is going to cause GDB to throw an error. However, to allow
|
is going to cause GDB to throw an error. However, to allow
|
||||||
|
@ -2150,7 +2138,7 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
|
||||||
|
|
||||||
case INTERNALVAR_VALUE:
|
case INTERNALVAR_VALUE:
|
||||||
val = value_copy (var->u.value);
|
val = value_copy (var->u.value);
|
||||||
if (value_lazy (val))
|
if (val->lazy ())
|
||||||
value_fetch_lazy (val);
|
value_fetch_lazy (val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2290,7 +2278,7 @@ set_internalvar (struct internalvar *var, struct value *val)
|
||||||
/* Force the value to be fetched from the target now, to avoid problems
|
/* Force the value to be fetched from the target now, to avoid problems
|
||||||
later when this internalvar is referenced and the target is gone or
|
later when this internalvar is referenced and the target is gone or
|
||||||
has changed. */
|
has changed. */
|
||||||
if (value_lazy (copy))
|
if (copy->lazy ())
|
||||||
value_fetch_lazy (copy);
|
value_fetch_lazy (copy);
|
||||||
|
|
||||||
/* Release the value from the value chain to prevent it from being
|
/* Release the value from the value chain to prevent it from being
|
||||||
|
@ -3003,7 +2991,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
|
||||||
+ offset
|
+ offset
|
||||||
+ (bitpos - v->m_bitpos) / 8);
|
+ (bitpos - v->m_bitpos) / 8);
|
||||||
v->set_parent (arg1);
|
v->set_parent (arg1);
|
||||||
if (!value_lazy (arg1))
|
if (!arg1->lazy ())
|
||||||
value_fetch_lazy (v);
|
value_fetch_lazy (v);
|
||||||
}
|
}
|
||||||
else if (fieldno < TYPE_N_BASECLASSES (arg_type))
|
else if (fieldno < TYPE_N_BASECLASSES (arg_type))
|
||||||
|
@ -3014,7 +3002,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
|
||||||
LONGEST boffset;
|
LONGEST boffset;
|
||||||
|
|
||||||
/* Lazy register values with offsets are not supported. */
|
/* Lazy register values with offsets are not supported. */
|
||||||
if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1))
|
if (VALUE_LVAL (arg1) == lval_register && arg1->lazy ())
|
||||||
value_fetch_lazy (arg1);
|
value_fetch_lazy (arg1);
|
||||||
|
|
||||||
/* We special case virtual inheritance here because this
|
/* We special case virtual inheritance here because this
|
||||||
|
@ -3029,7 +3017,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
|
||||||
else
|
else
|
||||||
boffset = arg_type->field (fieldno).loc_bitpos () / 8;
|
boffset = arg_type->field (fieldno).loc_bitpos () / 8;
|
||||||
|
|
||||||
if (value_lazy (arg1))
|
if (arg1->lazy ())
|
||||||
v = allocate_value_lazy (arg1->enclosing_type ());
|
v = allocate_value_lazy (arg1->enclosing_type ());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3059,10 +3047,10 @@ value_primitive_field (struct value *arg1, LONGEST offset,
|
||||||
/ (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 (arg1) == lval_register && value_lazy (arg1))
|
if (VALUE_LVAL (arg1) == lval_register && arg1->lazy ())
|
||||||
value_fetch_lazy (arg1);
|
value_fetch_lazy (arg1);
|
||||||
|
|
||||||
if (value_lazy (arg1))
|
if (arg1->lazy ())
|
||||||
v = allocate_value_lazy (type);
|
v = allocate_value_lazy (type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3664,7 +3652,7 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset)
|
||||||
{
|
{
|
||||||
struct value *v;
|
struct value *v;
|
||||||
|
|
||||||
if (VALUE_LVAL (whole) == lval_memory && value_lazy (whole))
|
if (VALUE_LVAL (whole) == lval_memory && whole->lazy ())
|
||||||
v = allocate_value_lazy (type);
|
v = allocate_value_lazy (type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3685,7 +3673,7 @@ struct value *
|
||||||
value_from_component_bitsize (struct value *whole, struct type *type,
|
value_from_component_bitsize (struct value *whole, struct type *type,
|
||||||
LONGEST bit_offset, LONGEST bit_length)
|
LONGEST bit_offset, LONGEST bit_length)
|
||||||
{
|
{
|
||||||
gdb_assert (!value_lazy (whole));
|
gdb_assert (!whole->lazy ());
|
||||||
|
|
||||||
/* Preserve lvalue-ness if possible. This is needed to avoid
|
/* Preserve lvalue-ness if possible. This is needed to avoid
|
||||||
array-printing failures (including crashes) when printing Ada
|
array-printing failures (including crashes) when printing Ada
|
||||||
|
@ -3865,7 +3853,7 @@ value_fetch_lazy_bitfield (struct value *val)
|
||||||
value have been fetched. */
|
value have been fetched. */
|
||||||
struct value *parent = val->parent ();
|
struct value *parent = val->parent ();
|
||||||
|
|
||||||
if (value_lazy (parent))
|
if (parent->lazy ())
|
||||||
value_fetch_lazy (parent);
|
value_fetch_lazy (parent);
|
||||||
|
|
||||||
unpack_value_bitfield (val, val->bitpos (), val->bitsize (),
|
unpack_value_bitfield (val, val->bitpos (), val->bitsize (),
|
||||||
|
@ -3916,7 +3904,7 @@ value_fetch_lazy_register (struct value *val)
|
||||||
refer to the entire register. */
|
refer to the entire register. */
|
||||||
gdb_assert (val->offset () == 0);
|
gdb_assert (val->offset () == 0);
|
||||||
|
|
||||||
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
|
while (VALUE_LVAL (new_val) == 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);
|
||||||
|
|
||||||
|
@ -3952,19 +3940,19 @@ value_fetch_lazy_register (struct value *val)
|
||||||
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 (VALUE_LVAL (new_val) == lval_register
|
||||||
&& value_lazy (new_val)
|
&& 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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's still lazy (for instance, a saved register on the
|
/* If it's still lazy (for instance, a saved register on the
|
||||||
stack), fetch it. */
|
stack), fetch it. */
|
||||||
if (value_lazy (new_val))
|
if (new_val->lazy ())
|
||||||
value_fetch_lazy (new_val);
|
value_fetch_lazy (new_val);
|
||||||
|
|
||||||
/* Copy the contents and the unavailability/optimized-out
|
/* Copy the contents and the unavailability/optimized-out
|
||||||
meta-data from NEW_VAL to VAL. */
|
meta-data from NEW_VAL to VAL. */
|
||||||
set_value_lazy (val, 0);
|
val->set_lazy (0);
|
||||||
value_contents_copy (val, val->embedded_offset (),
|
value_contents_copy (val, val->embedded_offset (),
|
||||||
new_val, new_val->embedded_offset (),
|
new_val, new_val->embedded_offset (),
|
||||||
type_length_units (type));
|
type_length_units (type));
|
||||||
|
@ -4031,7 +4019,7 @@ value_fetch_lazy_register (struct value *val)
|
||||||
void
|
void
|
||||||
value_fetch_lazy (struct value *val)
|
value_fetch_lazy (struct value *val)
|
||||||
{
|
{
|
||||||
gdb_assert (value_lazy (val));
|
gdb_assert (val->lazy ());
|
||||||
allocate_value_contents (val, true);
|
allocate_value_contents (val, true);
|
||||||
/* A value is either lazy, or fully fetched. The
|
/* A value is either lazy, or fully fetched. The
|
||||||
availability/validity is only established as we try to fetch a
|
availability/validity is only established as we try to fetch a
|
||||||
|
@ -4054,7 +4042,7 @@ value_fetch_lazy (struct value *val)
|
||||||
else
|
else
|
||||||
internal_error (_("Unexpected lazy value type."));
|
internal_error (_("Unexpected lazy value type."));
|
||||||
|
|
||||||
set_value_lazy (val, 0);
|
val->set_lazy (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implementation of the convenience function $_isvoid. */
|
/* Implementation of the convenience function $_isvoid. */
|
||||||
|
|
39
gdb/value.h
39
gdb/value.h
|
@ -227,6 +227,27 @@ struct value
|
||||||
void set_embedded_offset (LONGEST val)
|
void set_embedded_offset (LONGEST val)
|
||||||
{ m_embedded_offset = val; }
|
{ m_embedded_offset = val; }
|
||||||
|
|
||||||
|
/* If zero, contents of this value are in the contents field. If
|
||||||
|
nonzero, contents are in inferior. If the lval field is lval_memory,
|
||||||
|
the contents are in inferior memory at location.address plus offset.
|
||||||
|
The lval field may also be lval_register.
|
||||||
|
|
||||||
|
WARNING: This field is used by the code which handles watchpoints
|
||||||
|
(see breakpoint.c) to decide whether a particular value can be
|
||||||
|
watched by hardware watchpoints. If the lazy flag is set for some
|
||||||
|
member of a value chain, it is assumed that this member of the
|
||||||
|
chain doesn't need to be watched as part of watching the value
|
||||||
|
itself. This is how GDB avoids watching the entire struct or array
|
||||||
|
when the user wants to watch a single struct member or array
|
||||||
|
element. If you ever change the way lazy flag is set and reset, be
|
||||||
|
sure to consider this use as well! */
|
||||||
|
|
||||||
|
int lazy () const
|
||||||
|
{ return m_lazy; }
|
||||||
|
|
||||||
|
void set_lazy (int val)
|
||||||
|
{ m_lazy = val; }
|
||||||
|
|
||||||
|
|
||||||
/* If a value represents a C++ object, then the `type' field gives the
|
/* If a value represents a C++ object, then the `type' field gives the
|
||||||
object's compile-time type. If the object actually belongs to some
|
object's compile-time type. If the object actually belongs to some
|
||||||
|
@ -547,24 +568,6 @@ extern const struct lval_funcs *value_computed_funcs (const struct value *);
|
||||||
|
|
||||||
extern void *value_computed_closure (const struct value *value);
|
extern void *value_computed_closure (const struct value *value);
|
||||||
|
|
||||||
/* If zero, contents of this value are in the contents field. If
|
|
||||||
nonzero, contents are in inferior. If the lval field is lval_memory,
|
|
||||||
the contents are in inferior memory at location.address plus offset.
|
|
||||||
The lval field may also be lval_register.
|
|
||||||
|
|
||||||
WARNING: This field is used by the code which handles watchpoints
|
|
||||||
(see breakpoint.c) to decide whether a particular value can be
|
|
||||||
watched by hardware watchpoints. If the lazy flag is set for some
|
|
||||||
member of a value chain, it is assumed that this member of the
|
|
||||||
chain doesn't need to be watched as part of watching the value
|
|
||||||
itself. This is how GDB avoids watching the entire struct or array
|
|
||||||
when the user wants to watch a single struct member or array
|
|
||||||
element. If you ever change the way lazy flag is set and reset, be
|
|
||||||
sure to consider this use as well! */
|
|
||||||
|
|
||||||
extern int value_lazy (const struct value *);
|
|
||||||
extern void set_value_lazy (struct value *value, int val);
|
|
||||||
|
|
||||||
extern int value_stack (const struct value *);
|
extern int value_stack (const struct value *);
|
||||||
extern void set_value_stack (struct value *value, int val);
|
extern void set_value_stack (struct value *value, int val);
|
||||||
|
|
||||||
|
|
16
gdb/varobj.c
16
gdb/varobj.c
|
@ -504,7 +504,7 @@ varobj_set_display_format (struct varobj *var,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (varobj_value_is_changeable_p (var)
|
if (varobj_value_is_changeable_p (var)
|
||||||
&& var->value != nullptr && !value_lazy (var->value.get ()))
|
&& var->value != nullptr && !var->value.get ()->lazy ())
|
||||||
{
|
{
|
||||||
var->print_value = varobj_value_get_print_value (var->value.get (),
|
var->print_value = varobj_value_get_print_value (var->value.get (),
|
||||||
var->format, var);
|
var->format, var);
|
||||||
|
@ -1007,7 +1007,7 @@ varobj_set_value (struct varobj *var, const char *expression)
|
||||||
gdb_assert (varobj_value_is_changeable_p (var));
|
gdb_assert (varobj_value_is_changeable_p (var));
|
||||||
|
|
||||||
/* The value of a changeable variable object must not be lazy. */
|
/* The value of a changeable variable object must not be lazy. */
|
||||||
gdb_assert (!value_lazy (var->value.get ()));
|
gdb_assert (!var->value.get ()->lazy ());
|
||||||
|
|
||||||
/* Need to coerce the input. We want to check if the
|
/* Need to coerce the input. We want to check if the
|
||||||
value of the variable object will be different
|
value of the variable object will be different
|
||||||
|
@ -1247,7 +1247,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
|
||||||
that is we'll be comparing values of this type, fetch the
|
that is we'll be comparing values of this type, fetch the
|
||||||
value now. Otherwise, on the next update the old value
|
value now. Otherwise, on the next update the old value
|
||||||
will be lazy, which means we've lost that old value. */
|
will be lazy, which means we've lost that old value. */
|
||||||
if (need_to_fetch && value && value_lazy (value))
|
if (need_to_fetch && value && value->lazy ())
|
||||||
{
|
{
|
||||||
const struct varobj *parent = var->parent;
|
const struct varobj *parent = var->parent;
|
||||||
bool frozen = var->frozen;
|
bool frozen = var->frozen;
|
||||||
|
@ -1292,7 +1292,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
|
||||||
lazy -- if it is, the code above has decided that the value
|
lazy -- if it is, the code above has decided that the value
|
||||||
should not be fetched. */
|
should not be fetched. */
|
||||||
std::string print_value;
|
std::string print_value;
|
||||||
if (value != NULL && !value_lazy (value)
|
if (value != NULL && !value->lazy ()
|
||||||
&& var->dynamic->pretty_printer == NULL)
|
&& var->dynamic->pretty_printer == NULL)
|
||||||
print_value = varobj_value_get_print_value (value, var->format, var);
|
print_value = varobj_value_get_print_value (value, var->format, var);
|
||||||
|
|
||||||
|
@ -1312,7 +1312,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
|
||||||
{
|
{
|
||||||
/* Try to compare the values. That requires that both
|
/* Try to compare the values. That requires that both
|
||||||
values are non-lazy. */
|
values are non-lazy. */
|
||||||
if (var->not_fetched && value_lazy (var->value.get ()))
|
if (var->not_fetched && var->value.get ()->lazy ())
|
||||||
{
|
{
|
||||||
/* This is a frozen varobj and the value was never read.
|
/* This is a frozen varobj and the value was never read.
|
||||||
Presumably, UI shows some "never read" indicator.
|
Presumably, UI shows some "never read" indicator.
|
||||||
|
@ -1330,8 +1330,8 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdb_assert (!value_lazy (var->value.get ()));
|
gdb_assert (!var->value.get ()->lazy ());
|
||||||
gdb_assert (!value_lazy (value));
|
gdb_assert (!value->lazy ());
|
||||||
|
|
||||||
gdb_assert (!var->print_value.empty () && !print_value.empty ());
|
gdb_assert (!var->print_value.empty () && !print_value.empty ());
|
||||||
if (var->print_value != print_value)
|
if (var->print_value != print_value)
|
||||||
|
@ -1351,7 +1351,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
|
||||||
|
|
||||||
/* We must always keep the new value, since children depend on it. */
|
/* We must always keep the new value, since children depend on it. */
|
||||||
var->value = value_holder;
|
var->value = value_holder;
|
||||||
if (value && value_lazy (value) && intentionally_not_fetched)
|
if (value && value->lazy () && intentionally_not_fetched)
|
||||||
var->not_fetched = true;
|
var->not_fetched = true;
|
||||||
else
|
else
|
||||||
var->not_fetched = false;
|
var->not_fetched = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue