Turn allocate_value into a static "constructor"
This changes allocate_value to be a static "constructor" of value. Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
parent
cbe793af88
commit
317c3ed9fc
37 changed files with 135 additions and 128 deletions
|
@ -2492,7 +2492,7 @@ aarch64_return_value (struct gdbarch *gdbarch, struct value *func_value,
|
||||||
|
|
||||||
if (read_value)
|
if (read_value)
|
||||||
{
|
{
|
||||||
*read_value = allocate_value (valtype);
|
*read_value = value::allocate (valtype);
|
||||||
aarch64_extract_return_value (valtype, regcache,
|
aarch64_extract_return_value (valtype, regcache,
|
||||||
value_contents_raw (*read_value).data ());
|
value_contents_raw (*read_value).data ());
|
||||||
}
|
}
|
||||||
|
@ -2781,7 +2781,7 @@ aarch64_pseudo_read_value (struct gdbarch *gdbarch, readable_regcache *regcache,
|
||||||
int regnum)
|
int regnum)
|
||||||
{
|
{
|
||||||
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
|
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_LVAL (result_value) = lval_register;
|
||||||
VALUE_REGNUM (result_value) = regnum;
|
VALUE_REGNUM (result_value) = regnum;
|
||||||
|
|
|
@ -564,7 +564,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
|
||||||
result = value::allocate_lazy (type);
|
result = value::allocate_lazy (type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = allocate_value (type);
|
result = value::allocate (type);
|
||||||
value_contents_copy (result, 0, val, 0, type->length ());
|
value_contents_copy (result, 0, val, 0, type->length ());
|
||||||
}
|
}
|
||||||
set_value_component_location (result, val);
|
set_value_component_location (result, val);
|
||||||
|
@ -2807,7 +2807,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
|
||||||
|
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
{
|
{
|
||||||
v = allocate_value (type);
|
v = value::allocate (type);
|
||||||
src = valaddr + offset;
|
src = valaddr + offset;
|
||||||
}
|
}
|
||||||
else if (VALUE_LVAL (obj) == lval_memory && obj->lazy ())
|
else if (VALUE_LVAL (obj) == lval_memory && obj->lazy ())
|
||||||
|
@ -2822,7 +2822,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v = allocate_value (type);
|
v = value::allocate (type);
|
||||||
src = value_contents (obj).data () + offset;
|
src = value_contents (obj).data () + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3404,7 +3404,7 @@ empty_array (struct type *arr_type, int low, int high)
|
||||||
high < low ? low - 1 : high);
|
high < low ? low - 1 : high);
|
||||||
struct type *elt_type = ada_array_element_type (arr_type0, 1);
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4528,7 +4528,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
|
||||||
struct value *val;
|
struct value *val;
|
||||||
|
|
||||||
actual_type = ada_check_typedef (actual->type ());
|
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));
|
copy (value_contents (actual), value_contents_raw (val));
|
||||||
actual = ensure_lval (val);
|
actual = ensure_lval (val);
|
||||||
}
|
}
|
||||||
|
@ -4544,7 +4544,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
|
||||||
{
|
{
|
||||||
/* We need to turn this parameter into an aligner type
|
/* We need to turn this parameter into an aligner type
|
||||||
as well. */
|
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);
|
struct value *component = ada_value_struct_elt (aligner, "F", 0);
|
||||||
|
|
||||||
value_assign_to_component (aligner, component, actual);
|
value_assign_to_component (aligner, component, actual);
|
||||||
|
@ -4584,8 +4584,8 @@ make_array_descriptor (struct type *type, struct value *arr)
|
||||||
{
|
{
|
||||||
struct type *bounds_type = desc_bounds_type (type);
|
struct type *bounds_type = desc_bounds_type (type);
|
||||||
struct type *desc_type = desc_base_type (type);
|
struct type *desc_type = desc_base_type (type);
|
||||||
struct value *descriptor = allocate_value (desc_type);
|
struct value *descriptor = value::allocate (desc_type);
|
||||||
struct value *bounds = allocate_value (bounds_type);
|
struct value *bounds = value::allocate (bounds_type);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = ada_array_arity (ada_check_typedef (arr->type ()));
|
for (i = ada_array_arity (ada_check_typedef (arr->type ()));
|
||||||
|
@ -9281,7 +9281,7 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
|
||||||
if (!get_array_bounds (type, &lo, &hi))
|
if (!get_array_bounds (type, &lo, &hi))
|
||||||
error (_("unable to determine array bounds"));
|
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);
|
gdb::array_view<gdb_byte> res_contents = value_contents_writeable (res);
|
||||||
|
|
||||||
/* Promote each array element. */
|
/* Promote each array element. */
|
||||||
|
@ -9403,7 +9403,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
v = 0;
|
v = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = allocate_value (type1);
|
val = value::allocate (type1);
|
||||||
store_unsigned_integer (value_contents_raw (val).data (),
|
store_unsigned_integer (value_contents_raw (val).data (),
|
||||||
val->type ()->length (),
|
val->type ()->length (),
|
||||||
type_byte_order (type1), v);
|
type_byte_order (type1), v);
|
||||||
|
@ -10667,7 +10667,7 @@ ada_string_operation::evaluate (struct type *expect_type,
|
||||||
historical behavior. */
|
historical behavior. */
|
||||||
struct type *stringtype
|
struct type *stringtype
|
||||||
= lookup_array_range_type (char_type, 1, str.length ());
|
= 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 (),
|
memcpy (value_contents_raw (val).data (), str.c_str (),
|
||||||
str.length ());
|
str.length ());
|
||||||
return val;
|
return val;
|
||||||
|
@ -10702,7 +10702,7 @@ ada_string_operation::evaluate (struct type *expect_type,
|
||||||
= lookup_array_range_type (char_type, 1,
|
= lookup_array_range_type (char_type, 1,
|
||||||
obstack_object_size (&converted)
|
obstack_object_size (&converted)
|
||||||
/ char_type->length ());
|
/ char_type->length ());
|
||||||
struct value *val = allocate_value (stringtype);
|
struct value *val = value::allocate (stringtype);
|
||||||
memcpy (value_contents_raw (val).data (),
|
memcpy (value_contents_raw (val).data (),
|
||||||
obstack_base (&converted),
|
obstack_base (&converted),
|
||||||
obstack_object_size (&converted));
|
obstack_object_size (&converted));
|
||||||
|
@ -11208,7 +11208,7 @@ ada_funcall_operation::evaluate (struct type *expect_type,
|
||||||
{
|
{
|
||||||
if (type->target_type () == NULL)
|
if (type->target_type () == NULL)
|
||||||
error_call_unknown_return_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);
|
return call_function_by_hand (callee, NULL, argvec);
|
||||||
case TYPE_CODE_INTERNAL_FUNCTION:
|
case TYPE_CODE_INTERNAL_FUNCTION:
|
||||||
|
|
|
@ -355,7 +355,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
|
||||||
{
|
{
|
||||||
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
|
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_LVAL (result_value) = lval_register;
|
||||||
VALUE_REGNUM (result_value) = regnum;
|
VALUE_REGNUM (result_value) = regnum;
|
||||||
gdb_byte *buf = value_contents_raw (result_value).data ();
|
gdb_byte *buf = value_contents_raw (result_value).data ();
|
||||||
|
@ -831,7 +831,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
|
||||||
gdb_byte *readbuf = nullptr;
|
gdb_byte *readbuf = nullptr;
|
||||||
if (read_value != nullptr)
|
if (read_value != nullptr)
|
||||||
{
|
{
|
||||||
*read_value = allocate_value (type);
|
*read_value = value::allocate (type);
|
||||||
readbuf = value_contents_raw (*read_value).data ();
|
readbuf = value_contents_raw (*read_value).data ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
|
||||||
/* Extract the return value from the register where it was stored. */
|
/* Extract the return value from the register where it was stored. */
|
||||||
if (read_value != nullptr)
|
if (read_value != nullptr)
|
||||||
{
|
{
|
||||||
*read_value = allocate_value (type);
|
*read_value = value::allocate (type);
|
||||||
regcache->raw_read_part (regnum, 0, len,
|
regcache->raw_read_part (regnum, 0, len,
|
||||||
value_contents_raw (*read_value).data ());
|
value_contents_raw (*read_value).data ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1178,7 +1178,7 @@ default_gdbarch_return_value
|
||||||
|
|
||||||
if (read_value != nullptr)
|
if (read_value != nullptr)
|
||||||
{
|
{
|
||||||
*read_value = allocate_value (valtype);
|
*read_value = value::allocate (valtype);
|
||||||
readbuf = value_contents_raw (*read_value).data ();
|
readbuf = value_contents_raw (*read_value).data ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9192,7 +9192,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function,
|
||||||
gdb_byte *readbuf = nullptr;
|
gdb_byte *readbuf = nullptr;
|
||||||
if (read_value != nullptr)
|
if (read_value != nullptr)
|
||||||
{
|
{
|
||||||
*read_value = allocate_value (valtype);
|
*read_value = value::allocate (valtype);
|
||||||
readbuf = value_contents_raw (*read_value).data ();
|
readbuf = value_contents_raw (*read_value).data ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9268,7 +9268,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function,
|
||||||
|
|
||||||
if (read_value != nullptr)
|
if (read_value != nullptr)
|
||||||
{
|
{
|
||||||
*read_value = allocate_value (valtype);
|
*read_value = value::allocate (valtype);
|
||||||
gdb_byte *readbuf = value_contents_raw (*read_value).data ();
|
gdb_byte *readbuf = value_contents_raw (*read_value).data ();
|
||||||
arm_extract_return_value (valtype, regcache, readbuf);
|
arm_extract_return_value (valtype, regcache, readbuf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1864,7 +1864,7 @@ extract_bitfield_from_watchpoint_value (struct watchpoint *w, struct value *val)
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bit_val = allocate_value (val->type ());
|
bit_val = value::allocate (val->type ());
|
||||||
|
|
||||||
unpack_value_bitfield (bit_val,
|
unpack_value_bitfield (bit_val,
|
||||||
w->val_bitpos,
|
w->val_bitpos,
|
||||||
|
|
|
@ -673,7 +673,7 @@ c_string_operation::evaluate (struct type *expect_type,
|
||||||
> (high_bound - low_bound + 1))
|
> (high_bound - low_bound + 1))
|
||||||
error (_("Too many array elements"));
|
error (_("Too many array elements"));
|
||||||
|
|
||||||
result = allocate_value (expect_type);
|
result = value::allocate (expect_type);
|
||||||
memcpy (value_contents_raw (result).data (), obstack_base (&output),
|
memcpy (value_contents_raw (result).data (), obstack_base (&output),
|
||||||
obstack_object_size (&output));
|
obstack_object_size (&output));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2231,7 +2231,7 @@ value_from_setting (const setting &var, struct gdbarch *gdbarch)
|
||||||
if (l->val.has_value ())
|
if (l->val.has_value ())
|
||||||
value = *l->val;
|
value = *l->val;
|
||||||
else
|
else
|
||||||
return allocate_value (builtin_type (gdbarch)->builtin_void);
|
return value::allocate (builtin_type (gdbarch)->builtin_void);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -761,7 +761,7 @@ test_print_fields (gdbarch *arch)
|
||||||
FIELD_BITSIZE (*f) = 1;
|
FIELD_BITSIZE (*f) = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
value *val = allocate_value (the_struct);
|
value *val = value::allocate (the_struct);
|
||||||
gdb_byte *contents = value_contents_writeable (val).data ();
|
gdb_byte *contents = value_contents_writeable (val).data ();
|
||||||
store_unsigned_integer (contents, val->enclosing_type ()->length (),
|
store_unsigned_integer (contents, val->enclosing_type ()->length (),
|
||||||
gdbarch_byte_order (arch), 0xe9);
|
gdbarch_byte_order (arch), 0xe9);
|
||||||
|
|
|
@ -968,7 +968,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
|
||||||
inspecting a register ($pc, $sp, etc.), return a
|
inspecting a register ($pc, $sp, etc.), return a
|
||||||
generic optimized out value instead, so that we show
|
generic optimized out value instead, so that we show
|
||||||
<optimized out> instead of <not saved>. */
|
<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,
|
value_contents_copy (tmp, 0, retval, 0,
|
||||||
subobj_type->length ());
|
subobj_type->length ());
|
||||||
retval = tmp;
|
retval = tmp;
|
||||||
|
@ -1019,7 +1019,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
|
||||||
if (subobj_offset + len > max)
|
if (subobj_offset + len > max)
|
||||||
invalid_synthetic_pointer ();
|
invalid_synthetic_pointer ();
|
||||||
|
|
||||||
retval = allocate_value (subobj_type);
|
retval = value::allocate (subobj_type);
|
||||||
|
|
||||||
/* The given offset is relative to the actual object. */
|
/* The given offset is relative to the actual object. */
|
||||||
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
|
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
|
||||||
|
@ -1037,7 +1037,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
|
||||||
if (subobj_offset + n > this->m_len)
|
if (subobj_offset + n > this->m_len)
|
||||||
invalid_synthetic_pointer ();
|
invalid_synthetic_pointer ();
|
||||||
|
|
||||||
retval = allocate_value (subobj_type);
|
retval = value::allocate (subobj_type);
|
||||||
bfd_byte *contents = value_contents_raw (retval).data ();
|
bfd_byte *contents = value_contents_raw (retval).data ();
|
||||||
memcpy (contents, this->m_data + subobj_offset, n);
|
memcpy (contents, this->m_data + subobj_offset, n);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1514,7 +1514,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, frame_info_ptr frame,
|
||||||
if (ex.error == NOT_AVAILABLE_ERROR)
|
if (ex.error == NOT_AVAILABLE_ERROR)
|
||||||
{
|
{
|
||||||
free_values.free_to_mark ();
|
free_values.free_to_mark ();
|
||||||
retval = allocate_value (subobj_type);
|
retval = value::allocate (subobj_type);
|
||||||
mark_value_bytes_unavailable (retval, 0,
|
mark_value_bytes_unavailable (retval, 0,
|
||||||
subobj_type->length ());
|
subobj_type->length ());
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -8991,7 +8991,7 @@ dwarf2_compute_name (const char *name,
|
||||||
baton->per_objfile);
|
baton->per_objfile);
|
||||||
else if (bytes != NULL)
|
else if (bytes != NULL)
|
||||||
{
|
{
|
||||||
v = allocate_value (type);
|
v = value::allocate (type);
|
||||||
memcpy (value_contents_writeable (v).data (), bytes,
|
memcpy (value_contents_writeable (v).data (), bytes,
|
||||||
type->length ());
|
type->length ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -922,7 +922,7 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||||
else
|
else
|
||||||
name_at_pc = NULL;
|
name_at_pc = NULL;
|
||||||
|
|
||||||
function = allocate_value (func_func_type);
|
function = value::allocate (func_func_type);
|
||||||
VALUE_LVAL (function) = lval_memory;
|
VALUE_LVAL (function) = lval_memory;
|
||||||
function->set_address (pc);
|
function->set_address (pc);
|
||||||
|
|
||||||
|
@ -1033,11 +1033,11 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
|
||||||
gdb_assert (b->type == bp_gnu_ifunc_resolver);
|
gdb_assert (b->type == bp_gnu_ifunc_resolver);
|
||||||
gdb_assert (b->loc->next == NULL);
|
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;
|
VALUE_LVAL (func_func) = lval_memory;
|
||||||
func_func->set_address (b->loc->related_address);
|
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,
|
gdbarch_return_value_as_value (gdbarch, func_func, value_type, regcache,
|
||||||
&value, NULL);
|
&value, NULL);
|
||||||
resolved_address = value_as_address (value);
|
resolved_address = value_as_address (value);
|
||||||
|
|
16
gdb/eval.c
16
gdb/eval.c
|
@ -666,7 +666,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside,
|
||||||
if (return_type == NULL)
|
if (return_type == NULL)
|
||||||
error_call_unknown_return_type (function_name);
|
error_call_unknown_return_type (function_name);
|
||||||
|
|
||||||
return allocate_value (return_type);
|
return value::allocate (return_type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error (_("Expression of type other than "
|
error (_("Expression of type other than "
|
||||||
|
@ -1880,7 +1880,7 @@ eval_op_type (struct type *expect_type, struct expression *exp,
|
||||||
enum noside noside, struct type *type)
|
enum noside noside, struct type *type)
|
||||||
{
|
{
|
||||||
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||||
return allocate_value (type);
|
return value::allocate (type);
|
||||||
else
|
else
|
||||||
error (_("Attempt to use a type name as an expression"));
|
error (_("Attempt to use a type name as an expression"));
|
||||||
}
|
}
|
||||||
|
@ -2162,9 +2162,9 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
|
||||||
if (callee_type)
|
if (callee_type)
|
||||||
{
|
{
|
||||||
if ((callee_type->code () == TYPE_CODE_ERROR) && expect_type)
|
if ((callee_type->code () == TYPE_CODE_ERROR) && expect_type)
|
||||||
return allocate_value (expect_type);
|
return value::allocate (expect_type);
|
||||||
else
|
else
|
||||||
return allocate_value (callee_type);
|
return value::allocate (callee_type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error (_("Expression of type other than "
|
error (_("Expression of type other than "
|
||||||
|
@ -2440,7 +2440,7 @@ array_operation::evaluate (struct type *expect_type,
|
||||||
if (expect_type != nullptr
|
if (expect_type != nullptr
|
||||||
&& type->code () == TYPE_CODE_STRUCT)
|
&& 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 ());
|
memset (value_contents_raw (rec).data (), '\0', type->length ());
|
||||||
return evaluate_struct_tuple (rec, exp, noside, nargs);
|
return evaluate_struct_tuple (rec, exp, noside, nargs);
|
||||||
|
@ -2451,7 +2451,7 @@ array_operation::evaluate (struct type *expect_type,
|
||||||
{
|
{
|
||||||
struct type *range_type = type->index_type ();
|
struct type *range_type = type->index_type ();
|
||||||
struct type *element_type = type->target_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 ();
|
int element_size = check_typedef (element_type)->length ();
|
||||||
LONGEST low_bound, high_bound, index;
|
LONGEST low_bound, high_bound, index;
|
||||||
|
|
||||||
|
@ -2485,7 +2485,7 @@ array_operation::evaluate (struct type *expect_type,
|
||||||
if (expect_type != nullptr
|
if (expect_type != nullptr
|
||||||
&& type->code () == TYPE_CODE_SET)
|
&& 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 ();
|
gdb_byte *valaddr = value_contents_raw (set).data ();
|
||||||
struct type *element_type = type->index_type ();
|
struct type *element_type = type->index_type ();
|
||||||
struct type *check_type = element_type;
|
struct type *check_type = element_type;
|
||||||
|
@ -2569,7 +2569,7 @@ unop_extract_operation::evaluate (struct type *expect_type,
|
||||||
if (type->length () > old_value->type ()->length ())
|
if (type->length () > old_value->type ()->length ())
|
||||||
error (_("length type is larger than the value type"));
|
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 ());
|
value_contents_copy (result, 0, old_value, 0, type->length ());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1618,7 +1618,7 @@ public:
|
||||||
if (!TYPE_IS_REFERENCE (type))
|
if (!TYPE_IS_REFERENCE (type))
|
||||||
{
|
{
|
||||||
type = lookup_lvalue_reference_type (type);
|
type = lookup_lvalue_reference_type (type);
|
||||||
result = allocate_value (type);
|
result = value::allocate (type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1653,7 +1653,7 @@ public:
|
||||||
value *result = std::get<0> (m_storage)->evaluate (nullptr, exp,
|
value *result = std::get<0> (m_storage)->evaluate (nullptr, exp,
|
||||||
sub_noside);
|
sub_noside);
|
||||||
if (noside != EVAL_NORMAL)
|
if (noside != EVAL_NORMAL)
|
||||||
return allocate_value (cplus_typeid_type (exp->gdbarch));
|
return value::allocate (cplus_typeid_type (exp->gdbarch));
|
||||||
return cplus_typeid (result);
|
return cplus_typeid (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ fortran_bounds_all_dims (bool lbound_p,
|
||||||
1, ndimensions);
|
1, ndimensions);
|
||||||
struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
|
struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
|
||||||
struct type *result_type = create_array_type (nullptr, elm_type, range);
|
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
|
/* 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. */
|
laid out in memory, the first dimension will be the most inner. */
|
||||||
|
@ -720,7 +720,7 @@ fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
|
||||||
1, ndimensions);
|
1, ndimensions);
|
||||||
struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
|
struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
|
||||||
struct type *result_type = create_array_type (nullptr, elm_type, range);
|
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 ();
|
LONGEST elm_len = elm_type->length ();
|
||||||
|
|
||||||
/* Walk the array dimensions backwards due to the way the array will be
|
/* Walk the array dimensions backwards due to the way the array will be
|
||||||
|
@ -1440,7 +1440,7 @@ fortran_undetermined::value_subarray (value *array,
|
||||||
|
|
||||||
/* Now copy the elements from the original ARRAY into the packed
|
/* Now copy the elements from the original ARRAY into the packed
|
||||||
array value DEST. */
|
array value DEST. */
|
||||||
struct value *dest = allocate_value (repacked_array_type);
|
struct value *dest = value::allocate (repacked_array_type);
|
||||||
if (array->lazy ()
|
if (array->lazy ()
|
||||||
|| (total_offset + array_slice_type->length ()
|
|| (total_offset + array_slice_type->length ()
|
||||||
> check_typedef (array->type ())->length ()))
|
> check_typedef (array->type ())->length ()))
|
||||||
|
|
|
@ -586,7 +586,7 @@ language_defn::read_var_value (struct symbol *var,
|
||||||
type = resolve_dynamic_type (type, {}, /* Unused address. */ 0);
|
type = resolve_dynamic_type (type, {}, /* Unused address. */ 0);
|
||||||
}
|
}
|
||||||
/* Put the constant back in target format. */
|
/* 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 (),
|
store_signed_integer (value_contents_raw (v).data (), type->length (),
|
||||||
type_byte_order (type), var->value_longest ());
|
type_byte_order (type), var->value_longest ());
|
||||||
VALUE_LVAL (v) = not_lval;
|
VALUE_LVAL (v) = not_lval;
|
||||||
|
@ -626,7 +626,7 @@ language_defn::read_var_value (struct symbol *var,
|
||||||
/* Value is a constant byte-sequence and needs no memory access. */
|
/* Value is a constant byte-sequence and needs no memory access. */
|
||||||
type = resolve_dynamic_type (type, {}, /* Unused address. */ 0);
|
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 (),
|
memcpy (value_contents_raw (v).data (), var->value_bytes (),
|
||||||
type->length ());
|
type->length ());
|
||||||
VALUE_LVAL (v) = not_lval;
|
VALUE_LVAL (v) = not_lval;
|
||||||
|
@ -801,7 +801,7 @@ default_value_from_register (struct gdbarch *gdbarch, struct type *type,
|
||||||
int regnum, struct frame_id frame_id)
|
int regnum, struct frame_id frame_id)
|
||||||
{
|
{
|
||||||
int len = type->length ();
|
int len = type->length ();
|
||||||
struct value *value = allocate_value (type);
|
struct value *value = value::allocate (type);
|
||||||
frame_info_ptr frame;
|
frame_info_ptr frame;
|
||||||
|
|
||||||
VALUE_LVAL (value) = lval_register;
|
VALUE_LVAL (value) = lval_register;
|
||||||
|
@ -895,7 +895,7 @@ value_from_register (struct type *type, int regnum, frame_info_ptr frame)
|
||||||
the corresponding [integer] type (see Alpha). The assumption
|
the corresponding [integer] type (see Alpha). The assumption
|
||||||
is that gdbarch_register_to_value populates the entire value
|
is that gdbarch_register_to_value populates the entire value
|
||||||
including the location. */
|
including the location. */
|
||||||
v = allocate_value (type);
|
v = value::allocate (type);
|
||||||
VALUE_LVAL (v) = lval_register;
|
VALUE_LVAL (v) = lval_register;
|
||||||
VALUE_NEXT_FRAME_ID (v) = get_frame_id (get_next_frame_sentinel_okay (frame));
|
VALUE_NEXT_FRAME_ID (v) = get_frame_id (get_next_frame_sentinel_okay (frame));
|
||||||
VALUE_REGNUM (v) = regnum;
|
VALUE_REGNUM (v) = regnum;
|
||||||
|
|
|
@ -931,7 +931,7 @@ struct type
|
||||||
|
|
||||||
/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
|
/* 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,
|
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. */
|
calls check_typedef, X->type ()->length () is safe. */
|
||||||
ULONGEST length () const
|
ULONGEST length () const
|
||||||
{
|
{
|
||||||
|
|
|
@ -3093,7 +3093,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
|
||||||
|
|
||||||
if (read_value != nullptr)
|
if (read_value != nullptr)
|
||||||
{
|
{
|
||||||
*read_value = allocate_value (type);
|
*read_value = value::allocate (type);
|
||||||
i386_extract_return_value (gdbarch, type, regcache,
|
i386_extract_return_value (gdbarch, type, regcache,
|
||||||
value_contents_raw (*read_value).data ());
|
value_contents_raw (*read_value).data ());
|
||||||
}
|
}
|
||||||
|
@ -3557,7 +3557,7 @@ i386_pseudo_register_read_value (struct gdbarch *gdbarch,
|
||||||
{
|
{
|
||||||
struct value *result;
|
struct value *result;
|
||||||
|
|
||||||
result = allocate_value (register_type (gdbarch, regnum));
|
result = value::allocate (register_type (gdbarch, regnum));
|
||||||
VALUE_LVAL (result) = lval_register;
|
VALUE_LVAL (result) = lval_register;
|
||||||
VALUE_REGNUM (result) = regnum;
|
VALUE_REGNUM (result) = regnum;
|
||||||
|
|
||||||
|
|
|
@ -466,7 +466,7 @@ get_call_return_value (struct call_return_meta_info *ri)
|
||||||
bool stack_temporaries = thread_stack_temporaries_enabled_p (thr);
|
bool stack_temporaries = thread_stack_temporaries_enabled_p (thr);
|
||||||
|
|
||||||
if (ri->value_type->code () == TYPE_CODE_VOID)
|
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)
|
else if (ri->struct_return_p)
|
||||||
{
|
{
|
||||||
if (stack_temporaries)
|
if (stack_temporaries)
|
||||||
|
|
|
@ -9197,7 +9197,7 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var,
|
||||||
return allocate_computed_value (type, &siginfo_value_funcs, nullptr);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ lval_func_write (struct value *v, struct value *fromval)
|
||||||
|
|
||||||
for (i = offset; i < n; i++)
|
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]);
|
struct value *to_elm_val = value_subscript (c->val, c->indices[i]);
|
||||||
|
|
||||||
memcpy (value_contents_writeable (from_elm_val).data (),
|
memcpy (value_contents_writeable (from_elm_val).data (),
|
||||||
|
@ -297,7 +297,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
|
||||||
make_cv_type (TYPE_CONST (type), TYPE_VOLATILE (type), dst_type, NULL);
|
make_cv_type (TYPE_CONST (type), TYPE_VOLATILE (type), dst_type, NULL);
|
||||||
|
|
||||||
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||||
ret = allocate_value (dst_type);
|
ret = value::allocate (dst_type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check whether to create a lvalue or not. */
|
/* Check whether to create a lvalue or not. */
|
||||||
|
@ -310,7 +310,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ret = allocate_value (dst_type);
|
ret = value::allocate (dst_type);
|
||||||
|
|
||||||
/* Copy src val contents into the destination value. */
|
/* Copy src val contents into the destination value. */
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
|
@ -464,7 +464,7 @@ opencl_logical_not (struct type *expect_type, struct expression *exp,
|
||||||
rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
|
rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
|
||||||
eltype->length (), 0,
|
eltype->length (), 0,
|
||||||
highb - lowb + 1);
|
highb - lowb + 1);
|
||||||
ret = allocate_value (rettype);
|
ret = value::allocate (rettype);
|
||||||
|
|
||||||
for (i = 0; i < highb - lowb + 1; i++)
|
for (i = 0; i < highb - lowb + 1; i++)
|
||||||
{
|
{
|
||||||
|
@ -564,7 +564,7 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2,
|
||||||
rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
|
rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
|
||||||
eltype1->length (), 0,
|
eltype1->length (), 0,
|
||||||
highb1 - lowb1 + 1);
|
highb1 - lowb1 + 1);
|
||||||
ret = allocate_value (rettype);
|
ret = value::allocate (rettype);
|
||||||
|
|
||||||
for (i = 0; i < highb1 - lowb1 + 1; i++)
|
for (i = 0; i < highb1 - lowb1 + 1; i++)
|
||||||
{
|
{
|
||||||
|
@ -831,7 +831,7 @@ Cannot perform operation on vectors with different types"));
|
||||||
error (_("\
|
error (_("\
|
||||||
Cannot perform conditional operation on vectors with different sizes"));
|
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++)
|
for (i = 0; i < highb1 - lowb1 + 1; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -254,7 +254,7 @@ ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function,
|
||||||
gdb_byte *readbuf = nullptr;
|
gdb_byte *readbuf = nullptr;
|
||||||
if (read_value != nullptr)
|
if (read_value != nullptr)
|
||||||
{
|
{
|
||||||
*read_value = allocate_value (valtype);
|
*read_value = value::allocate (valtype);
|
||||||
readbuf = value_contents_raw (*read_value).data ();
|
readbuf = value_contents_raw (*read_value).data ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -580,7 +580,7 @@ python_xmethod_worker::invoke (struct value *obj,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = allocate_value (lookup_typename (current_language,
|
res = value::allocate (lookup_typename (current_language,
|
||||||
"void", NULL, 0));
|
"void", NULL, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -743,7 +743,7 @@ readable_regcache::cooked_read_value (int regnum)
|
||||||
{
|
{
|
||||||
struct value *result;
|
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_LVAL (result) = lval_register;
|
||||||
VALUE_REGNUM (result) = regnum;
|
VALUE_REGNUM (result) = regnum;
|
||||||
|
|
||||||
|
|
|
@ -3277,7 +3277,7 @@ riscv_return_value (struct gdbarch *gdbarch,
|
||||||
arg_type->length ()),
|
arg_type->length ()),
|
||||||
type_byte_order (arg_type),
|
type_byte_order (arg_type),
|
||||||
arg_type->is_unsigned ());
|
arg_type->is_unsigned ());
|
||||||
abi_val = allocate_value (info.type);
|
abi_val = value::allocate (info.type);
|
||||||
unscaled.write (value_contents_raw (abi_val),
|
unscaled.write (value_contents_raw (abi_val),
|
||||||
type_byte_order (info.type),
|
type_byte_order (info.type),
|
||||||
info.type->is_unsigned ());
|
info.type->is_unsigned ());
|
||||||
|
@ -3291,7 +3291,7 @@ riscv_return_value (struct gdbarch *gdbarch,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
abi_val = allocate_value (info.type);
|
abi_val = value::allocate (info.type);
|
||||||
readbuf = value_contents_raw (abi_val).data ();
|
readbuf = value_contents_raw (abi_val).data ();
|
||||||
}
|
}
|
||||||
arg_len = info.type->length ();
|
arg_len = info.type->length ();
|
||||||
|
@ -3408,7 +3408,7 @@ riscv_return_value (struct gdbarch *gdbarch,
|
||||||
unscaled.read (value_contents (abi_val),
|
unscaled.read (value_contents (abi_val),
|
||||||
type_byte_order (info.type),
|
type_byte_order (info.type),
|
||||||
info.type->is_unsigned ());
|
info.type->is_unsigned ());
|
||||||
*read_value = allocate_value (arg_type);
|
*read_value = value::allocate (arg_type);
|
||||||
unscaled.write (value_contents_raw (*read_value),
|
unscaled.write (value_contents_raw (*read_value),
|
||||||
type_byte_order (arg_type),
|
type_byte_order (arg_type),
|
||||||
arg_type->is_unsigned ());
|
arg_type->is_unsigned ());
|
||||||
|
|
|
@ -1351,7 +1351,7 @@ eval_op_rust_array (struct type *expect_type, struct expression *exp,
|
||||||
{
|
{
|
||||||
struct type *arraytype
|
struct type *arraytype
|
||||||
= lookup_array_range_type (elt->type (), 0, copies - 1);
|
= lookup_array_range_type (elt->type (), 0, copies - 1);
|
||||||
return allocate_value (arraytype);
|
return value::allocate (arraytype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1518,7 +1518,7 @@ rust_aggregate_operation::evaluate (struct type *expect_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||||
result = allocate_value (type);
|
result = value::allocate (type);
|
||||||
else
|
else
|
||||||
result = value_at_lazy (type, addr);
|
result = value_at_lazy (type, addr);
|
||||||
|
|
||||||
|
|
|
@ -1530,7 +1530,7 @@ sparc32_return_value (struct gdbarch *gdbarch, struct value *function,
|
||||||
|
|
||||||
if (read_value != nullptr)
|
if (read_value != nullptr)
|
||||||
{
|
{
|
||||||
*read_value = allocate_value (type);
|
*read_value = value::allocate (type);
|
||||||
gdb_byte *readbuf = value_contents_raw (*read_value).data ();
|
gdb_byte *readbuf = value_contents_raw (*read_value).data ();
|
||||||
sparc32_extract_return_value (type, regcache, readbuf);
|
sparc32_extract_return_value (type, regcache, readbuf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ value_of_builtin_frame_fp_reg (frame_info_ptr frame, const void *baton)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
|
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 ();
|
gdb_byte *buf = value_contents_raw (val).data ();
|
||||||
|
|
||||||
gdbarch_address_to_pointer (gdbarch, data_ptr_type,
|
gdbarch_address_to_pointer (gdbarch, data_ptr_type,
|
||||||
|
@ -62,7 +62,7 @@ value_of_builtin_frame_pc_reg (frame_info_ptr frame, const void *baton)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct type *func_ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
|
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 ();
|
gdb_byte *buf = value_contents_raw (val).data ();
|
||||||
|
|
||||||
gdbarch_address_to_pointer (gdbarch, func_ptr_type,
|
gdbarch_address_to_pointer (gdbarch, func_ptr_type,
|
||||||
|
|
|
@ -3777,12 +3777,12 @@ sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var,
|
||||||
|
|
||||||
type = init_vector_type (builtin_type (gdbarch)->builtin_true_char,
|
type = init_vector_type (builtin_type (gdbarch)->builtin_true_char,
|
||||||
buf->size ());
|
buf->size ());
|
||||||
v = allocate_value (type);
|
v = value::allocate (type);
|
||||||
memcpy (value_contents_raw (v).data (), buf->data (), buf->size ());
|
memcpy (value_contents_raw (v).data (), buf->data (), buf->size ());
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return allocate_value (builtin_type (gdbarch)->builtin_void);
|
return value::allocate (builtin_type (gdbarch)->builtin_void);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(HAVE_LIBEXPAT)
|
#if !defined(HAVE_LIBEXPAT)
|
||||||
|
|
|
@ -190,7 +190,7 @@ value_subscript (struct value *array, LONGEST index)
|
||||||
if (!array->lazy ()
|
if (!array->lazy ()
|
||||||
&& !value_bytes_available (array, elt_size * index, elt_size))
|
&& !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);
|
mark_value_bytes_unavailable (val, 0, elt_size);
|
||||||
VALUE_LVAL (val) = lval_memory;
|
VALUE_LVAL (val) = lval_memory;
|
||||||
val->set_address (array->address () + elt_size * index);
|
val->set_address (array->address () + elt_size * index);
|
||||||
|
@ -716,7 +716,7 @@ value_concat (struct value *arg1, struct value *arg2)
|
||||||
lowbound,
|
lowbound,
|
||||||
lowbound + n_elts - 1);
|
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<gdb_byte> contents = value_contents_raw (result);
|
||||||
gdb::array_view<const gdb_byte> lhs_contents = value_contents (arg1);
|
gdb::array_view<const gdb_byte> lhs_contents = value_contents (arg1);
|
||||||
gdb::array_view<const gdb_byte> rhs_contents = value_contents (arg2);
|
gdb::array_view<const gdb_byte> rhs_contents = value_contents (arg2);
|
||||||
|
@ -869,7 +869,7 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
|
|
||||||
auto fixed_point_to_value = [type1] (const gdb_mpq &fp)
|
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
|
fp.write_fixed_point
|
||||||
(value_contents_raw (fp_val),
|
(value_contents_raw (fp_val),
|
||||||
|
@ -1179,7 +1179,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
if (is_floating_type (type1) || is_floating_type (type2))
|
if (is_floating_type (type1) || is_floating_type (type2))
|
||||||
{
|
{
|
||||||
result_type = promotion_type (type1, 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;
|
struct type *eff_type_v1, *eff_type_v2;
|
||||||
gdb::byte_vector v1, v2;
|
gdb::byte_vector v1, v2;
|
||||||
|
@ -1229,7 +1229,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
|
|
||||||
result_type = type1;
|
result_type = type1;
|
||||||
|
|
||||||
val = allocate_value (result_type);
|
val = value::allocate (result_type);
|
||||||
store_signed_integer (value_contents_raw (val).data (),
|
store_signed_integer (value_contents_raw (val).data (),
|
||||||
result_type->length (),
|
result_type->length (),
|
||||||
type_byte_order (result_type),
|
type_byte_order (result_type),
|
||||||
|
@ -1375,7 +1375,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
error (_("Invalid binary operation on numbers."));
|
error (_("Invalid binary operation on numbers."));
|
||||||
}
|
}
|
||||||
|
|
||||||
val = allocate_value (result_type);
|
val = value::allocate (result_type);
|
||||||
store_unsigned_integer (value_contents_raw (val).data (),
|
store_unsigned_integer (value_contents_raw (val).data (),
|
||||||
val->type ()->length (),
|
val->type ()->length (),
|
||||||
type_byte_order (result_type),
|
type_byte_order (result_type),
|
||||||
|
@ -1536,7 +1536,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
error (_("Invalid binary operation on numbers."));
|
error (_("Invalid binary operation on numbers."));
|
||||||
}
|
}
|
||||||
|
|
||||||
val = allocate_value (result_type);
|
val = value::allocate (result_type);
|
||||||
store_signed_integer (value_contents_raw (val).data (),
|
store_signed_integer (value_contents_raw (val).data (),
|
||||||
val->type ()->length (),
|
val->type ()->length (),
|
||||||
type_byte_order (result_type),
|
type_byte_order (result_type),
|
||||||
|
@ -1581,7 +1581,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type)
|
||||||
&& !value_equal (elval, scalar_value))
|
&& !value_equal (elval, scalar_value))
|
||||||
error (_("conversion of scalar to vector involves truncation"));
|
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);
|
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
|
||||||
int elt_len = eltype->length ();
|
int elt_len = eltype->length ();
|
||||||
|
|
||||||
|
@ -1628,7 +1628,7 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
|
||||||
|| low_bound1 != low_bound2 || high_bound1 != high_bound2)
|
|| low_bound1 != low_bound2 || high_bound1 != high_bound2)
|
||||||
error (_("Cannot perform operation on vectors with different types"));
|
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);
|
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
|
||||||
scoped_value_mark mark;
|
scoped_value_mark mark;
|
||||||
for (i = 0; i < high_bound1 - low_bound1 + 1; i++)
|
for (i = 0; i < high_bound1 - low_bound1 + 1; i++)
|
||||||
|
@ -1916,7 +1916,7 @@ value_neg (struct value *arg1)
|
||||||
return value_binop (value_zero (type, not_lval), arg1, BINOP_SUB);
|
return value_binop (value_zero (type, not_lval), arg1, BINOP_SUB);
|
||||||
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
|
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 ());
|
struct type *eltype = check_typedef (type->target_type ());
|
||||||
int i;
|
int i;
|
||||||
LONGEST low_bound, high_bound;
|
LONGEST low_bound, high_bound;
|
||||||
|
@ -1968,7 +1968,7 @@ value_complement (struct value *arg1)
|
||||||
if (!get_array_bounds (type, &low_bound, &high_bound))
|
if (!get_array_bounds (type, &low_bound, &high_bound))
|
||||||
error (_("Could not determine the vector bounds"));
|
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);
|
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
|
||||||
int elt_len = eltype->length ();
|
int elt_len = eltype->length ();
|
||||||
|
|
||||||
|
|
36
gdb/valops.c
36
gdb/valops.c
|
@ -391,7 +391,7 @@ value_cast_to_fixed_point (struct type *to_type, struct value *from_val)
|
||||||
|
|
||||||
/* Finally, create the result value, and pack the unscaled value
|
/* Finally, create the result value, and pack the unscaled value
|
||||||
in it. */
|
in it. */
|
||||||
struct value *result = allocate_value (to_type);
|
struct value *result = value::allocate (to_type);
|
||||||
unscaled.write (value_contents_raw (result),
|
unscaled.write (value_contents_raw (result),
|
||||||
type_byte_order (to_type),
|
type_byte_order (to_type),
|
||||||
to_type->is_unsigned ());
|
to_type->is_unsigned ());
|
||||||
|
@ -543,7 +543,7 @@ value_cast (struct type *type, struct value *arg2)
|
||||||
{
|
{
|
||||||
if (is_floating_value (arg2))
|
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,
|
target_float_convert (value_contents (arg2).data (), type2,
|
||||||
value_contents_raw (v).data (), type);
|
value_contents_raw (v).data (), type);
|
||||||
return v;
|
return v;
|
||||||
|
@ -557,7 +557,7 @@ value_cast (struct type *type, struct value *arg2)
|
||||||
type2->is_unsigned (),
|
type2->is_unsigned (),
|
||||||
type2->fixed_point_scaling_factor ());
|
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 (),
|
target_float_from_host_double (value_contents_raw (v).data (),
|
||||||
to_type, mpq_get_d (fp_val.val));
|
to_type, mpq_get_d (fp_val.val));
|
||||||
return v;
|
return v;
|
||||||
|
@ -618,7 +618,7 @@ value_cast (struct type *type, struct value *arg2)
|
||||||
else if (code1 == TYPE_CODE_METHODPTR && code2 == TYPE_CODE_INT
|
else if (code1 == TYPE_CODE_METHODPTR && code2 == TYPE_CODE_INT
|
||||||
&& value_as_long (arg2) == 0)
|
&& 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,
|
cplus_make_method_ptr (to_type,
|
||||||
value_contents_writeable (result).data (), 0, 0);
|
value_contents_writeable (result).data (), 0, 0);
|
||||||
|
@ -954,7 +954,7 @@ value_one (struct type *type)
|
||||||
if (!get_array_bounds (type1, &low_bound, &high_bound))
|
if (!get_array_bounds (type1, &low_bound, &high_bound))
|
||||||
error (_("Could not determine the vector bounds"));
|
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);
|
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
|
||||||
int elt_len = eltype->length ();
|
int elt_len = eltype->length ();
|
||||||
|
|
||||||
|
@ -1724,7 +1724,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
|
||||||
|
|
||||||
if (!current_language->c_style_arrays_p ())
|
if (!current_language->c_style_arrays_p ())
|
||||||
{
|
{
|
||||||
val = allocate_value (arraytype);
|
val = value::allocate (arraytype);
|
||||||
for (idx = 0; idx < nelem; idx++)
|
for (idx = 0; idx < nelem; idx++)
|
||||||
value_contents_copy (val, idx * typelength, elemvec[idx], 0,
|
value_contents_copy (val, idx * typelength, elemvec[idx], 0,
|
||||||
typelength);
|
typelength);
|
||||||
|
@ -1734,7 +1734,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
|
||||||
/* Allocate space to store the array, and then initialize it by
|
/* Allocate space to store the array, and then initialize it by
|
||||||
copying in each element. */
|
copying in each element. */
|
||||||
|
|
||||||
val = allocate_value (arraytype);
|
val = value::allocate (arraytype);
|
||||||
for (idx = 0; idx < nelem; idx++)
|
for (idx = 0; idx < nelem; idx++)
|
||||||
value_contents_copy (val, idx * typelength, elemvec[idx], 0, typelength);
|
value_contents_copy (val, idx * typelength, elemvec[idx], 0, typelength);
|
||||||
return val;
|
return val;
|
||||||
|
@ -1749,7 +1749,7 @@ value_cstring (const char *ptr, ssize_t len, struct type *char_type)
|
||||||
struct type *stringtype
|
struct type *stringtype
|
||||||
= lookup_array_range_type (char_type, lowbound, highbound + lowbound - 1);
|
= 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);
|
memcpy (value_contents_raw (val).data (), ptr, len);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -1772,7 +1772,7 @@ value_string (const char *ptr, ssize_t len, struct type *char_type)
|
||||||
struct type *stringtype
|
struct type *stringtype
|
||||||
= lookup_string_range_type (char_type, lowbound, highbound + lowbound - 1);
|
= 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);
|
memcpy (value_contents_raw (val).data (), ptr, len);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -3598,7 +3598,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
||||||
(lookup_memberptr_type (t->field (i).type (), domain),
|
(lookup_memberptr_type (t->field (i).type (), domain),
|
||||||
offset + (LONGEST) (t->field (i).loc_bitpos () >> 3));
|
offset + (LONGEST) (t->field (i).loc_bitpos () >> 3));
|
||||||
else if (noside != EVAL_NORMAL)
|
else if (noside != EVAL_NORMAL)
|
||||||
return allocate_value (t->field (i).type ());
|
return value::allocate (t->field (i).type ());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Try to evaluate NAME as a qualified name with implicit
|
/* Try to evaluate NAME as a qualified name with implicit
|
||||||
|
@ -3737,14 +3737,14 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
||||||
{
|
{
|
||||||
if (want_address)
|
if (want_address)
|
||||||
{
|
{
|
||||||
result = allocate_value
|
result = value::allocate
|
||||||
(lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
|
(lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
|
||||||
cplus_make_method_ptr (result->type (),
|
cplus_make_method_ptr (result->type (),
|
||||||
value_contents_writeable (result).data (),
|
value_contents_writeable (result).data (),
|
||||||
TYPE_FN_FIELD_VOFFSET (f, j), 1);
|
TYPE_FN_FIELD_VOFFSET (f, j), 1);
|
||||||
}
|
}
|
||||||
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
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
|
else
|
||||||
error (_("Cannot reference virtual member function \"%s\""),
|
error (_("Cannot reference virtual member function \"%s\""),
|
||||||
name);
|
name);
|
||||||
|
@ -3763,7 +3763,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
||||||
result = v;
|
result = v;
|
||||||
else
|
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 (),
|
cplus_make_method_ptr (result->type (),
|
||||||
value_contents_writeable (result).data (),
|
value_contents_writeable (result).data (),
|
||||||
v->address (), 0);
|
v->address (), 0);
|
||||||
|
@ -3839,7 +3839,7 @@ value_maybe_namespace_elt (const struct type *curtype,
|
||||||
return NULL;
|
return NULL;
|
||||||
else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
|
else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||||
&& (sym.symbol->aclass () == LOC_TYPEDEF))
|
&& (sym.symbol->aclass () == LOC_TYPEDEF))
|
||||||
result = allocate_value (sym.symbol->type ());
|
result = value::allocate (sym.symbol->type ());
|
||||||
else
|
else
|
||||||
result = value_of_variable (sym.symbol, sym.block);
|
result = value_of_variable (sym.symbol, sym.block);
|
||||||
|
|
||||||
|
@ -4082,7 +4082,7 @@ value_slice (struct value *array, int lowbound, int length)
|
||||||
slice = value::allocate_lazy (slice_type);
|
slice = value::allocate_lazy (slice_type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
slice = allocate_value (slice_type);
|
slice = value::allocate (slice_type);
|
||||||
value_contents_copy (slice, 0, array, offset,
|
value_contents_copy (slice, 0, array, offset,
|
||||||
type_length_units (slice_type));
|
type_length_units (slice_type));
|
||||||
}
|
}
|
||||||
|
@ -4104,7 +4104,7 @@ value_literal_complex (struct value *arg1,
|
||||||
struct value *val;
|
struct value *val;
|
||||||
struct type *real_type = type->target_type ();
|
struct type *real_type = type->target_type ();
|
||||||
|
|
||||||
val = allocate_value (type);
|
val = value::allocate (type);
|
||||||
arg1 = value_cast (real_type, arg1);
|
arg1 = value_cast (real_type, arg1);
|
||||||
arg2 = value_cast (real_type, arg2);
|
arg2 = value_cast (real_type, arg2);
|
||||||
|
|
||||||
|
@ -4153,8 +4153,8 @@ cast_into_complex (struct type *type, struct value *val)
|
||||||
if (val->type ()->code () == TYPE_CODE_COMPLEX)
|
if (val->type ()->code () == TYPE_CODE_COMPLEX)
|
||||||
{
|
{
|
||||||
struct type *val_real_type = val->type ()->target_type ();
|
struct type *val_real_type = val->type ()->target_type ();
|
||||||
struct value *re_val = allocate_value (val_real_type);
|
struct value *re_val = value::allocate (val_real_type);
|
||||||
struct value *im_val = allocate_value (val_real_type);
|
struct value *im_val = value::allocate (val_real_type);
|
||||||
int len = val_real_type->length ();
|
int len = val_real_type->length ();
|
||||||
|
|
||||||
copy (value_contents (val).slice (0, len),
|
copy (value_contents (val).slice (0, len),
|
||||||
|
|
|
@ -3099,7 +3099,7 @@ test_print_flags (gdbarch *arch)
|
||||||
append_flags_type_field (flags_type, 3, 2, field_type, "B");
|
append_flags_type_field (flags_type, 3, 2, field_type, "B");
|
||||||
append_flags_type_field (flags_type, 5, 3, field_type, "C");
|
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 ();
|
gdb_byte *contents = value_contents_writeable (val).data ();
|
||||||
store_unsigned_integer (contents, 4, gdbarch_byte_order (arch), 0xaa);
|
store_unsigned_integer (contents, 4, gdbarch_byte_order (arch), 0xaa);
|
||||||
|
|
||||||
|
|
42
gdb/value.c
42
gdb/value.c
|
@ -958,8 +958,8 @@ allocate_value_contents (struct value *val, bool check_size)
|
||||||
/* Allocate a value and its contents for type TYPE. If CHECK_SIZE is true,
|
/* Allocate a value and its contents for type TYPE. If CHECK_SIZE is true,
|
||||||
then apply the usual max-value-size checks. */
|
then apply the usual max-value-size checks. */
|
||||||
|
|
||||||
static struct value *
|
struct value *
|
||||||
allocate_value (struct type *type, bool check_size)
|
value::allocate (struct type *type, bool check_size)
|
||||||
{
|
{
|
||||||
struct value *val = value::allocate_lazy (type);
|
struct value *val = value::allocate_lazy (type);
|
||||||
|
|
||||||
|
@ -971,9 +971,9 @@ allocate_value (struct type *type, bool check_size)
|
||||||
/* Allocate a value and its contents for type TYPE. */
|
/* Allocate a value and its contents for type TYPE. */
|
||||||
|
|
||||||
struct value *
|
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
|
/* Allocate a value that has the correct length
|
||||||
|
@ -991,7 +991,7 @@ allocate_repeat_value (struct type *type, int count)
|
||||||
struct type *array_type
|
struct type *array_type
|
||||||
= lookup_array_range_type (type, low_bound, count + low_bound - 1);
|
= lookup_array_range_type (type, low_bound, count + low_bound - 1);
|
||||||
|
|
||||||
return allocate_value (array_type);
|
return value::allocate (array_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct value *
|
struct value *
|
||||||
|
@ -1619,7 +1619,7 @@ value_non_lval (struct value *arg)
|
||||||
if (VALUE_LVAL (arg) != not_lval)
|
if (VALUE_LVAL (arg) != not_lval)
|
||||||
{
|
{
|
||||||
struct type *enc_type = arg->enclosing_type ();
|
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));
|
copy (value_contents_all (arg), value_contents_all_raw (val));
|
||||||
val->m_type = arg->m_type;
|
val->m_type = arg->m_type;
|
||||||
|
@ -2077,18 +2077,18 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
|
||||||
val = value_from_longest (builtin_type (gdbarch)->builtin_int64,
|
val = value_from_longest (builtin_type (gdbarch)->builtin_int64,
|
||||||
tsv->value);
|
tsv->value);
|
||||||
else
|
else
|
||||||
val = allocate_value (builtin_type (gdbarch)->builtin_void);
|
val = value::allocate (builtin_type (gdbarch)->builtin_void);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (var->kind)
|
switch (var->kind)
|
||||||
{
|
{
|
||||||
case INTERNALVAR_VOID:
|
case INTERNALVAR_VOID:
|
||||||
val = allocate_value (builtin_type (gdbarch)->builtin_void);
|
val = value::allocate (builtin_type (gdbarch)->builtin_void);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INTERNALVAR_FUNCTION:
|
case INTERNALVAR_FUNCTION:
|
||||||
val = allocate_value (builtin_type (gdbarch)->internal_fn);
|
val = value::allocate (builtin_type (gdbarch)->internal_fn);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INTERNALVAR_INTEGER:
|
case INTERNALVAR_INTEGER:
|
||||||
|
@ -2566,7 +2566,7 @@ value_from_xmethod (xmethod_worker_up &&worker)
|
||||||
{
|
{
|
||||||
struct value *v;
|
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_lval = lval_xcallable;
|
||||||
v->m_location.xm_worker = worker.release ();
|
v->m_location.xm_worker = worker.release ();
|
||||||
v->m_modifiable = 0;
|
v->m_modifiable = 0;
|
||||||
|
@ -2989,7 +2989,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
|
||||||
v = value::allocate_lazy (arg1->enclosing_type ());
|
v = value::allocate_lazy (arg1->enclosing_type ());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v = allocate_value (arg1->enclosing_type ());
|
v = value::allocate (arg1->enclosing_type ());
|
||||||
value_contents_copy_raw (v, 0, arg1, 0,
|
value_contents_copy_raw (v, 0, arg1, 0,
|
||||||
arg1->enclosing_type ()->length ());
|
arg1->enclosing_type ()->length ());
|
||||||
}
|
}
|
||||||
|
@ -3022,7 +3022,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
|
||||||
v = value::allocate_lazy (type);
|
v = value::allocate_lazy (type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v = allocate_value (type);
|
v = value::allocate (type);
|
||||||
value_contents_copy_raw (v, v->embedded_offset (),
|
value_contents_copy_raw (v, v->embedded_offset (),
|
||||||
arg1, arg1->embedded_offset () + offset,
|
arg1, arg1->embedded_offset () + offset,
|
||||||
type_length_units (type));
|
type_length_units (type));
|
||||||
|
@ -3070,7 +3070,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
v = allocate_value (ftype);
|
v = value::allocate (ftype);
|
||||||
VALUE_LVAL (v) = lval_memory;
|
VALUE_LVAL (v) = lval_memory;
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
|
@ -3259,7 +3259,7 @@ value_field_bitfield (struct type *type, int fieldno,
|
||||||
{
|
{
|
||||||
int bitpos = type->field (fieldno).loc_bitpos ();
|
int bitpos = type->field (fieldno).loc_bitpos ();
|
||||||
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
|
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,
|
unpack_value_bitfield (res_val, bitpos, bitsize,
|
||||||
valaddr, embedded_offset, val);
|
valaddr, embedded_offset, val);
|
||||||
|
@ -3436,7 +3436,7 @@ value_zero (struct type *type, enum lval_type lv)
|
||||||
struct value *
|
struct value *
|
||||||
value_from_longest (struct type *type, LONGEST num)
|
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);
|
pack_long (value_contents_raw (val).data (), type, num);
|
||||||
return val;
|
return val;
|
||||||
|
@ -3448,7 +3448,7 @@ value_from_longest (struct type *type, LONGEST num)
|
||||||
struct value *
|
struct value *
|
||||||
value_from_ulongest (struct type *type, ULONGEST num)
|
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);
|
pack_unsigned_long (value_contents_raw (val).data (), type, num);
|
||||||
|
|
||||||
|
@ -3462,7 +3462,7 @@ value_from_ulongest (struct type *type, ULONGEST num)
|
||||||
struct value *
|
struct value *
|
||||||
value_from_pointer (struct type *type, CORE_ADDR addr)
|
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 (),
|
store_typed_address (value_contents_raw (val).data (),
|
||||||
check_typedef (type), addr);
|
check_typedef (type), addr);
|
||||||
|
@ -3476,7 +3476,7 @@ value_from_pointer (struct type *type, CORE_ADDR addr)
|
||||||
struct value *
|
struct value *
|
||||||
value_from_host_double (struct type *type, double d)
|
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);
|
gdb_assert (type->code () == TYPE_CODE_FLT);
|
||||||
target_float_from_host_double (value_contents_raw (value).data (),
|
target_float_from_host_double (value_contents_raw (value).data (),
|
||||||
value->type (), d);
|
value->type (), d);
|
||||||
|
@ -3543,7 +3543,7 @@ value_from_contents (struct type *type, const gdb_byte *contents)
|
||||||
{
|
{
|
||||||
struct value *result;
|
struct value *result;
|
||||||
|
|
||||||
result = allocate_value (type);
|
result = value::allocate (type);
|
||||||
memcpy (value_contents_raw (result).data (), contents, type->length ());
|
memcpy (value_contents_raw (result).data (), contents, type->length ());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3623,7 +3623,7 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset)
|
||||||
v = value::allocate_lazy (type);
|
v = value::allocate_lazy (type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v = allocate_value (type);
|
v = value::allocate (type);
|
||||||
value_contents_copy (v, v->embedded_offset (),
|
value_contents_copy (v, v->embedded_offset (),
|
||||||
whole, whole->embedded_offset () + offset,
|
whole, whole->embedded_offset () + offset,
|
||||||
type_length_units (type));
|
type_length_units (type));
|
||||||
|
@ -3650,7 +3650,7 @@ value_from_component_bitsize (struct value *whole, struct type *type,
|
||||||
&& bit_length == TARGET_CHAR_BIT * type->length ())
|
&& bit_length == TARGET_CHAR_BIT * type->length ())
|
||||||
return value_from_component (whole, type, bit_offset / TARGET_CHAR_BIT);
|
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 ();
|
LONGEST dst_offset = TARGET_CHAR_BIT * v->embedded_offset ();
|
||||||
if (is_scalar_type (type) && type_byte_order (type) == BFD_ENDIAN_BIG)
|
if (is_scalar_type (type) && type_byte_order (type) == BFD_ENDIAN_BIG)
|
||||||
|
|
11
gdb/value.h
11
gdb/value.h
|
@ -166,6 +166,9 @@ public:
|
||||||
NULL; it will be allocated when it is fetched from the target. */
|
NULL; it will be allocated when it is fetched from the target. */
|
||||||
static struct value *allocate_lazy (struct type *type);
|
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 ();
|
~value ();
|
||||||
|
|
||||||
DISABLE_COPY_AND_ASSIGN (value);
|
DISABLE_COPY_AND_ASSIGN (value);
|
||||||
|
@ -531,6 +534,12 @@ public:
|
||||||
limited_length will be set to indicate the length in octets that were
|
limited_length will be set to indicate the length in octets that were
|
||||||
loaded from the inferior. */
|
loaded from the inferior. */
|
||||||
ULONGEST m_limited_length = 0;
|
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
|
/* Returns value_type or value_enclosing_type depending on
|
||||||
|
@ -1011,8 +1020,6 @@ extern struct value *read_var_value (struct symbol *var,
|
||||||
const struct block *var_block,
|
const struct block *var_block,
|
||||||
frame_info_ptr frame);
|
frame_info_ptr frame);
|
||||||
|
|
||||||
extern struct value *allocate_value (struct type *type);
|
|
||||||
|
|
||||||
extern void value_contents_copy (struct value *dst, LONGEST dst_offset,
|
extern void value_contents_copy (struct value *dst, LONGEST dst_offset,
|
||||||
struct value *src, LONGEST src_offset,
|
struct value *src, LONGEST src_offset,
|
||||||
LONGEST length);
|
LONGEST length);
|
||||||
|
|
|
@ -436,7 +436,7 @@ tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
|
||||||
return allocate_computed_value (type, &tlb_value_funcs, NULL);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue