aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-31 10:52:04 -0700
committerTom Tromey <tom@tromey.com>2023-02-13 15:21:07 -0700
commit3ee3b2700d59ec1048989a3bf190882740d2ea8b (patch)
treebd46219093e5e0118256d9f47d3a7cc694de1702 /gdb/value.c
parent391f86284f6fff1011ace7136f4bd2bb438de3c6 (diff)
downloadgdb-3ee3b2700d59ec1048989a3bf190882740d2ea8b.zip
gdb-3ee3b2700d59ec1048989a3bf190882740d2ea8b.tar.gz
gdb-3ee3b2700d59ec1048989a3bf190882740d2ea8b.tar.bz2
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>
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c52
1 files changed, 20 insertions, 32 deletions
diff --git a/gdb/value.c b/gdb/value.c
index c56e040..cb16901 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1018,7 +1018,7 @@ allocate_optimized_out_value (struct type *type)
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;
}
@@ -1292,18 +1292,6 @@ value_contents_copy (struct value *dst, LONGEST dst_offset,
}
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)
{
return value->m_stack;
@@ -1607,7 +1595,7 @@ value_copy (const value *arg)
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)))
{
@@ -1740,7 +1728,7 @@ set_value_component_location (struct value *component,
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
@@ -1764,7 +1752,7 @@ record_latest_value (struct value *val)
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
@@ -2150,7 +2138,7 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
case INTERNALVAR_VALUE:
val = value_copy (var->u.value);
- if (value_lazy (val))
+ if (val->lazy ())
value_fetch_lazy (val);
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
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
@@ -3003,7 +2991,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
+ 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))
@@ -3014,7 +3002,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
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
@@ -3029,7 +3017,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
else
boffset = arg_type->field (fieldno).loc_bitpos () / 8;
- if (value_lazy (arg1))
+ if (arg1->lazy ())
v = allocate_value_lazy (arg1->enclosing_type ());
else
{
@@ -3059,10 +3047,10 @@ value_primitive_field (struct value *arg1, LONGEST offset,
/ (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
{
@@ -3664,7 +3652,7 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset)
{
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
{
@@ -3685,7 +3673,7 @@ struct value *
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
@@ -3865,7 +3853,7 @@ value_fetch_lazy_bitfield (struct value *val)
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 (),
@@ -3916,7 +3904,7 @@ value_fetch_lazy_register (struct value *val)
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);
@@ -3952,19 +3940,19 @@ value_fetch_lazy_register (struct value *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));
@@ -4031,7 +4019,7 @@ value_fetch_lazy_register (struct value *val)
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
@@ -4054,7 +4042,7 @@ value_fetch_lazy (struct value *val)
else
internal_error (_("Unexpected lazy value type."));
- set_value_lazy (val, 0);
+ val->set_lazy (0);
}
/* Implementation of the convenience function $_isvoid. */