aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-31 10:05:01 -0700
committerTom Tromey <tom@tromey.com>2023-02-13 15:21:07 -0700
commit76675c4d0bc454ed1ae369f98ad848754d0e81a0 (patch)
tree6ab6267f6ca517ea44185ad5211f0c8075855a89 /gdb/value.c
parentfac7bdaaab474e2741b88d24781facd9521d0e9c (diff)
downloadgdb-76675c4d0bc454ed1ae369f98ad848754d0e81a0.zip
gdb-76675c4d0bc454ed1ae369f98ad848754d0e81a0.tar.gz
gdb-76675c4d0bc454ed1ae369f98ad848754d0e81a0.tar.bz2
Turn value_offset into method
This changes value_offset to be a method 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.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 2a53144..9b9b022 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1024,17 +1024,6 @@ allocate_optimized_out_value (struct type *type)
/* Accessor methods. */
-LONGEST
-value_offset (const struct value *value)
-{
- return value->m_offset;
-}
-void
-set_value_offset (struct value *value, LONGEST offset)
-{
- value->m_offset = offset;
-}
-
gdb::array_view<gdb_byte>
value_contents_raw (struct value *value)
{
@@ -3086,7 +3075,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
value_enclosing_type (arg1)->length ());
}
v->m_type = type;
- v->m_offset = value_offset (arg1);
+ v->m_offset = arg1->offset ();
v->m_embedded_offset = offset + value_embedded_offset (arg1) + boffset;
}
else if (NULL != TYPE_DATA_LOCATION (type))
@@ -3119,7 +3108,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
arg1, value_embedded_offset (arg1) + offset,
type_length_units (type));
}
- v->m_offset = (value_offset (arg1) + offset
+ v->m_offset = (arg1->offset () + offset
+ value_embedded_offset (arg1));
}
set_value_component_location (v, arg1);
@@ -3188,7 +3177,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
value_addr (*arg1p)));
/* Move the `this' pointer according to the offset.
- VALUE_OFFSET (*arg1p) += offset; */
+ (*arg1p)->offset () += offset; */
}
return v;
@@ -3721,7 +3710,7 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset)
whole, value_embedded_offset (whole) + offset,
type_length_units (type));
}
- v->m_offset = value_offset (whole) + offset + value_embedded_offset (whole);
+ v->m_offset = whole->offset () + offset + value_embedded_offset (whole);
set_value_component_location (v, whole);
return v;
@@ -3918,7 +3907,7 @@ value_fetch_lazy_bitfield (struct value *val)
unpack_value_bitfield (val, val->bitpos (), val->bitsize (),
value_contents_for_printing (parent).data (),
- value_offset (val), parent);
+ val->offset (), parent);
}
/* Helper for value_fetch_lazy when the value is in memory. */
@@ -3962,7 +3951,7 @@ value_fetch_lazy_register (struct value *val)
/* Offsets are not supported here; lazy register values must
refer to the entire register. */
- gdb_assert (value_offset (val) == 0);
+ gdb_assert (val->offset () == 0);
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{