This changes allocate_value to be a static "constructor" of value.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
if (read_value)
{
- *read_value = allocate_value (valtype);
+ *read_value = value::allocate (valtype);
aarch64_extract_return_value (valtype, regcache,
value_contents_raw (*read_value).data ());
}
int regnum)
{
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
- struct value *result_value = allocate_value (register_type (gdbarch, regnum));
+ struct value *result_value = value::allocate (register_type (gdbarch, regnum));
VALUE_LVAL (result_value) = lval_register;
VALUE_REGNUM (result_value) = regnum;
result = value::allocate_lazy (type);
else
{
- result = allocate_value (type);
+ result = value::allocate (type);
value_contents_copy (result, 0, val, 0, type->length ());
}
set_value_component_location (result, val);
if (obj == NULL)
{
- v = allocate_value (type);
+ v = value::allocate (type);
src = valaddr + offset;
}
else if (VALUE_LVAL (obj) == lval_memory && obj->lazy ())
}
else
{
- v = allocate_value (type);
+ v = value::allocate (type);
src = value_contents (obj).data () + offset;
}
high < low ? low - 1 : high);
struct type *elt_type = ada_array_element_type (arr_type0, 1);
- return allocate_value (create_array_type (NULL, elt_type, index_type));
+ return value::allocate (create_array_type (NULL, elt_type, index_type));
}
\f
struct value *val;
actual_type = ada_check_typedef (actual->type ());
- val = allocate_value (actual_type);
+ val = value::allocate (actual_type);
copy (value_contents (actual), value_contents_raw (val));
actual = ensure_lval (val);
}
{
/* We need to turn this parameter into an aligner type
as well. */
- struct value *aligner = allocate_value (formal_type);
+ struct value *aligner = value::allocate (formal_type);
struct value *component = ada_value_struct_elt (aligner, "F", 0);
value_assign_to_component (aligner, component, actual);
{
struct type *bounds_type = desc_bounds_type (type);
struct type *desc_type = desc_base_type (type);
- struct value *descriptor = allocate_value (desc_type);
- struct value *bounds = allocate_value (bounds_type);
+ struct value *descriptor = value::allocate (desc_type);
+ struct value *bounds = value::allocate (bounds_type);
int i;
for (i = ada_array_arity (ada_check_typedef (arr->type ()));
if (!get_array_bounds (type, &lo, &hi))
error (_("unable to determine array bounds"));
- value *res = allocate_value (type);
+ value *res = value::allocate (type);
gdb::array_view<gdb_byte> res_contents = value_contents_writeable (res);
/* Promote each array element. */
v = 0;
}
- val = allocate_value (type1);
+ val = value::allocate (type1);
store_unsigned_integer (value_contents_raw (val).data (),
val->type ()->length (),
type_byte_order (type1), v);
historical behavior. */
struct type *stringtype
= lookup_array_range_type (char_type, 1, str.length ());
- struct value *val = allocate_value (stringtype);
+ struct value *val = value::allocate (stringtype);
memcpy (value_contents_raw (val).data (), str.c_str (),
str.length ());
return val;
= lookup_array_range_type (char_type, 1,
obstack_object_size (&converted)
/ char_type->length ());
- struct value *val = allocate_value (stringtype);
+ struct value *val = value::allocate (stringtype);
memcpy (value_contents_raw (val).data (),
obstack_base (&converted),
obstack_object_size (&converted));
{
if (type->target_type () == NULL)
error_call_unknown_return_type (NULL);
- return allocate_value (type->target_type ());
+ return value::allocate (type->target_type ());
}
return call_function_by_hand (callee, NULL, argvec);
case TYPE_CODE_INTERNAL_FUNCTION:
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
- value *result_value = allocate_value (register_type (gdbarch, regnum));
+ value *result_value = value::allocate (register_type (gdbarch, regnum));
VALUE_LVAL (result_value) = lval_register;
VALUE_REGNUM (result_value) = regnum;
gdb_byte *buf = value_contents_raw (result_value).data ();
gdb_byte *readbuf = nullptr;
if (read_value != nullptr)
{
- *read_value = allocate_value (type);
+ *read_value = value::allocate (type);
readbuf = value_contents_raw (*read_value).data ();
}
/* Extract the return value from the register where it was stored. */
if (read_value != nullptr)
{
- *read_value = allocate_value (type);
+ *read_value = value::allocate (type);
regcache->raw_read_part (regnum, 0, len,
value_contents_raw (*read_value).data ());
}
if (read_value != nullptr)
{
- *read_value = allocate_value (valtype);
+ *read_value = value::allocate (valtype);
readbuf = value_contents_raw (*read_value).data ();
}
gdb_byte *readbuf = nullptr;
if (read_value != nullptr)
{
- *read_value = allocate_value (valtype);
+ *read_value = value::allocate (valtype);
readbuf = value_contents_raw (*read_value).data ();
}
if (read_value != nullptr)
{
- *read_value = allocate_value (valtype);
+ *read_value = value::allocate (valtype);
gdb_byte *readbuf = value_contents_raw (*read_value).data ();
arm_extract_return_value (valtype, regcache, readbuf);
}
if (val == NULL)
return NULL;
- bit_val = allocate_value (val->type ());
+ bit_val = value::allocate (val->type ());
unpack_value_bitfield (bit_val,
w->val_bitpos,
> (high_bound - low_bound + 1))
error (_("Too many array elements"));
- result = allocate_value (expect_type);
+ result = value::allocate (expect_type);
memcpy (value_contents_raw (result).data (), obstack_base (&output),
obstack_object_size (&output));
}
if (l->val.has_value ())
value = *l->val;
else
- return allocate_value (builtin_type (gdbarch)->builtin_void);
+ return value::allocate (builtin_type (gdbarch)->builtin_void);
break;
}
FIELD_BITSIZE (*f) = 1;
}
- value *val = allocate_value (the_struct);
+ value *val = value::allocate (the_struct);
gdb_byte *contents = value_contents_writeable (val).data ();
store_unsigned_integer (contents, val->enclosing_type ()->length (),
gdbarch_byte_order (arch), 0xe9);
inspecting a register ($pc, $sp, etc.), return a
generic optimized out value instead, so that we show
<optimized out> instead of <not saved>. */
- value *tmp = allocate_value (subobj_type);
+ value *tmp = value::allocate (subobj_type);
value_contents_copy (tmp, 0, retval, 0,
subobj_type->length ());
retval = tmp;
if (subobj_offset + len > max)
invalid_synthetic_pointer ();
- retval = allocate_value (subobj_type);
+ retval = value::allocate (subobj_type);
/* The given offset is relative to the actual object. */
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
if (subobj_offset + n > this->m_len)
invalid_synthetic_pointer ();
- retval = allocate_value (subobj_type);
+ retval = value::allocate (subobj_type);
bfd_byte *contents = value_contents_raw (retval).data ();
memcpy (contents, this->m_data + subobj_offset, n);
}
if (ex.error == NOT_AVAILABLE_ERROR)
{
free_values.free_to_mark ();
- retval = allocate_value (subobj_type);
+ retval = value::allocate (subobj_type);
mark_value_bytes_unavailable (retval, 0,
subobj_type->length ());
return retval;
baton->per_objfile);
else if (bytes != NULL)
{
- v = allocate_value (type);
+ v = value::allocate (type);
memcpy (value_contents_writeable (v).data (), bytes,
type->length ());
}
else
name_at_pc = NULL;
- function = allocate_value (func_func_type);
+ function = value::allocate (func_func_type);
VALUE_LVAL (function) = lval_memory;
function->set_address (pc);
gdb_assert (b->type == bp_gnu_ifunc_resolver);
gdb_assert (b->loc->next == NULL);
- func_func = allocate_value (func_func_type);
+ func_func = value::allocate (func_func_type);
VALUE_LVAL (func_func) = lval_memory;
func_func->set_address (b->loc->related_address);
- value = allocate_value (value_type);
+ value = value::allocate (value_type);
gdbarch_return_value_as_value (gdbarch, func_func, value_type, regcache,
&value, NULL);
resolved_address = value_as_address (value);
if (return_type == NULL)
error_call_unknown_return_type (function_name);
- return allocate_value (return_type);
+ return value::allocate (return_type);
}
else
error (_("Expression of type other than "
enum noside noside, struct type *type)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return allocate_value (type);
+ return value::allocate (type);
else
error (_("Attempt to use a type name as an expression"));
}
if (callee_type)
{
if ((callee_type->code () == TYPE_CODE_ERROR) && expect_type)
- return allocate_value (expect_type);
+ return value::allocate (expect_type);
else
- return allocate_value (callee_type);
+ return value::allocate (callee_type);
}
else
error (_("Expression of type other than "
if (expect_type != nullptr
&& type->code () == TYPE_CODE_STRUCT)
{
- struct value *rec = allocate_value (expect_type);
+ struct value *rec = value::allocate (expect_type);
memset (value_contents_raw (rec).data (), '\0', type->length ());
return evaluate_struct_tuple (rec, exp, noside, nargs);
{
struct type *range_type = type->index_type ();
struct type *element_type = type->target_type ();
- struct value *array = allocate_value (expect_type);
+ struct value *array = value::allocate (expect_type);
int element_size = check_typedef (element_type)->length ();
LONGEST low_bound, high_bound, index;
if (expect_type != nullptr
&& type->code () == TYPE_CODE_SET)
{
- struct value *set = allocate_value (expect_type);
+ struct value *set = value::allocate (expect_type);
gdb_byte *valaddr = value_contents_raw (set).data ();
struct type *element_type = type->index_type ();
struct type *check_type = element_type;
if (type->length () > old_value->type ()->length ())
error (_("length type is larger than the value type"));
- struct value *result = allocate_value (type);
+ struct value *result = value::allocate (type);
value_contents_copy (result, 0, old_value, 0, type->length ());
return result;
}
if (!TYPE_IS_REFERENCE (type))
{
type = lookup_lvalue_reference_type (type);
- result = allocate_value (type);
+ result = value::allocate (type);
}
}
value *result = std::get<0> (m_storage)->evaluate (nullptr, exp,
sub_noside);
if (noside != EVAL_NORMAL)
- return allocate_value (cplus_typeid_type (exp->gdbarch));
+ return value::allocate (cplus_typeid_type (exp->gdbarch));
return cplus_typeid (result);
}
1, ndimensions);
struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
struct type *result_type = create_array_type (nullptr, elm_type, range);
- struct value *result = allocate_value (result_type);
+ struct value *result = value::allocate (result_type);
/* Walk the array dimensions backwards due to the way the array will be
laid out in memory, the first dimension will be the most inner. */
1, ndimensions);
struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
struct type *result_type = create_array_type (nullptr, elm_type, range);
- struct value *result = allocate_value (result_type);
+ struct value *result = value::allocate (result_type);
LONGEST elm_len = elm_type->length ();
/* Walk the array dimensions backwards due to the way the array will be
/* Now copy the elements from the original ARRAY into the packed
array value DEST. */
- struct value *dest = allocate_value (repacked_array_type);
+ struct value *dest = value::allocate (repacked_array_type);
if (array->lazy ()
|| (total_offset + array_slice_type->length ()
> check_typedef (array->type ())->length ()))
type = resolve_dynamic_type (type, {}, /* Unused address. */ 0);
}
/* Put the constant back in target format. */
- v = allocate_value (type);
+ v = value::allocate (type);
store_signed_integer (value_contents_raw (v).data (), type->length (),
type_byte_order (type), var->value_longest ());
VALUE_LVAL (v) = not_lval;
/* Value is a constant byte-sequence and needs no memory access. */
type = resolve_dynamic_type (type, {}, /* Unused address. */ 0);
}
- v = allocate_value (type);
+ v = value::allocate (type);
memcpy (value_contents_raw (v).data (), var->value_bytes (),
type->length ());
VALUE_LVAL (v) = not_lval;
int regnum, struct frame_id frame_id)
{
int len = type->length ();
- struct value *value = allocate_value (type);
+ struct value *value = value::allocate (type);
frame_info_ptr frame;
VALUE_LVAL (value) = lval_register;
the corresponding [integer] type (see Alpha). The assumption
is that gdbarch_register_to_value populates the entire value
including the location. */
- v = allocate_value (type);
+ v = value::allocate (type);
VALUE_LVAL (v) = lval_register;
VALUE_NEXT_FRAME_ID (v) = get_frame_id (get_next_frame_sentinel_okay (frame));
VALUE_REGNUM (v) = regnum;
/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
- so you only have to call check_typedef once. Since allocate_value
+ so you only have to call check_typedef once. Since value::allocate
calls check_typedef, X->type ()->length () is safe. */
ULONGEST length () const
{
if (read_value != nullptr)
{
- *read_value = allocate_value (type);
+ *read_value = value::allocate (type);
i386_extract_return_value (gdbarch, type, regcache,
value_contents_raw (*read_value).data ());
}
{
struct value *result;
- result = allocate_value (register_type (gdbarch, regnum));
+ result = value::allocate (register_type (gdbarch, regnum));
VALUE_LVAL (result) = lval_register;
VALUE_REGNUM (result) = regnum;
bool stack_temporaries = thread_stack_temporaries_enabled_p (thr);
if (ri->value_type->code () == TYPE_CODE_VOID)
- retval = allocate_value (ri->value_type);
+ retval = value::allocate (ri->value_type);
else if (ri->struct_return_p)
{
if (stack_temporaries)
return allocate_computed_value (type, &siginfo_value_funcs, nullptr);
}
- return allocate_value (builtin_type (gdbarch)->builtin_void);
+ return value::allocate (builtin_type (gdbarch)->builtin_void);
}
\f
for (i = offset; i < n; i++)
{
- struct value *from_elm_val = allocate_value (eltype);
+ struct value *from_elm_val = value::allocate (eltype);
struct value *to_elm_val = value_subscript (c->val, c->indices[i]);
memcpy (value_contents_writeable (from_elm_val).data (),
make_cv_type (TYPE_CONST (type), TYPE_VOLATILE (type), dst_type, NULL);
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- ret = allocate_value (dst_type);
+ ret = value::allocate (dst_type);
else
{
/* Check whether to create a lvalue or not. */
{
int i;
- ret = allocate_value (dst_type);
+ ret = value::allocate (dst_type);
/* Copy src val contents into the destination value. */
for (i = 0; i < n; i++)
rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
eltype->length (), 0,
highb - lowb + 1);
- ret = allocate_value (rettype);
+ ret = value::allocate (rettype);
for (i = 0; i < highb - lowb + 1; i++)
{
rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
eltype1->length (), 0,
highb1 - lowb1 + 1);
- ret = allocate_value (rettype);
+ ret = value::allocate (rettype);
for (i = 0; i < highb1 - lowb1 + 1; i++)
{
error (_("\
Cannot perform conditional operation on vectors with different sizes"));
- ret = allocate_value (type2);
+ ret = value::allocate (type2);
for (i = 0; i < highb1 - lowb1 + 1; i++)
{
gdb_byte *readbuf = nullptr;
if (read_value != nullptr)
{
- *read_value = allocate_value (valtype);
+ *read_value = value::allocate (valtype);
readbuf = value_contents_raw (*read_value).data ();
}
}
else
{
- res = allocate_value (lookup_typename (current_language,
+ res = value::allocate (lookup_typename (current_language,
"void", NULL, 0));
}
{
struct value *result;
- result = allocate_value (register_type (m_descr->gdbarch, regnum));
+ result = value::allocate (register_type (m_descr->gdbarch, regnum));
VALUE_LVAL (result) = lval_register;
VALUE_REGNUM (result) = regnum;
arg_type->length ()),
type_byte_order (arg_type),
arg_type->is_unsigned ());
- abi_val = allocate_value (info.type);
+ abi_val = value::allocate (info.type);
unscaled.write (value_contents_raw (abi_val),
type_byte_order (info.type),
info.type->is_unsigned ());
}
else
{
- abi_val = allocate_value (info.type);
+ abi_val = value::allocate (info.type);
readbuf = value_contents_raw (abi_val).data ();
}
arg_len = info.type->length ();
unscaled.read (value_contents (abi_val),
type_byte_order (info.type),
info.type->is_unsigned ());
- *read_value = allocate_value (arg_type);
+ *read_value = value::allocate (arg_type);
unscaled.write (value_contents_raw (*read_value),
type_byte_order (arg_type),
arg_type->is_unsigned ());
{
struct type *arraytype
= lookup_array_range_type (elt->type (), 0, copies - 1);
- return allocate_value (arraytype);
+ return value::allocate (arraytype);
}
}
}
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- result = allocate_value (type);
+ result = value::allocate (type);
else
result = value_at_lazy (type, addr);
if (read_value != nullptr)
{
- *read_value = allocate_value (type);
+ *read_value = value::allocate (type);
gdb_byte *readbuf = value_contents_raw (*read_value).data ();
sparc32_extract_return_value (type, regcache, readbuf);
}
else
{
struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
- struct value *val = allocate_value (data_ptr_type);
+ struct value *val = value::allocate (data_ptr_type);
gdb_byte *buf = value_contents_raw (val).data ();
gdbarch_address_to_pointer (gdbarch, data_ptr_type,
else
{
struct type *func_ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
- struct value *val = allocate_value (func_ptr_type);
+ struct value *val = value::allocate (func_ptr_type);
gdb_byte *buf = value_contents_raw (val).data ();
gdbarch_address_to_pointer (gdbarch, func_ptr_type,
type = init_vector_type (builtin_type (gdbarch)->builtin_true_char,
buf->size ());
- v = allocate_value (type);
+ v = value::allocate (type);
memcpy (value_contents_raw (v).data (), buf->data (), buf->size ());
return v;
}
else
- return allocate_value (builtin_type (gdbarch)->builtin_void);
+ return value::allocate (builtin_type (gdbarch)->builtin_void);
}
#if !defined(HAVE_LIBEXPAT)
if (!array->lazy ()
&& !value_bytes_available (array, elt_size * index, elt_size))
{
- struct value *val = allocate_value (elt_type);
+ struct value *val = value::allocate (elt_type);
mark_value_bytes_unavailable (val, 0, elt_size);
VALUE_LVAL (val) = lval_memory;
val->set_address (array->address () + elt_size * index);
lowbound,
lowbound + n_elts - 1);
- struct value *result = allocate_value (atype);
+ struct value *result = value::allocate (atype);
gdb::array_view<gdb_byte> contents = value_contents_raw (result);
gdb::array_view<const gdb_byte> lhs_contents = value_contents (arg1);
gdb::array_view<const gdb_byte> rhs_contents = value_contents (arg2);
auto fixed_point_to_value = [type1] (const gdb_mpq &fp)
{
- value *fp_val = allocate_value (type1);
+ value *fp_val = value::allocate (type1);
fp.write_fixed_point
(value_contents_raw (fp_val),
if (is_floating_type (type1) || is_floating_type (type2))
{
result_type = promotion_type (type1, type2);
- val = allocate_value (result_type);
+ val = value::allocate (result_type);
struct type *eff_type_v1, *eff_type_v2;
gdb::byte_vector v1, v2;
result_type = type1;
- val = allocate_value (result_type);
+ val = value::allocate (result_type);
store_signed_integer (value_contents_raw (val).data (),
result_type->length (),
type_byte_order (result_type),
error (_("Invalid binary operation on numbers."));
}
- val = allocate_value (result_type);
+ val = value::allocate (result_type);
store_unsigned_integer (value_contents_raw (val).data (),
val->type ()->length (),
type_byte_order (result_type),
error (_("Invalid binary operation on numbers."));
}
- val = allocate_value (result_type);
+ val = value::allocate (result_type);
store_signed_integer (value_contents_raw (val).data (),
val->type ()->length (),
type_byte_order (result_type),
&& !value_equal (elval, scalar_value))
error (_("conversion of scalar to vector involves truncation"));
- value *val = allocate_value (vector_type);
+ value *val = value::allocate (vector_type);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
int elt_len = eltype->length ();
|| low_bound1 != low_bound2 || high_bound1 != high_bound2)
error (_("Cannot perform operation on vectors with different types"));
- value *val = allocate_value (type1);
+ value *val = value::allocate (type1);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
scoped_value_mark mark;
for (i = 0; i < high_bound1 - low_bound1 + 1; i++)
return value_binop (value_zero (type, not_lval), arg1, BINOP_SUB);
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
{
- struct value *val = allocate_value (type);
+ struct value *val = value::allocate (type);
struct type *eltype = check_typedef (type->target_type ());
int i;
LONGEST low_bound, high_bound;
if (!get_array_bounds (type, &low_bound, &high_bound))
error (_("Could not determine the vector bounds"));
- val = allocate_value (type);
+ val = value::allocate (type);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
int elt_len = eltype->length ();
/* Finally, create the result value, and pack the unscaled value
in it. */
- struct value *result = allocate_value (to_type);
+ struct value *result = value::allocate (to_type);
unscaled.write (value_contents_raw (result),
type_byte_order (to_type),
to_type->is_unsigned ());
{
if (is_floating_value (arg2))
{
- struct value *v = allocate_value (to_type);
+ struct value *v = value::allocate (to_type);
target_float_convert (value_contents (arg2).data (), type2,
value_contents_raw (v).data (), type);
return v;
type2->is_unsigned (),
type2->fixed_point_scaling_factor ());
- struct value *v = allocate_value (to_type);
+ struct value *v = value::allocate (to_type);
target_float_from_host_double (value_contents_raw (v).data (),
to_type, mpq_get_d (fp_val.val));
return v;
else if (code1 == TYPE_CODE_METHODPTR && code2 == TYPE_CODE_INT
&& value_as_long (arg2) == 0)
{
- struct value *result = allocate_value (to_type);
+ struct value *result = value::allocate (to_type);
cplus_make_method_ptr (to_type,
value_contents_writeable (result).data (), 0, 0);
if (!get_array_bounds (type1, &low_bound, &high_bound))
error (_("Could not determine the vector bounds"));
- val = allocate_value (type);
+ val = value::allocate (type);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
int elt_len = eltype->length ();
if (!current_language->c_style_arrays_p ())
{
- val = allocate_value (arraytype);
+ val = value::allocate (arraytype);
for (idx = 0; idx < nelem; idx++)
value_contents_copy (val, idx * typelength, elemvec[idx], 0,
typelength);
/* Allocate space to store the array, and then initialize it by
copying in each element. */
- val = allocate_value (arraytype);
+ val = value::allocate (arraytype);
for (idx = 0; idx < nelem; idx++)
value_contents_copy (val, idx * typelength, elemvec[idx], 0, typelength);
return val;
struct type *stringtype
= lookup_array_range_type (char_type, lowbound, highbound + lowbound - 1);
- val = allocate_value (stringtype);
+ val = value::allocate (stringtype);
memcpy (value_contents_raw (val).data (), ptr, len);
return val;
}
struct type *stringtype
= lookup_string_range_type (char_type, lowbound, highbound + lowbound - 1);
- val = allocate_value (stringtype);
+ val = value::allocate (stringtype);
memcpy (value_contents_raw (val).data (), ptr, len);
return val;
}
(lookup_memberptr_type (t->field (i).type (), domain),
offset + (LONGEST) (t->field (i).loc_bitpos () >> 3));
else if (noside != EVAL_NORMAL)
- return allocate_value (t->field (i).type ());
+ return value::allocate (t->field (i).type ());
else
{
/* Try to evaluate NAME as a qualified name with implicit
{
if (want_address)
{
- result = allocate_value
+ result = value::allocate
(lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
cplus_make_method_ptr (result->type (),
value_contents_writeable (result).data (),
TYPE_FN_FIELD_VOFFSET (f, j), 1);
}
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return allocate_value (TYPE_FN_FIELD_TYPE (f, j));
+ return value::allocate (TYPE_FN_FIELD_TYPE (f, j));
else
error (_("Cannot reference virtual member function \"%s\""),
name);
result = v;
else
{
- result = allocate_value (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
+ result = value::allocate (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
cplus_make_method_ptr (result->type (),
value_contents_writeable (result).data (),
v->address (), 0);
return NULL;
else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
&& (sym.symbol->aclass () == LOC_TYPEDEF))
- result = allocate_value (sym.symbol->type ());
+ result = value::allocate (sym.symbol->type ());
else
result = value_of_variable (sym.symbol, sym.block);
slice = value::allocate_lazy (slice_type);
else
{
- slice = allocate_value (slice_type);
+ slice = value::allocate (slice_type);
value_contents_copy (slice, 0, array, offset,
type_length_units (slice_type));
}
struct value *val;
struct type *real_type = type->target_type ();
- val = allocate_value (type);
+ val = value::allocate (type);
arg1 = value_cast (real_type, arg1);
arg2 = value_cast (real_type, arg2);
if (val->type ()->code () == TYPE_CODE_COMPLEX)
{
struct type *val_real_type = val->type ()->target_type ();
- struct value *re_val = allocate_value (val_real_type);
- struct value *im_val = allocate_value (val_real_type);
+ struct value *re_val = value::allocate (val_real_type);
+ struct value *im_val = value::allocate (val_real_type);
int len = val_real_type->length ();
copy (value_contents (val).slice (0, len),
append_flags_type_field (flags_type, 3, 2, field_type, "B");
append_flags_type_field (flags_type, 5, 3, field_type, "C");
- value *val = allocate_value (flags_type);
+ value *val = value::allocate (flags_type);
gdb_byte *contents = value_contents_writeable (val).data ();
store_unsigned_integer (contents, 4, gdbarch_byte_order (arch), 0xaa);
/* Allocate a value and its contents for type TYPE. If CHECK_SIZE is true,
then apply the usual max-value-size checks. */
-static struct value *
-allocate_value (struct type *type, bool check_size)
+struct value *
+value::allocate (struct type *type, bool check_size)
{
struct value *val = value::allocate_lazy (type);
/* Allocate a value and its contents for type TYPE. */
struct value *
-allocate_value (struct type *type)
+value::allocate (struct type *type)
{
- return allocate_value (type, true);
+ return allocate (type, true);
}
/* Allocate a value that has the correct length
struct type *array_type
= lookup_array_range_type (type, low_bound, count + low_bound - 1);
- return allocate_value (array_type);
+ return value::allocate (array_type);
}
struct value *
if (VALUE_LVAL (arg) != not_lval)
{
struct type *enc_type = arg->enclosing_type ();
- struct value *val = allocate_value (enc_type);
+ struct value *val = value::allocate (enc_type);
copy (value_contents_all (arg), value_contents_all_raw (val));
val->m_type = arg->m_type;
val = value_from_longest (builtin_type (gdbarch)->builtin_int64,
tsv->value);
else
- val = allocate_value (builtin_type (gdbarch)->builtin_void);
+ val = value::allocate (builtin_type (gdbarch)->builtin_void);
return val;
}
switch (var->kind)
{
case INTERNALVAR_VOID:
- val = allocate_value (builtin_type (gdbarch)->builtin_void);
+ val = value::allocate (builtin_type (gdbarch)->builtin_void);
break;
case INTERNALVAR_FUNCTION:
- val = allocate_value (builtin_type (gdbarch)->internal_fn);
+ val = value::allocate (builtin_type (gdbarch)->internal_fn);
break;
case INTERNALVAR_INTEGER:
{
struct value *v;
- v = allocate_value (builtin_type (target_gdbarch ())->xmethod);
+ v = value::allocate (builtin_type (target_gdbarch ())->xmethod);
v->m_lval = lval_xcallable;
v->m_location.xm_worker = worker.release ();
v->m_modifiable = 0;
v = value::allocate_lazy (arg1->enclosing_type ());
else
{
- v = allocate_value (arg1->enclosing_type ());
+ v = value::allocate (arg1->enclosing_type ());
value_contents_copy_raw (v, 0, arg1, 0,
arg1->enclosing_type ()->length ());
}
v = value::allocate_lazy (type);
else
{
- v = allocate_value (type);
+ v = value::allocate (type);
value_contents_copy_raw (v, v->embedded_offset (),
arg1, arg1->embedded_offset () + offset,
type_length_units (type));
return NULL;
}
- v = allocate_value (ftype);
+ v = value::allocate (ftype);
VALUE_LVAL (v) = lval_memory;
if (sym)
{
{
int bitpos = type->field (fieldno).loc_bitpos ();
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
- struct value *res_val = allocate_value (type->field (fieldno).type ());
+ struct value *res_val = value::allocate (type->field (fieldno).type ());
unpack_value_bitfield (res_val, bitpos, bitsize,
valaddr, embedded_offset, val);
struct value *
value_from_longest (struct type *type, LONGEST num)
{
- struct value *val = allocate_value (type);
+ struct value *val = value::allocate (type);
pack_long (value_contents_raw (val).data (), type, num);
return val;
struct value *
value_from_ulongest (struct type *type, ULONGEST num)
{
- struct value *val = allocate_value (type);
+ struct value *val = value::allocate (type);
pack_unsigned_long (value_contents_raw (val).data (), type, num);
struct value *
value_from_pointer (struct type *type, CORE_ADDR addr)
{
- struct value *val = allocate_value (type);
+ struct value *val = value::allocate (type);
store_typed_address (value_contents_raw (val).data (),
check_typedef (type), addr);
struct value *
value_from_host_double (struct type *type, double d)
{
- struct value *value = allocate_value (type);
+ struct value *value = value::allocate (type);
gdb_assert (type->code () == TYPE_CODE_FLT);
target_float_from_host_double (value_contents_raw (value).data (),
value->type (), d);
{
struct value *result;
- result = allocate_value (type);
+ result = value::allocate (type);
memcpy (value_contents_raw (result).data (), contents, type->length ());
return result;
}
v = value::allocate_lazy (type);
else
{
- v = allocate_value (type);
+ v = value::allocate (type);
value_contents_copy (v, v->embedded_offset (),
whole, whole->embedded_offset () + offset,
type_length_units (type));
&& bit_length == TARGET_CHAR_BIT * type->length ())
return value_from_component (whole, type, bit_offset / TARGET_CHAR_BIT);
- struct value *v = allocate_value (type);
+ struct value *v = value::allocate (type);
LONGEST dst_offset = TARGET_CHAR_BIT * v->embedded_offset ();
if (is_scalar_type (type) && type_byte_order (type) == BFD_ENDIAN_BIG)
NULL; it will be allocated when it is fetched from the target. */
static struct value *allocate_lazy (struct type *type);
+ /* Allocate a value and its contents for type TYPE. */
+ static struct value *allocate (struct type *type);
+
~value ();
DISABLE_COPY_AND_ASSIGN (value);
limited_length will be set to indicate the length in octets that were
loaded from the inferior. */
ULONGEST m_limited_length = 0;
+
+private:
+
+ /* Allocate a value and its contents for type TYPE. If CHECK_SIZE
+ is true, then apply the usual max-value-size checks. */
+ static struct value *allocate (struct type *type, bool check_size);
};
/* Returns value_type or value_enclosing_type depending on
const struct block *var_block,
frame_info_ptr frame);
-extern struct value *allocate_value (struct type *type);
-
extern void value_contents_copy (struct value *dst, LONGEST dst_offset,
struct value *src, LONGEST src_offset,
LONGEST length);
return allocate_computed_value (type, &tlb_value_funcs, NULL);
}
- return allocate_value (builtin_type (gdbarch)->builtin_void);
+ return value::allocate (builtin_type (gdbarch)->builtin_void);
}