static std::vector<value_ref_ptr> all_values;
-/* Allocate a lazy value for type TYPE. Its actual content is
- "lazily" allocated too: the content field of the return value is
- NULL; it will be allocated when it is fetched from the target. */
+/* See value.h. */
struct value *
-allocate_value_lazy (struct type *type)
+value::allocate_lazy (struct type *type)
{
struct value *val;
static struct value *
allocate_value (struct type *type, bool check_size)
{
- struct value *val = allocate_value_lazy (type);
+ struct value *val = value::allocate_lazy (type);
allocate_value_contents (val, check_size);
val->m_lazy = 0;
const struct lval_funcs *funcs,
void *closure)
{
- struct value *v = allocate_value_lazy (type);
+ struct value *v = value::allocate_lazy (type);
VALUE_LVAL (v) = lval_computed;
v->m_location.computed.funcs = funcs;
struct value *
allocate_optimized_out_value (struct type *type)
{
- struct value *retval = allocate_value_lazy (type);
+ struct value *retval = value::allocate_lazy (type);
mark_value_bytes_optimized_out (retval, 0, type->length ());
retval->set_lazy (0);
struct type *encl_type = arg->enclosing_type ();
struct value *val;
- val = allocate_value_lazy (encl_type);
+ val = value::allocate_lazy (encl_type);
val->m_type = arg->m_type;
VALUE_LVAL (val) = arg->m_lval;
val->m_location = arg->m_location;
LONGEST bitpos = arg_type->field (fieldno).loc_bitpos ();
LONGEST container_bitsize = type->length () * 8;
- v = allocate_value_lazy (type);
+ v = value::allocate_lazy (type);
v->m_bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno);
if ((bitpos % container_bitsize) + v->m_bitsize <= container_bitsize
&& type->length () <= (int) sizeof (LONGEST))
boffset = arg_type->field (fieldno).loc_bitpos () / 8;
if (arg1->lazy ())
- v = allocate_value_lazy (arg1->enclosing_type ());
+ v = value::allocate_lazy (arg1->enclosing_type ());
else
{
v = allocate_value (arg1->enclosing_type ());
gdb_assert (PROP_CONST == TYPE_DATA_LOCATION_KIND (type));
/* For dynamic data types defer memory allocation
until we actual access the value. */
- v = allocate_value_lazy (type);
+ v = value::allocate_lazy (type);
}
else
{
value_fetch_lazy (arg1);
if (arg1->lazy ())
- v = allocate_value_lazy (type);
+ v = value::allocate_lazy (type);
else
{
v = allocate_value (type);
struct value *
value_zero (struct type *type, enum lval_type lv)
{
- struct value *val = allocate_value_lazy (type);
+ struct value *val = value::allocate_lazy (type);
VALUE_LVAL (val) = (lv == lval_computed ? not_lval : lv);
val->m_is_zero = true;
struct value *v;
if (valaddr == NULL)
- v = allocate_value_lazy (type);
+ v = value::allocate_lazy (type);
else
v = value_from_contents (type, valaddr);
VALUE_LVAL (v) = lval_memory;
struct value *v;
if (valaddr == NULL)
- v = allocate_value_lazy (resolved_type);
+ v = value::allocate_lazy (resolved_type);
else
v = value_from_contents (resolved_type, valaddr);
if (TYPE_DATA_LOCATION (resolved_type_no_typedef) != NULL
struct value *v;
if (VALUE_LVAL (whole) == lval_memory && whole->lazy ())
- v = allocate_value_lazy (type);
+ v = value::allocate_lazy (type);
else
{
v = allocate_value (type);
struct value
{
+private:
+
+ /* Values can only be created via "static constructors". */
explicit value (struct type *type_)
: m_modifiable (1),
m_lazy (1),
{
}
+public:
+
+ /* Allocate a lazy value for type TYPE. Its actual content is
+ "lazily" allocated too: the content field of the return value is
+ NULL; it will be allocated when it is fetched from the target. */
+ static struct value *allocate_lazy (struct type *type);
+
~value ();
DISABLE_COPY_AND_ASSIGN (value);
frame_info_ptr frame);
extern struct value *allocate_value (struct type *type);
-extern struct value *allocate_value_lazy (struct type *type);
+
extern void value_contents_copy (struct value *dst, LONGEST dst_offset,
struct value *src, LONGEST src_offset,
LONGEST length);