if (value_optimized_out (val))
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. */
|| (VALUE_LVAL (val) != not_lval
&& type->length () > val->type ()->length ()))
v = allocate_value (type);
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;
gdb_byte *buf;
an address of the result of a cast (view conversion in Ada). */
if (VALUE_LVAL (val) == lval_memory)
{
- if (value_lazy (val))
+ if (val->lazy ())
value_fetch_lazy (val);
VALUE_LVAL (val) = not_lval;
}
an address of the result of a cast (view conversion in Ada). */
if (VALUE_LVAL (val) == lval_memory)
{
- if (value_lazy (val))
+ if (val->lazy ())
value_fetch_lazy (val);
VALUE_LVAL (val) = not_lval;
}
if (ada_is_tagged_type (deref_val->type (), 1))
deref_val = ada_tag_value_at_base_address (deref_val);
- if (value_lazy (deref_val))
+ if (deref_val->lazy ())
value_fetch_lazy (deref_val);
common_val_print (deref_val, stream, recurse + 1,
still lazy, that means an error occurred reading it;
watch it anyway in case it becomes readable. */
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 ());
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
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'
}
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
implicitly fetch the value. MI response will
use empty string for the value, which is OK. */
return std::string ();
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,
we can reuse print_value. */
memcpy (value_contents_raw (val).data (),
value_contents_raw (outer_val).data (),
checked_type->length ());
- set_value_lazy (val, 0);
+ val->set_lazy (0);
return val;
}
have a non-lazy previous value to compare with. */
if (result != NULL)
{
- if (!value_lazy (result))
+ if (!result->lazy ())
*valp = result;
else
{
/* Don't allow e.g. '&(int)var_with_no_debug_info'. */
if (VALUE_LVAL (val) == lval_memory)
{
- if (value_lazy (val))
+ if (val->lazy ())
value_fetch_lazy (val);
VALUE_LVAL (val) = not_lval;
}
/* Don't allow e.g. '&(int)var_with_no_debug_info'. */
if (VALUE_LVAL (val) == lval_memory)
{
- if (value_lazy (val))
+ if (val->lazy ())
value_fetch_lazy (val);
VALUE_LVAL (val) = not_lval;
}
m_base_offset (base_offset),
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)
/* Now copy the elements from the original ARRAY into the packed
array value DEST. */
struct value *dest = allocate_value (repacked_array_type);
- if (value_lazy (array)
+ if (array->lazy ()
|| (total_offset + array_slice_type->length ()
> check_typedef (array->type ())->length ()))
{
the requested slice is outside the values content range then
just create a new lazy value pointing at the memory where the
contents we're looking for exist. */
- if (value_lazy (array)
+ if (array->lazy ()
|| (total_offset + array_slice_type->length ()
> check_typedef (array->type ())->length ()))
array = value_at_lazy (array_slice_type,
(array_slice_type, value_contents (array).data () + 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);
else
error (_("cannot subscript arrays that are not in memory"));
else
gdb_printf (&debug_file, " computed");
- if (value_lazy (value))
+ if (value->lazy ())
gdb_printf (&debug_file, " lazy");
else
{
arg1->set_offset (arg1->offset ()
+ 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);
}
enum ext_lang_rc result = EXT_LANG_RC_NOP;
enum guile_string_repr_result print_result;
- if (value_lazy (value))
+ if (value->lazy ())
value_fetch_lazy (value);
/* No pretty-printer support for unavailable values. */
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
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 */
return gdbscm_wrap ([=]
{
- if (value_lazy (value))
+ if (value->lazy ())
value_fetch_lazy (value);
return SCM_UNSPECIFIED;
});
/* 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 never needed it at all (e.g., `a' in `a,b'). */
- if (!value_lazy (v))
+ if (!v->lazy ())
found_memory_cnt++;
}
/* Other kinds of values are not fine. */
as $__. If the last value has not been fetched from memory
then don't fetch it now; instead mark it by voiding the $__
variable. */
- if (value_lazy (last_examine_value.get ()))
+ if (last_examine_value.get ()->lazy ())
clear_internalvar (lookup_internalvar ("__"));
else
set_internalvar (lookup_internalvar ("__"), last_examine_value.get ());
struct gdbarch *gdbarch = type->arch ();
enum gdbpy_string_repr_result print_result;
- if (value_lazy (value))
+ if (value->lazy ())
value_fetch_lazy (value);
/* No pretty-printer support for unavailable values. */
try
{
- opt = value_lazy (value);
+ opt = value->lazy ();
}
catch (const gdb_exception &except)
{
try
{
- if (value_lazy (value))
+ if (value->lazy ())
value_fetch_lazy (value);
}
catch (const gdb_exception &except)
{
struct type *type = val->type ();
- if (value_lazy (val))
+ if (val->lazy ())
value_fetch_lazy (val);
- if (value_lazy (entryval))
+ if (entryval->lazy ())
value_fetch_lazy (entryval);
if (value_contents_eq (val, 0, entryval, 0, type->length ()))
struct type *type_deref;
val_deref = coerce_ref (val);
- if (value_lazy (val_deref))
+ if (val_deref->lazy ())
value_fetch_lazy (val_deref);
type_deref = val_deref->type ();
entryval_deref = coerce_ref (entryval);
- if (value_lazy (entryval_deref))
+ if (entryval_deref->lazy ())
value_fetch_lazy (entryval_deref);
/* If the reference addresses match but dereferenced
/* Make sure the value is fully evaluated. It may live in the
stack frame we're about to pop. */
- if (value_lazy (return_value))
+ if (return_value->lazy ())
value_fetch_lazy (return_value);
if (thisfun != NULL)
Instead mock up a new one and give it the original address. */
struct type *elt_type = check_typedef (tarray->target_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))
{
struct value *val = allocate_value (elt_type);
information, but its contents are updated from FROMVAL. This
implies the returned value is not lazy, even if TOVAL was. */
val = value_copy (toval);
- set_value_lazy (val, 0);
+ val->set_lazy (0);
copy (value_contents (fromval), value_contents_raw (val));
/* We copy over the enclosing type and pointed-to offset from FROMVAL
val = value_of_variable (var, b);
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)
{
CORE_ADDR addr = value_address (val);
slice_range_type);
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);
else
{
get a fixed representation of our value. */
value = ada_to_fixed_value (value);
- if (value_lazy (value))
+ if (value->lazy ())
value_fetch_lazy (value);
struct value_print_options local_opts = *options;
struct value *retval = allocate_value_lazy (type);
mark_value_bytes_optimized_out (retval, 0, type->length ());
- set_value_lazy (retval, 0);
+ retval->set_lazy (0);
return retval;
}
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
value_stack (const struct value *value)
{
val->m_parent = arg->m_parent;
val->m_limited_length = arg->m_limited_length;
- if (!value_lazy (val)
+ if (!val->lazy ()
&& !(value_entirely_optimized_out (val)
|| value_entirely_unavailable (val)))
{
change to how values work in GDB. */
if (VALUE_LVAL (component) == lval_internalvar_component)
{
- gdb_assert (value_lazy (component));
+ gdb_assert (component->lazy ());
VALUE_LVAL (component) = lval_memory;
}
else
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
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
is going to cause GDB to throw an error. However, to allow
case INTERNALVAR_VALUE:
val = value_copy (var->u.value);
- if (value_lazy (val))
+ if (val->lazy ())
value_fetch_lazy (val);
break;
/* 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
has changed. */
- if (value_lazy (copy))
+ if (copy->lazy ())
value_fetch_lazy (copy);
/* Release the value from the value chain to prevent it from being
+ offset
+ (bitpos - v->m_bitpos) / 8);
v->set_parent (arg1);
- if (!value_lazy (arg1))
+ if (!arg1->lazy ())
value_fetch_lazy (v);
}
else if (fieldno < TYPE_N_BASECLASSES (arg_type))
LONGEST boffset;
/* 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);
/* We special case virtual inheritance here because this
else
boffset = arg_type->field (fieldno).loc_bitpos () / 8;
- if (value_lazy (arg1))
+ if (arg1->lazy ())
v = allocate_value_lazy (arg1->enclosing_type ());
else
{
/ (HOST_CHAR_BIT * unit_size));
/* 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);
- if (value_lazy (arg1))
+ if (arg1->lazy ())
v = allocate_value_lazy (type);
else
{
{
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);
else
{
value_from_component_bitsize (struct value *whole, struct type *type,
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
array-printing failures (including crashes) when printing Ada
value have been fetched. */
struct value *parent = val->parent ();
- if (value_lazy (parent))
+ if (parent->lazy ())
value_fetch_lazy (parent);
unpack_value_bitfield (val, val->bitpos (), val->bitsize (),
refer to the entire register. */
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);
any case, it should always be an internal error to end up
in this situation. */
if (VALUE_LVAL (new_val) == lval_register
- && value_lazy (new_val)
+ && new_val->lazy ()
&& VALUE_NEXT_FRAME_ID (new_val) == next_frame_id)
internal_error (_("infinite loop while fetching a register"));
}
/* If it's still lazy (for instance, a saved register on the
stack), fetch it. */
- if (value_lazy (new_val))
+ if (new_val->lazy ())
value_fetch_lazy (new_val);
/* Copy the contents and the unavailability/optimized-out
meta-data from NEW_VAL to VAL. */
- set_value_lazy (val, 0);
+ val->set_lazy (0);
value_contents_copy (val, val->embedded_offset (),
new_val, new_val->embedded_offset (),
type_length_units (type));
void
value_fetch_lazy (struct value *val)
{
- gdb_assert (value_lazy (val));
+ gdb_assert (val->lazy ());
allocate_value_contents (val, true);
/* A value is either lazy, or fully fetched. The
availability/validity is only established as we try to fetch a
else
internal_error (_("Unexpected lazy value type."));
- set_value_lazy (val, 0);
+ val->set_lazy (0);
}
/* Implementation of the convenience function $_isvoid. */
void set_embedded_offset (LONGEST 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
object's compile-time type. If the object actually belongs to some
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 void set_value_stack (struct value *value, int val);
}
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->format, var);
gdb_assert (varobj_value_is_changeable_p (var));
/* 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
value of the variable object will be different
that is we'll be comparing values of this type, fetch the
value now. Otherwise, on the next update the 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;
bool frozen = var->frozen;
lazy -- if it is, the code above has decided that the value
should not be fetched. */
std::string print_value;
- if (value != NULL && !value_lazy (value)
+ if (value != NULL && !value->lazy ()
&& var->dynamic->pretty_printer == NULL)
print_value = varobj_value_get_print_value (value, var->format, var);
{
/* Try to compare the values. That requires that both
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.
Presumably, UI shows some "never read" indicator.
}
else
{
- gdb_assert (!value_lazy (var->value.get ()));
- gdb_assert (!value_lazy (value));
+ gdb_assert (!var->value.get ()->lazy ());
+ gdb_assert (!value->lazy ());
gdb_assert (!var->print_value.empty () && !print_value.empty ());
if (var->print_value != print_value)
/* We must always keep the new value, since children depend on it. */
var->value = value_holder;
- if (value && value_lazy (value) && intentionally_not_fetched)
+ if (value && value->lazy () && intentionally_not_fetched)
var->not_fetched = true;
else
var->not_fetched = false;