Turn remaining value_contents functions into methods

This turns the remaining value_contents functions -- value_contents,
value_contents_all, value_contents_for_printing, and
value_contents_for_printing_const -- into methods of value.  It also
converts the static functions require_not_optimized_out and
require_available to be private methods.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey 2023-01-31 14:38:30 -07:00
parent cdf3de175d
commit efaf1ae025
84 changed files with 330 additions and 329 deletions

View file

@ -1622,7 +1622,7 @@ pass_in_x (struct gdbarch *gdbarch, struct regcache *regcache,
int len = type->length (); int len = type->length ();
enum type_code typecode = type->code (); enum type_code typecode = type->code ();
int regnum = AARCH64_X0_REGNUM + info->ngrn; int regnum = AARCH64_X0_REGNUM + info->ngrn;
const bfd_byte *buf = value_contents (arg).data (); const bfd_byte *buf = arg->contents ().data ();
info->argnum++; info->argnum++;
@ -1692,7 +1692,7 @@ static void
pass_on_stack (struct aarch64_call_info *info, struct type *type, pass_on_stack (struct aarch64_call_info *info, struct type *type,
struct value *arg) struct value *arg)
{ {
const bfd_byte *buf = value_contents (arg).data (); const bfd_byte *buf = arg->contents ().data ();
int len = type->length (); int len = type->length ();
int align; int align;
stack_item_t item; stack_item_t item;
@ -1769,12 +1769,12 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
case TYPE_CODE_FLT: case TYPE_CODE_FLT:
case TYPE_CODE_DECFLOAT: case TYPE_CODE_DECFLOAT:
return pass_in_v (gdbarch, regcache, info, arg_type->length (), return pass_in_v (gdbarch, regcache, info, arg_type->length (),
value_contents (arg).data ()); arg->contents ().data ());
break; break;
case TYPE_CODE_COMPLEX: case TYPE_CODE_COMPLEX:
{ {
const bfd_byte *buf = value_contents (arg).data (); const bfd_byte *buf = arg->contents ().data ();
struct type *target_type = check_typedef (arg_type->target_type ()); struct type *target_type = check_typedef (arg_type->target_type ());
if (!pass_in_v (gdbarch, regcache, info, target_type->length (), if (!pass_in_v (gdbarch, regcache, info, target_type->length (),
@ -1788,7 +1788,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
if (arg_type->is_vector ()) if (arg_type->is_vector ())
return pass_in_v (gdbarch, regcache, info, arg_type->length (), return pass_in_v (gdbarch, regcache, info, arg_type->length (),
value_contents (arg).data ()); arg->contents ().data ());
/* fall through. */ /* fall through. */
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:
@ -1930,7 +1930,7 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp = align_down (sp - len, 16); sp = align_down (sp - len, 16);
/* Write the real data into the stack. */ /* Write the real data into the stack. */
write_memory (sp, value_contents (arg).data (), len); write_memory (sp, arg->contents ().data (), len);
/* Construct the indirection. */ /* Construct the indirection. */
arg_type = lookup_pointer_type (arg_type); arg_type = lookup_pointer_type (arg_type);

View file

@ -2516,7 +2516,7 @@ decode_constrained_packed_array (struct value *arr)
bounds may be variable and were not passed to that function. So, bounds may be variable and were not passed to that function. So,
we further resolve the array bounds here and then update the we further resolve the array bounds here and then update the
sizes. */ sizes. */
const gdb_byte *valaddr = value_contents_for_printing (arr).data (); const gdb_byte *valaddr = arr->contents_for_printing ().data ();
CORE_ADDR address = arr->address (); CORE_ADDR address = arr->address ();
gdb::array_view<const gdb_byte> view gdb::array_view<const gdb_byte> view
= gdb::make_array_view (valaddr, type->length ()); = gdb::make_array_view (valaddr, type->length ());
@ -2773,7 +2773,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
if (obj == NULL) if (obj == NULL)
src = valaddr + offset; src = valaddr + offset;
else else
src = value_contents (obj).data () + offset; src = obj->contents ().data () + offset;
if (is_dynamic_type (type)) if (is_dynamic_type (type))
{ {
@ -2823,7 +2823,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
else else
{ {
v = value::allocate (type); v = value::allocate (type);
src = value_contents (obj).data () + offset; src = obj->contents ().data () + offset;
} }
if (obj != NULL) if (obj != NULL)
@ -2916,13 +2916,13 @@ ada_value_assign (struct value *toval, struct value *fromval)
if (is_big_endian && is_scalar_type (fromval->type ())) if (is_big_endian && is_scalar_type (fromval->type ()))
from_offset = from_size - bits; from_offset = from_size - bits;
copy_bitwise (buffer, toval->bitpos (), copy_bitwise (buffer, toval->bitpos (),
value_contents (fromval).data (), from_offset, fromval->contents ().data (), from_offset,
bits, is_big_endian); bits, is_big_endian);
write_memory_with_notification (to_addr, buffer, len); write_memory_with_notification (to_addr, buffer, len);
val = value_copy (toval); val = value_copy (toval);
memcpy (val->contents_raw ().data (), memcpy (val->contents_raw ().data (),
value_contents (fromval).data (), fromval->contents ().data (),
type->length ()); type->length ());
val->deprecated_set_type (type); val->deprecated_set_type (type);
@ -2973,13 +2973,13 @@ value_assign_to_component (struct value *container, struct value *component,
copy_bitwise ((container->contents_writeable ().data () copy_bitwise ((container->contents_writeable ().data ()
+ offset_in_container), + offset_in_container),
container->bitpos () + bit_offset_in_container, container->bitpos () + bit_offset_in_container,
value_contents (val).data (), src_offset, bits, 1); val->contents ().data (), src_offset, bits, 1);
} }
else else
copy_bitwise ((container->contents_writeable ().data () copy_bitwise ((container->contents_writeable ().data ()
+ offset_in_container), + offset_in_container),
container->bitpos () + bit_offset_in_container, container->bitpos () + bit_offset_in_container,
value_contents (val).data (), 0, bits, 0); val->contents ().data (), 0, bits, 0);
} }
/* Determine if TYPE is an access to an unconstrained array. */ /* Determine if TYPE is an access to an unconstrained array. */
@ -4358,7 +4358,7 @@ ensure_lval (struct value *val)
VALUE_LVAL (val) = lval_memory; VALUE_LVAL (val) = lval_memory;
val->set_address (addr); val->set_address (addr);
write_memory (addr, value_contents (val).data (), len); write_memory (addr, val->contents ().data (), len);
} }
return val; return val;
@ -4529,7 +4529,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
actual_type = ada_check_typedef (actual->type ()); actual_type = ada_check_typedef (actual->type ());
val = value::allocate (actual_type); val = value::allocate (actual_type);
copy (value_contents (actual), val->contents_raw ()); copy (actual->contents (), val->contents_raw ());
actual = ensure_lval (val); actual = ensure_lval (val);
} }
result = value_addr (actual); result = value_addr (actual);
@ -6924,7 +6924,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno); int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno);
return ada_value_primitive_packed_val (arg1, return ada_value_primitive_packed_val (arg1,
value_contents (arg1).data (), arg1->contents ().data (),
offset + bit_pos / 8, offset + bit_pos / 8,
bit_pos % 8, bit_size, type); bit_pos % 8, bit_size, type);
} }
@ -8846,7 +8846,7 @@ ada_to_fixed_value_create (struct type *type0, CORE_ADDR address,
/* Our value does not live in memory; it could be a convenience /* Our value does not live in memory; it could be a convenience
variable, for instance. Create a not_lval value using val0's variable, for instance. Create a not_lval value using val0's
contents. */ contents. */
return value_from_contents (type, value_contents (val0).data ()); return value_from_contents (type, val0->contents ().data ());
} }
return value_from_contents_and_address (type, 0, address); return value_from_contents_and_address (type, 0, address);
@ -9290,7 +9290,7 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
struct value *elt = value_cast (elt_type, value_subscript (val, lo + i)); struct value *elt = value_cast (elt_type, value_subscript (val, lo + i));
int elt_len = elt_type->length (); int elt_len = elt_type->length ();
copy (value_contents_all (elt), res_contents.slice (elt_len * i, elt_len)); copy (elt->contents_all (), res_contents.slice (elt_len * i, elt_len));
} }
return res; return res;
@ -9436,8 +9436,8 @@ ada_value_equal (struct value *arg1, struct value *arg2)
representations use all bits (no padding or undefined bits) representations use all bits (no padding or undefined bits)
and do not have user-defined equality. */ and do not have user-defined equality. */
return (arg1_type->length () == arg2_type->length () return (arg1_type->length () == arg2_type->length ()
&& memcmp (value_contents (arg1).data (), && memcmp (arg1->contents ().data (),
value_contents (arg2).data (), arg2->contents ().data (),
arg1_type->length ()) == 0); arg1_type->length ()) == 0);
} }
return value_equal (arg1, arg2); return value_equal (arg1, arg2);

View file

@ -430,7 +430,7 @@ iterate_over_live_ada_tasks (ada_task_list_iterator_ftype iterator)
static void static void
value_as_string (char *dest, struct value *val, int length) value_as_string (char *dest, struct value *val, int length)
{ {
memcpy (dest, value_contents (val).data (), length); memcpy (dest, val->contents ().data (), length);
dest[length] = '\0'; dest[length] = '\0';
} }

View file

@ -759,7 +759,7 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct type *type = ada_check_typedef (val->type ()); struct type *type = ada_check_typedef (val->type ());
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
if (type->code () == TYPE_CODE_RANGE if (type->code () == TYPE_CODE_RANGE
&& (type->target_type ()->code () == TYPE_CODE_ENUM && (type->target_type ()->code () == TYPE_CODE_ENUM
@ -839,7 +839,7 @@ ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
} }
struct type *type = ada_check_typedef (value->type ()); struct type *type = ada_check_typedef (value->type ());
const gdb_byte *valaddr = value_contents_for_printing (value).data (); const gdb_byte *valaddr = value->contents_for_printing ().data ();
int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr; int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
len = type->num_fields (); len = type->num_fields ();
@ -907,7 +907,7 @@ ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
if (ada_is_string_type (type) if (ada_is_string_type (type)
&& (options->format == 0 || options->format == 's')) && (options->format == 0 || options->format == 's'))
{ {
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr; int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
ada_val_print_string (type, valaddr, offset_aligned, stream, recurse, ada_val_print_string (type, valaddr, offset_aligned, stream, recurse,
@ -922,7 +922,7 @@ ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
val_print_optimized_out (val, stream); val_print_optimized_out (val, stream);
else if (TYPE_FIELD_BITSIZE (type, 0) > 0) else if (TYPE_FIELD_BITSIZE (type, 0) > 0)
{ {
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr; int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
val_print_packed_array_elements (type, valaddr, offset_aligned, val_print_packed_array_elements (type, valaddr, offset_aligned,
stream, recurse, options); stream, recurse, options);
@ -1021,7 +1021,7 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
type = val->type (); type = val->type ();
struct type *saved_type = type; struct type *saved_type = type;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
CORE_ADDR address = val->address (); CORE_ADDR address = val->address ();
gdb::array_view<const gdb_byte> view gdb::array_view<const gdb_byte> view
= gdb::make_array_view (valaddr, type->length ()); = gdb::make_array_view (valaddr, type->length ());

View file

@ -253,7 +253,7 @@ alpha_register_to_value (frame_info_ptr frame, int regnum,
/* Convert to VALTYPE. */ /* Convert to VALTYPE. */
gdb_assert (valtype->length () == 4); gdb_assert (valtype->length () == 4);
alpha_sts (gdbarch, out, value_contents_all (value).data ()); alpha_sts (gdbarch, out, value->contents_all ().data ());
release_value (value); release_value (value);
return 1; return 1;
@ -360,7 +360,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp = (sp & -16) - 16; sp = (sp & -16) - 16;
/* Write the real data into the stack. */ /* Write the real data into the stack. */
write_memory (sp, value_contents (arg).data (), 16); write_memory (sp, arg->contents ().data (), 16);
/* Construct the indirection. */ /* Construct the indirection. */
arg_type = lookup_pointer_type (arg_type); arg_type = lookup_pointer_type (arg_type);
@ -381,7 +381,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp = (sp & -16) - 16; sp = (sp & -16) - 16;
/* Write the real data into the stack. */ /* Write the real data into the stack. */
write_memory (sp, value_contents (arg).data (), 32); write_memory (sp, arg->contents ().data (), 32);
/* Construct the indirection. */ /* Construct the indirection. */
arg_type = lookup_pointer_type (arg_type); arg_type = lookup_pointer_type (arg_type);
@ -395,7 +395,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
m_arg->len = arg_type->length (); m_arg->len = arg_type->length ();
m_arg->offset = accumulate_size; m_arg->offset = accumulate_size;
accumulate_size = (accumulate_size + m_arg->len + 7) & ~7; accumulate_size = (accumulate_size + m_arg->len + 7) & ~7;
m_arg->contents = value_contents (arg).data (); m_arg->contents = arg->contents ().data ();
} }
/* Determine required argument register loads, loading an argument register /* Determine required argument register loads, loading an argument register

View file

@ -995,7 +995,7 @@ if (return_method == return_method_struct)
else else
{ {
/* The argument will be passed in registers. */ /* The argument will be passed in registers. */
const gdb_byte *valbuf = value_contents (args[i]).data (); const gdb_byte *valbuf = args[i]->contents ().data ();
gdb_byte buf[8]; gdb_byte buf[8];
gdb_assert (len <= 16); gdb_assert (len <= 16);
@ -1047,7 +1047,7 @@ if (return_method == return_method_struct)
for (i = 0; i < num_stack_args; i++) for (i = 0; i < num_stack_args; i++)
{ {
struct type *type = stack_args[i]->type (); struct type *type = stack_args[i]->type ();
const gdb_byte *valbuf = value_contents (stack_args[i]).data (); const gdb_byte *valbuf = stack_args[i]->contents ().data ();
int len = type->length (); int len = type->length ();
write_memory (sp + element * 8, valbuf, len); write_memory (sp + element * 8, valbuf, len);

View file

@ -179,7 +179,7 @@ amd64_windows_adjust_args_passed_by_pointer (struct value **args,
if (amd64_windows_passed_by_pointer (args[i]->type ())) if (amd64_windows_passed_by_pointer (args[i]->type ()))
{ {
struct type *type = args[i]->type (); struct type *type = args[i]->type ();
const gdb_byte *valbuf = value_contents (args[i]).data (); const gdb_byte *valbuf = args[i]->contents ().data ();
const int len = type->length (); const int len = type->length ();
/* Store a copy of that argument on the stack, aligned to /* Store a copy of that argument on the stack, aligned to
@ -205,7 +205,7 @@ amd64_windows_store_arg_in_reg (struct regcache *regcache,
struct value *arg, int regno) struct value *arg, int regno)
{ {
struct type *type = arg->type (); struct type *type = arg->type ();
const gdb_byte *valbuf = value_contents (arg).data (); const gdb_byte *valbuf = arg->contents ().data ();
gdb_byte buf[8]; gdb_byte buf[8];
gdb_assert (type->length () <= 8); gdb_assert (type->length () <= 8);
@ -295,7 +295,7 @@ amd64_windows_push_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < num_stack_args; i++) for (i = 0; i < num_stack_args; i++)
{ {
struct type *type = stack_args[i]->type (); struct type *type = stack_args[i]->type ();
const gdb_byte *valbuf = value_contents (stack_args[i]).data (); const gdb_byte *valbuf = stack_args[i]->contents ().data ();
write_memory (sp + element * 8, valbuf, type->length ()); write_memory (sp + element * 8, valbuf, type->length ());
element += ((type->length () + 7) / 8); element += ((type->length () + 7) / 8);

View file

@ -779,9 +779,9 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
unsigned int len = args[i]->type ()->length (); unsigned int len = args[i]->type ()->length ();
unsigned int space = align_up (len, 4); unsigned int space = align_up (len, 4);
memcpy (data, value_contents (args[i]).data (), (size_t) len); memcpy (data, args[i]->contents ().data (), (size_t) len);
arc_debug_printf ("copying arg %d, val 0x%08x, len %d to mem", arc_debug_printf ("copying arg %d, val 0x%08x, len %d to mem",
i, *((int *) value_contents (args[i]).data ()), i, *((int *) args[i]->contents ().data ()),
len); len);
data += space; data += space;

View file

@ -4682,7 +4682,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
len = arg_type->length (); len = arg_type->length ();
target_type = arg_type->target_type (); target_type = arg_type->target_type ();
typecode = arg_type->code (); typecode = arg_type->code ();
val = value_contents (args[argnum]).data (); val = args[argnum]->contents ().data ();
align = type_align (arg_type); align = type_align (arg_type);
/* Round alignment up to a whole number of words. */ /* Round alignment up to a whole number of words. */

View file

@ -1299,7 +1299,7 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int j; int j;
struct value *arg = args[i]; struct value *arg = args[i];
struct type *type = check_typedef (arg->type ()); struct type *type = check_typedef (arg->type ());
const bfd_byte *contents = value_contents (arg).data (); const bfd_byte *contents = arg->contents ().data ();
int len = type->length (); int len = type->length ();
/* Calculate the potential last register needed. /* Calculate the potential last register needed.

View file

@ -530,7 +530,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
int container_len = align_up (arg_type->length (), 4); int container_len = align_up (arg_type->length (), 4);
sp -= container_len; sp -= container_len;
write_memory (sp, value_contents (args[i]).data (), container_len); write_memory (sp, args[i]->contents ().data (), container_len);
} }
/* Initialize R0, R1, and R2 to the first 3 words of parameters. */ /* Initialize R0, R1, and R2 to the first 3 words of parameters. */

View file

@ -1869,7 +1869,7 @@ extract_bitfield_from_watchpoint_value (struct watchpoint *w, struct value *val)
unpack_value_bitfield (bit_val, unpack_value_bitfield (bit_val,
w->val_bitpos, w->val_bitpos,
w->val_bitsize, w->val_bitsize,
value_contents_for_printing (val).data (), val->contents_for_printing ().data (),
val->offset (), val->offset (),
val); val);

View file

@ -301,7 +301,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
&& (*length < 0 || *length <= fetchlimit)) && (*length < 0 || *length <= fetchlimit))
{ {
int i; int i;
const gdb_byte *contents = value_contents (value).data (); const gdb_byte *contents = value->contents ().data ();
/* If a length is specified, use that. */ /* If a length is specified, use that. */
if (*length >= 0) if (*length >= 0)

View file

@ -237,7 +237,7 @@ c_value_print_array (struct value *val,
{ {
struct type *type = check_typedef (val->type ()); struct type *type = check_typedef (val->type ());
CORE_ADDR address = val->address (); CORE_ADDR address = val->address ();
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
struct type *unresolved_elttype = type->target_type (); struct type *unresolved_elttype = type->target_type ();
struct type *elttype = check_typedef (unresolved_elttype); struct type *elttype = check_typedef (unresolved_elttype);
@ -334,7 +334,7 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
} }
struct type *type = check_typedef (val->type ()); struct type *type = check_typedef (val->type ());
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
if (options->vtblprint && cp_is_vtbl_ptr_type (type)) if (options->vtblprint && cp_is_vtbl_ptr_type (type))
{ {
@ -375,7 +375,7 @@ c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
TYPE_CODE_PTR.) */ TYPE_CODE_PTR.) */
int offset = type->field (VTBL_FNADDR_OFFSET).loc_bitpos () / 8; int offset = type->field (VTBL_FNADDR_OFFSET).loc_bitpos () / 8;
struct type *field_type = type->field (VTBL_FNADDR_OFFSET).type (); struct type *field_type = type->field (VTBL_FNADDR_OFFSET).type ();
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type); CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);
print_function_pointer_address (options, type->arch (), addr, stream); print_function_pointer_address (options, type->arch (), addr, stream);
@ -406,7 +406,7 @@ c_value_print_int (struct value *val, struct ui_file *stream,
intended to be used as an integer or a character, print intended to be used as an integer or a character, print
the character equivalent as well. */ the character equivalent as well. */
struct type *type = val->type (); struct type *type = val->type ();
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
if (c_textual_element_type (type, options->format)) if (c_textual_element_type (type, options->format))
{ {
gdb_puts (" ", stream); gdb_puts (" ", stream);

View file

@ -2196,7 +2196,7 @@ setting_cmd (const char *fnname, struct cmd_list_element *showlist,
&& type0->code () != TYPE_CODE_STRING) && type0->code () != TYPE_CODE_STRING)
error (_("First argument of %s must be a string."), fnname); error (_("First argument of %s must be a string."), fnname);
const char *a0 = (const char *) value_contents (argv[0]).data (); const char *a0 = (const char *) argv[0]->contents ().data ();
cmd_list_element *cmd = lookup_cmd (&a0, showlist, "", NULL, -1, 0); cmd_list_element *cmd = lookup_cmd (&a0, showlist, "", NULL, -1, 0);
if (cmd == nullptr || cmd->type != show_cmd) if (cmd == nullptr || cmd->type != show_cmd)

View file

@ -224,7 +224,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
/* Have everything. Open/write the data. */ /* Have everything. Open/write the data. */
if (file_format == NULL || strcmp (file_format, "binary") == 0) if (file_format == NULL || strcmp (file_format, "binary") == 0)
dump_binary_file (filename.get (), mode, value_contents (val).data (), dump_binary_file (filename.get (), mode, val->contents ().data (),
val->type ()->length ()); val->type ()->length ());
else else
{ {
@ -241,7 +241,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
} }
dump_bfd_file (filename.get (), mode, file_format, vaddr, dump_bfd_file (filename.get (), mode, file_format, vaddr,
value_contents (val).data (), val->contents ().data (),
val->type ()->length ()); val->type ()->length ());
} }
} }

View file

@ -585,7 +585,7 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
inferior_addr = regs_base + reg_offset; inferior_addr = regs_base + reg_offset;
if (0 != target_write_memory (inferior_addr, if (0 != target_write_memory (inferior_addr,
value_contents (regval).data (), regval->contents ().data (),
reg_size)) reg_size))
error (_("Cannot write register \"%s\" to inferior memory at %s."), error (_("Cannot write register \"%s\" to inferior memory at %s."),
reg_name, paddress (gdbarch, inferior_addr)); reg_name, paddress (gdbarch, inferior_addr));

View file

@ -189,7 +189,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype); vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype);
for (i = n_baseclasses; i < len; i++) for (i = n_baseclasses; i < len; i++)
{ {
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
/* If requested, skip printing of static fields. */ /* If requested, skip printing of static fields. */
if (!options->static_field_print if (!options->static_field_print
@ -395,7 +395,7 @@ cp_print_value (struct value *val, struct ui_file *stream,
= (struct type **) obstack_next_free (&dont_print_vb_obstack); = (struct type **) obstack_next_free (&dont_print_vb_obstack);
struct obstack tmp_obstack = dont_print_vb_obstack; struct obstack tmp_obstack = dont_print_vb_obstack;
int i, n_baseclasses = TYPE_N_BASECLASSES (type); int i, n_baseclasses = TYPE_N_BASECLASSES (type);
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
if (dont_print_vb == 0) if (dont_print_vb == 0)
{ {

View file

@ -822,7 +822,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int i; int i;
len = args[argnum]->type ()->length (); len = args[argnum]->type ()->length ();
val = value_contents (args[argnum]).data (); val = args[argnum]->contents ().data ();
/* How may registers worth of storage do we need for this argument? */ /* How may registers worth of storage do we need for this argument? */
reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0); reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);

View file

@ -808,7 +808,7 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
arg_type = check_typedef (args[argnum]->type ()); arg_type = check_typedef (args[argnum]->type ());
len = arg_type->length (); len = arg_type->length ();
val = value_contents (args[argnum]).data (); val = args[argnum]->contents ().data ();
/* Copy the argument to argument registers or the dummy stack. /* Copy the argument to argument registers or the dummy stack.
Large arguments are split between registers and stack. Large arguments are split between registers and stack.

View file

@ -48,7 +48,7 @@ dynamic_array_type (struct type *type,
struct type *ptr_type; struct type *ptr_type;
struct value *ival; struct value *ival;
int length; int length;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
length = unpack_field_as_long (type, valaddr + embedded_offset, 0); length = unpack_field_as_long (type, valaddr + embedded_offset, 0);

View file

@ -156,7 +156,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
gdb_assert (!check_optimized || from == nullptr); gdb_assert (!check_optimized || from == nullptr);
if (from != nullptr) if (from != nullptr)
{ {
from_contents = value_contents (from).data (); from_contents = from->contents ().data ();
v_contents = nullptr; v_contents = nullptr;
} }
else else
@ -377,7 +377,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
bits_to_skip += p->offset; bits_to_skip += p->offset;
copy_bitwise (v_contents, offset, copy_bitwise (v_contents, offset,
value_contents_all (p->v.value).data (), p->v.value->contents_all ().data (),
bits_to_skip, bits_to_skip,
this_size_bits, bits_big_endian); this_size_bits, bits_big_endian);
} }
@ -560,7 +560,7 @@ indirect_pieced_value (value *value)
encode address spaces and other things in CORE_ADDR. */ encode address spaces and other things in CORE_ADDR. */
bfd_endian byte_order = gdbarch_byte_order (get_frame_arch (frame)); bfd_endian byte_order = gdbarch_byte_order (get_frame_arch (frame));
LONGEST byte_offset LONGEST byte_offset
= extract_signed_integer (value_contents (value), byte_order); = extract_signed_integer (value->contents (), byte_order);
byte_offset += piece->v.ptr.offset; byte_offset += piece->v.ptr.offset;
return indirect_synthetic_pointer (piece->v.ptr.die_sect_off, return indirect_synthetic_pointer (piece->v.ptr.die_sect_off,
@ -1025,7 +1025,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG) if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
subobj_offset += n - max; subobj_offset += n - max;
copy (value_contents_all (val).slice (subobj_offset, len), copy (val->contents_all ().slice (subobj_offset, len),
retval->contents_raw ()); retval->contents_raw ());
} }
break; break;
@ -1145,7 +1145,7 @@ dwarf_expr_context::fetch_address (int n)
ULONGEST result; ULONGEST result;
dwarf_require_integral (result_val->type ()); dwarf_require_integral (result_val->type ());
result = extract_unsigned_integer (value_contents (result_val), byte_order); result = extract_unsigned_integer (result_val->contents (), byte_order);
/* For most architectures, calling extract_unsigned_integer() alone /* For most architectures, calling extract_unsigned_integer() alone
is sufficient for extracting an address. However, some is sufficient for extracting an address. However, some
@ -2351,7 +2351,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
else else
result_val result_val
= value_from_contents (type, = value_from_contents (type,
value_contents_all (result_val).data ()); result_val->contents_all ().data ());
} }
break; break;

View file

@ -2418,7 +2418,7 @@ array_operation::evaluate_struct_tuple (struct value *struct_val,
modify_field (struct_type, addr, modify_field (struct_type, addr,
value_as_long (val), bitpos % 8, bitsize); value_as_long (val), bitpos % 8, bitsize);
else else
memcpy (addr, value_contents (val).data (), memcpy (addr, val->contents ().data (),
val->type ()->length ()); val->type ()->length ());
} }
@ -2475,7 +2475,7 @@ array_operation::evaluate (struct type *expect_type,
error (_("Too many array elements")); error (_("Too many array elements"));
memcpy (array->contents_raw ().data () memcpy (array->contents_raw ().data ()
+ (index - low_bound) * element_size, + (index - low_bound) * element_size,
value_contents (element).data (), element->contents ().data (),
element_size); element_size);
index++; index++;
} }

View file

@ -778,7 +778,7 @@ eval_op_f_abs (struct type *expect_type, struct expression *exp,
case TYPE_CODE_FLT: case TYPE_CODE_FLT:
{ {
double d double d
= fabs (target_float_to_host_double (value_contents (arg1).data (), = fabs (target_float_to_host_double (arg1->contents ().data (),
arg1->type ())); arg1->type ()));
return value_from_host_double (type, d); return value_from_host_double (type, d);
} }
@ -808,10 +808,10 @@ eval_op_f_mod (struct type *expect_type, struct expression *exp,
case TYPE_CODE_FLT: case TYPE_CODE_FLT:
{ {
double d1 double d1
= target_float_to_host_double (value_contents (arg1).data (), = target_float_to_host_double (arg1->contents ().data (),
arg1->type ()); arg1->type ());
double d2 double d2
= target_float_to_host_double (value_contents (arg2).data (), = target_float_to_host_double (arg2->contents ().data (),
arg2->type ()); arg2->type ());
double d3 = fmod (d1, d2); double d3 = fmod (d1, d2);
return value_from_host_double (type, d3); return value_from_host_double (type, d3);
@ -838,7 +838,7 @@ fortran_ceil_operation (value *arg1, type *result_type)
{ {
if (arg1->type ()->code () != TYPE_CODE_FLT) if (arg1->type ()->code () != TYPE_CODE_FLT)
error (_("argument to CEILING must be of type float")); error (_("argument to CEILING must be of type float"));
double val = target_float_to_host_double (value_contents (arg1).data (), double val = target_float_to_host_double (arg1->contents ().data (),
arg1->type ()); arg1->type ());
val = ceil (val); val = ceil (val);
return value_from_longest (result_type, val); return value_from_longest (result_type, val);
@ -877,7 +877,7 @@ fortran_floor_operation (value *arg1, type *result_type)
{ {
if (arg1->type ()->code () != TYPE_CODE_FLT) if (arg1->type ()->code () != TYPE_CODE_FLT)
error (_("argument to FLOOR must be of type float")); error (_("argument to FLOOR must be of type float"));
double val = target_float_to_host_double (value_contents (arg1).data (), double val = target_float_to_host_double (arg1->contents ().data (),
arg1->type ()); arg1->type ());
val = floor (val); val = floor (val);
return value_from_longest (result_type, val); return value_from_longest (result_type, val);
@ -933,10 +933,10 @@ eval_op_f_modulo (struct type *expect_type, struct expression *exp,
case TYPE_CODE_FLT: case TYPE_CODE_FLT:
{ {
double a double a
= target_float_to_host_double (value_contents (arg1).data (), = target_float_to_host_double (arg1->contents ().data (),
arg1->type ()); arg1->type ());
double p double p
= target_float_to_host_double (value_contents (arg2).data (), = target_float_to_host_double (arg2->contents ().data (),
arg2->type ()); arg2->type ());
double result = fmod (a, p); double result = fmod (a, p);
if (result != 0 && (a < 0.0) != (p < 0.0)) if (result != 0 && (a < 0.0) != (p < 0.0))
@ -1473,7 +1473,7 @@ fortran_undetermined::value_subarray (value *array,
array->address () + total_offset); array->address () + total_offset);
else else
array = value_from_contents_and_address array = value_from_contents_and_address
(array_slice_type, value_contents (array).data () + total_offset, (array_slice_type, array->contents ().data () + total_offset,
array->address () + total_offset); array->address () + total_offset);
} }
else if (!array->lazy ()) else if (!array->lazy ())
@ -1631,7 +1631,7 @@ fortran_structop_operation::evaluate (struct type *expect_type,
struct type *elt_type = elt->type (); struct type *elt_type = elt->type ();
if (is_dynamic_type (elt_type)) if (is_dynamic_type (elt_type))
{ {
const gdb_byte *valaddr = value_contents_for_printing (elt).data (); const gdb_byte *valaddr = elt->contents_for_printing ().data ();
CORE_ADDR address = elt->address (); CORE_ADDR address = elt->address ();
gdb::array_view<const gdb_byte> view gdb::array_view<const gdb_byte> view
= gdb::make_array_view (valaddr, elt_type->length ()); = gdb::make_array_view (valaddr, elt_type->length ());
@ -1878,9 +1878,9 @@ fortran_argument_convert (struct value *value, bool is_artificial)
const int length = type->length (); const int length = type->length ();
const CORE_ADDR addr const CORE_ADDR addr
= value_as_long (value_allocate_space_in_inferior (length)); = value_as_long (value_allocate_space_in_inferior (length));
write_memory (addr, value_contents (value).data (), length); write_memory (addr, value->contents ().data (), length);
struct value *val = value_from_contents_and_address struct value *val = value_from_contents_and_address
(type, value_contents (value).data (), addr); (type, value->contents ().data (), addr);
return value_addr (val); return value_addr (val);
} }
else else

View file

@ -456,7 +456,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
struct type *elttype; struct type *elttype;
CORE_ADDR addr; CORE_ADDR addr;
int index; int index;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
const CORE_ADDR address = val->address (); const CORE_ADDR address = val->address ();
switch (type->code ()) switch (type->code ())

View file

@ -185,7 +185,7 @@ parse_find_args (const char *args, ULONGEST *max_countp,
} }
else else
{ {
const gdb_byte *contents = value_contents (v).data (); const gdb_byte *contents = v->contents ().data ();
pattern_buf.insert (pattern_buf.end (), contents, pattern_buf.insert (pattern_buf.end (), contents,
contents + t->length ()); contents + t->length ());
} }

View file

@ -1201,7 +1201,7 @@ frame_register_unwind (frame_info_ptr next_frame, int regnum,
if (bufferp) if (bufferp)
{ {
if (!*optimizedp && !*unavailablep) if (!*optimizedp && !*unavailablep)
memcpy (bufferp, value_contents_all (value).data (), memcpy (bufferp, value->contents_all ().data (),
value->type ()->length ()); value->type ()->length ());
else else
memset (bufferp, 0, value->type ()->length ()); memset (bufferp, 0, value->type ()->length ());
@ -1311,7 +1311,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
else else
{ {
int i; int i;
gdb::array_view<const gdb_byte> buf = value_contents (value); gdb::array_view<const gdb_byte> buf = value->contents ();
gdb_printf (&debug_file, " bytes="); gdb_printf (&debug_file, " bytes=");
gdb_printf (&debug_file, "["); gdb_printf (&debug_file, "[");
@ -1353,7 +1353,7 @@ frame_unwind_register_signed (frame_info_ptr next_frame, int regnum)
_("Register %d is not available"), regnum); _("Register %d is not available"), regnum);
} }
LONGEST r = extract_signed_integer (value_contents_all (value), byte_order); LONGEST r = extract_signed_integer (value->contents_all (), byte_order);
release_value (value); release_value (value);
return r; return r;
@ -1386,7 +1386,7 @@ frame_unwind_register_unsigned (frame_info_ptr next_frame, int regnum)
_("Register %d is not available"), regnum); _("Register %d is not available"), regnum);
} }
ULONGEST r = extract_unsigned_integer (value_contents_all (value).data (), ULONGEST r = extract_unsigned_integer (value->contents_all ().data (),
size, byte_order); size, byte_order);
release_value (value); release_value (value);
@ -1412,7 +1412,7 @@ read_frame_register_unsigned (frame_info_ptr frame, int regnum,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, VALUE_REGNUM (regval)); int size = register_size (gdbarch, VALUE_REGNUM (regval));
*val = extract_unsigned_integer (value_contents (regval).data (), size, *val = extract_unsigned_integer (regval->contents ().data (), size,
byte_order); byte_order);
return true; return true;
} }
@ -1546,7 +1546,7 @@ get_frame_register_bytes (frame_info_ptr frame, int regnum,
return false; return false;
} }
memcpy (myaddr, value_contents_all (value).data () + offset, memcpy (myaddr, value->contents_all ().data () + offset,
curr_len); curr_len);
release_value (value); release_value (value);
} }

View file

@ -1251,7 +1251,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* The FDPIC ABI requires function descriptors to be passed instead /* The FDPIC ABI requires function descriptors to be passed instead
of entry points. */ of entry points. */
CORE_ADDR addr = extract_unsigned_integer CORE_ADDR addr = extract_unsigned_integer
(value_contents (arg).data (), 4, byte_order); (arg->contents ().data (), 4, byte_order);
addr = find_func_descr (gdbarch, addr); addr = find_func_descr (gdbarch, addr);
store_unsigned_integer (valbuf, 4, byte_order, addr); store_unsigned_integer (valbuf, 4, byte_order, addr);
typecode = TYPE_CODE_PTR; typecode = TYPE_CODE_PTR;
@ -1260,7 +1260,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
} }
else else
{ {
val = value_contents (arg).data (); val = arg->contents ().data ();
} }
while (len > 0) while (len > 0)

View file

@ -4007,7 +4007,7 @@ is_unique_ancestor (struct type *base, struct value *val)
int offset = -1; int offset = -1;
return is_unique_ancestor_worker (base, val->type (), &offset, return is_unique_ancestor_worker (base, val->type (), &offset,
value_contents_for_printing (val).data (), val->contents_for_printing ().data (),
val->embedded_offset (), val->embedded_offset (),
val->address (), val) == 1; val->address (), val) == 1;
} }

View file

@ -734,7 +734,7 @@ static struct value *
gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr) gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
{ {
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
const gdb_byte *contents = value_contents (method_ptr).data (); const gdb_byte *contents = method_ptr->contents ().data ();
CORE_ADDR ptr_value; CORE_ADDR ptr_value;
struct type *self_type, *final_type, *method_type; struct type *self_type, *final_type, *method_type;
LONGEST adjustment; LONGEST adjustment;

View file

@ -52,7 +52,7 @@ print_go_string (struct type *type,
unpack_value_field_as_pointer. Do this until we can get unpack_value_field_as_pointer. Do this until we can get
unpack_value_field_as_pointer. */ unpack_value_field_as_pointer. */
LONGEST addr; LONGEST addr;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
if (! unpack_value_field_as_long (type, valaddr, embedded_offset, 0, if (! unpack_value_field_as_long (type, valaddr, embedded_offset, 0,

View file

@ -828,7 +828,7 @@ gdbscm_value_to_bytevector (SCM self)
{ {
type = check_typedef (type); type = check_typedef (type);
length = type->length (); length = type->length ();
contents = value_contents (value).data (); contents = value->contents ().data ();
} }
catch (const gdb_exception &except) catch (const gdb_exception &except)
{ {
@ -978,7 +978,7 @@ gdbscm_value_to_real (SCM self)
{ {
if (is_floating_value (value)) if (is_floating_value (value))
{ {
d = target_float_to_host_double (value_contents (value).data (), d = target_float_to_host_double (value->contents ().data (),
type); type);
check = value_from_host_double (type, d); check = value_from_host_double (type, d);
} }

View file

@ -647,7 +647,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
struct type *type = args[argument]->type (); struct type *type = args[argument]->type ();
int len = type->length (); int len = type->length ();
char *contents = (char *) value_contents (args[argument]).data (); char *contents = (char *) args[argument]->contents ().data ();
/* Pad the argument appropriately. */ /* Pad the argument appropriately. */
int padded_len = align_up (len, wordsize); int padded_len = align_up (len, wordsize);

View file

@ -745,7 +745,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct_ptr += align_up (type->length (), 8); struct_ptr += align_up (type->length (), 8);
if (write_pass) if (write_pass)
write_memory (struct_end - struct_ptr, write_memory (struct_end - struct_ptr,
value_contents (arg).data (), type->length ()); arg->contents ().data (), type->length ());
store_unsigned_integer (param_val, 4, byte_order, store_unsigned_integer (param_val, 4, byte_order,
struct_end - struct_ptr); struct_end - struct_ptr);
} }
@ -757,13 +757,13 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
param_len = align_up (type->length (), 4); param_len = align_up (type->length (), 4);
store_unsigned_integer store_unsigned_integer
(param_val, param_len, byte_order, (param_val, param_len, byte_order,
unpack_long (type, value_contents (arg).data ())); unpack_long (type, arg->contents ().data ()));
} }
else if (type->code () == TYPE_CODE_FLT) else if (type->code () == TYPE_CODE_FLT)
{ {
/* Floating point value store, right aligned. */ /* Floating point value store, right aligned. */
param_len = align_up (type->length (), 4); param_len = align_up (type->length (), 4);
memcpy (param_val, value_contents (arg).data (), param_len); memcpy (param_val, arg->contents ().data (), param_len);
} }
else else
{ {
@ -771,7 +771,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Small struct value are stored right-aligned. */ /* Small struct value are stored right-aligned. */
memcpy (param_val + param_len - type->length (), memcpy (param_val + param_len - type->length (),
value_contents (arg).data (), type->length ()); arg->contents ().data (), type->length ());
/* Structures of size 5, 6 and 7 bytes are special in that /* Structures of size 5, 6 and 7 bytes are special in that
the higher-ordered word is stored in the lower-ordered the higher-ordered word is stored in the lower-ordered
@ -1027,7 +1027,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
the right halves of the floating point registers; the right halves of the floating point registers;
the left halves are unused." */ the left halves are unused." */
regcache->cooked_write_part (regnum, offset % 8, len, regcache->cooked_write_part (regnum, offset % 8, len,
value_contents (arg).data ()); arg->contents ().data ());
} }
} }
} }
@ -1051,7 +1051,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
ULONGEST codeptr, fptr; ULONGEST codeptr, fptr;
codeptr = unpack_long (type, value_contents (arg).data ()); codeptr = unpack_long (type, arg->contents ().data ());
fptr = hppa64_convert_code_addr_to_fptr (gdbarch, codeptr); fptr = hppa64_convert_code_addr_to_fptr (gdbarch, codeptr);
store_unsigned_integer (fptrbuf, type->length (), byte_order, store_unsigned_integer (fptrbuf, type->length (), byte_order,
fptr); fptr);
@ -1059,7 +1059,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
} }
else else
{ {
valbuf = value_contents (arg).data (); valbuf = arg->contents ().data ();
} }
/* Always store the argument in memory. */ /* Always store the argument in memory. */
@ -2722,7 +2722,7 @@ hppa_frame_prev_register_helper (frame_info_ptr this_frame,
trad_frame_get_prev_register (this_frame, saved_regs, trad_frame_get_prev_register (this_frame, saved_regs,
HPPA_PCOQ_HEAD_REGNUM); HPPA_PCOQ_HEAD_REGNUM);
pc = extract_unsigned_integer (value_contents_all (pcoq_val).data (), pc = extract_unsigned_integer (pcoq_val->contents_all ().data (),
size, byte_order); size, byte_order);
return frame_unwind_got_constant (this_frame, regnum, pc + 4); return frame_unwind_got_constant (this_frame, regnum, pc + 4);
} }

View file

@ -189,7 +189,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
if (write_pass) if (write_pass)
{ {
const gdb_byte *val = value_contents_all (args[i]).data (); const gdb_byte *val = args[i]->contents_all ().data ();
regcache->raw_write (I387_MM0_REGNUM(tdep) + num_m128, val); regcache->raw_write (I387_MM0_REGNUM(tdep) + num_m128, val);
} }
num_m128++; num_m128++;
@ -200,7 +200,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
i386_darwin_arg_type_alignment (arg_type)); i386_darwin_arg_type_alignment (arg_type));
if (write_pass) if (write_pass)
write_memory (sp + args_space, write_memory (sp + args_space,
value_contents_all (args[i]).data (), args[i]->contents_all ().data (),
arg_type->length ()); arg_type->length ());
/* The System V ABI says that: /* The System V ABI says that:

View file

@ -2733,7 +2733,7 @@ i386_thiscall_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
args_space_used = align_up (args_space_used, 16); args_space_used = align_up (args_space_used, 16);
write_memory (sp + args_space_used, write_memory (sp + args_space_used,
value_contents_all (args[i]).data (), len); args[i]->contents_all ().data (), len);
/* The System V ABI says that: /* The System V ABI says that:
"An argument's size is increased, if necessary, to make it a "An argument's size is increased, if necessary, to make it a
@ -2778,7 +2778,7 @@ i386_thiscall_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* The 'this' pointer needs to be in ECX. */ /* The 'this' pointer needs to be in ECX. */
if (thiscall) if (thiscall)
regcache->cooked_write (I386_ECX_REGNUM, regcache->cooked_write (I386_ECX_REGNUM,
value_contents_all (args[0]).data ()); args[0]->contents_all ().data ());
/* If the PLT is position-independent, the SYSTEM V ABI requires %ebx to be /* If the PLT is position-independent, the SYSTEM V ABI requires %ebx to be
set to the address of the GOT when doing a call to a PLT address. set to the address of the GOT when doing a call to a PLT address.

View file

@ -284,7 +284,7 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
if (value_entirely_available (regval)) if (value_entirely_available (regval))
{ {
const gdb_byte *raw = value_contents (regval).data (); const gdb_byte *raw = regval->contents ().data ();
gdb_puts ("0x", file); gdb_puts ("0x", file);
for (i = 9; i >= 0; i--) for (i = 9; i >= 0; i--)

View file

@ -1934,7 +1934,7 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
that frame by adding the size of output: that frame by adding the size of output:
(sof (size of frame) - sol (size of locals)). */ (sof (size of frame) - sol (size of locals)). */
val = ia64_frame_prev_register (this_frame, this_cache, IA64_CFM_REGNUM); val = ia64_frame_prev_register (this_frame, this_cache, IA64_CFM_REGNUM);
prev_cfm = extract_unsigned_integer (value_contents_all (val).data (), prev_cfm = extract_unsigned_integer (val->contents_all ().data (),
8, byte_order); 8, byte_order);
bsp = rse_address_add (cache->bsp, -(cache->sof)); bsp = rse_address_add (cache->bsp, -(cache->sof));
prev_bsp = prev_bsp =
@ -1984,7 +1984,7 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
/* Adjust the register number to account for register rotation. */ /* Adjust the register number to account for register rotation. */
regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48; regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
} }
prN = extract_bit_field (value_contents_all (pr_val).data (), prN = extract_bit_field (pr_val->contents_all ().data (),
regnum - VP0_REGNUM, 1); regnum - VP0_REGNUM, 1);
return frame_unwind_got_constant (this_frame, regnum, prN); return frame_unwind_got_constant (this_frame, regnum, prN);
} }
@ -1995,7 +1995,7 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
ULONGEST unatN; ULONGEST unatN;
unat_val = ia64_frame_prev_register (this_frame, this_cache, unat_val = ia64_frame_prev_register (this_frame, this_cache,
IA64_UNAT_REGNUM); IA64_UNAT_REGNUM);
unatN = extract_bit_field (value_contents_all (unat_val).data (), unatN = extract_bit_field (unat_val->contents_all ().data (),
regnum - IA64_NAT0_REGNUM, 1); regnum - IA64_NAT0_REGNUM, 1);
return frame_unwind_got_constant (this_frame, regnum, unatN); return frame_unwind_got_constant (this_frame, regnum, unatN);
} }
@ -2118,11 +2118,11 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
reg_val = ia64_frame_prev_register (this_frame, this_cache, reg_val = ia64_frame_prev_register (this_frame, this_cache,
IA64_CFM_REGNUM); IA64_CFM_REGNUM);
prev_cfm = extract_unsigned_integer prev_cfm = extract_unsigned_integer
(value_contents_all (reg_val).data (), 8, byte_order); (reg_val->contents_all ().data (), 8, byte_order);
reg_val = ia64_frame_prev_register (this_frame, this_cache, reg_val = ia64_frame_prev_register (this_frame, this_cache,
IA64_BSP_REGNUM); IA64_BSP_REGNUM);
prev_bsp = extract_unsigned_integer prev_bsp = extract_unsigned_integer
(value_contents_all (reg_val).data (), 8, byte_order); (reg_val->contents_all ().data (), 8, byte_order);
prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f)); prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f));
addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM)); addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM));
@ -2957,7 +2957,7 @@ ia64_libunwind_frame_prev_register (frame_info_ptr this_frame,
/* Adjust the register number to account for register rotation. */ /* Adjust the register number to account for register rotation. */
regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48; regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
} }
prN_val = extract_bit_field (value_contents_all (val).data (), prN_val = extract_bit_field (val->contents_all ().data (),
regnum - VP0_REGNUM, 1); regnum - VP0_REGNUM, 1);
return frame_unwind_got_constant (this_frame, regnum, prN_val); return frame_unwind_got_constant (this_frame, regnum, prN_val);
} }
@ -2966,7 +2966,7 @@ ia64_libunwind_frame_prev_register (frame_info_ptr this_frame,
{ {
ULONGEST unatN_val; ULONGEST unatN_val;
unatN_val = extract_bit_field (value_contents_all (val).data (), unatN_val = extract_bit_field (val->contents_all ().data (),
regnum - IA64_NAT0_REGNUM, 1); regnum - IA64_NAT0_REGNUM, 1);
return frame_unwind_got_constant (this_frame, regnum, unatN_val); return frame_unwind_got_constant (this_frame, regnum, unatN_val);
} }
@ -2981,11 +2981,11 @@ ia64_libunwind_frame_prev_register (frame_info_ptr this_frame,
register will be if we pop the frame back which is why we might register will be if we pop the frame back which is why we might
have been called. We know that libunwind will pass us back the have been called. We know that libunwind will pass us back the
beginning of the current frame so we should just add sof to it. */ beginning of the current frame so we should just add sof to it. */
prev_bsp = extract_unsigned_integer (value_contents_all (val).data (), prev_bsp = extract_unsigned_integer (val->contents_all ().data (),
8, byte_order); 8, byte_order);
cfm_val = libunwind_frame_prev_register (this_frame, this_cache, cfm_val = libunwind_frame_prev_register (this_frame, this_cache,
IA64_CFM_REGNUM); IA64_CFM_REGNUM);
prev_cfm = extract_unsigned_integer (value_contents_all (cfm_val).data (), prev_cfm = extract_unsigned_integer (cfm_val->contents_all ().data (),
8, byte_order); 8, byte_order);
prev_bsp = rse_address_add (prev_bsp, (prev_cfm & 0x7f)); prev_bsp = rse_address_add (prev_bsp, (prev_cfm & 0x7f));
@ -3068,7 +3068,7 @@ ia64_libunwind_sigtramp_frame_prev_register (frame_info_ptr this_frame,
method of getting previous registers. */ method of getting previous registers. */
prev_ip_val = libunwind_frame_prev_register (this_frame, this_cache, prev_ip_val = libunwind_frame_prev_register (this_frame, this_cache,
IA64_IP_REGNUM); IA64_IP_REGNUM);
prev_ip = extract_unsigned_integer (value_contents_all (prev_ip_val).data (), prev_ip = extract_unsigned_integer (prev_ip_val->contents_all ().data (),
8, byte_order); 8, byte_order);
if (prev_ip == 0) if (prev_ip == 0)
@ -3750,7 +3750,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
gdb_byte val_buf[8]; gdb_byte val_buf[8];
ULONGEST faddr = extract_unsigned_integer ULONGEST faddr = extract_unsigned_integer
(value_contents (arg).data (), 8, byte_order); (arg->contents ().data (), 8, byte_order);
store_unsigned_integer (val_buf, 8, byte_order, store_unsigned_integer (val_buf, 8, byte_order,
find_func_descr (regcache, faddr, find_func_descr (regcache, faddr,
&funcdescaddr)); &funcdescaddr));
@ -3782,7 +3782,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
This is why we use store_unsigned_integer. */ This is why we use store_unsigned_integer. */
store_unsigned_integer store_unsigned_integer
(val_buf, 8, byte_order, (val_buf, 8, byte_order,
extract_unsigned_integer (value_contents (arg).data (), len, extract_unsigned_integer (arg->contents ().data (), len,
byte_order)); byte_order));
} }
else else
@ -3796,7 +3796,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
In this case, the data is Byte0-aligned. Happy news, In this case, the data is Byte0-aligned. Happy news,
this means that we don't need to differentiate the this means that we don't need to differentiate the
handling of 8byte blocks and less-than-8bytes blocks. */ handling of 8byte blocks and less-than-8bytes blocks. */
memcpy (val_buf, value_contents (arg).data () + argoffset, memcpy (val_buf, arg->contents ().data () + argoffset,
(len > 8) ? 8 : len); (len > 8) ? 8 : len);
} }
@ -3820,7 +3820,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
while (len > 0 && floatreg < IA64_FR16_REGNUM) while (len > 0 && floatreg < IA64_FR16_REGNUM)
{ {
gdb_byte to[IA64_FP_REGISTER_SIZE]; gdb_byte to[IA64_FP_REGISTER_SIZE];
target_float_convert (value_contents (arg).data () + argoffset, target_float_convert (arg->contents ().data () + argoffset,
float_elt_type, to, float_elt_type, to,
ia64_ext_type (gdbarch)); ia64_ext_type (gdbarch));
regcache->cooked_write (floatreg, to); regcache->cooked_write (floatreg, to);

View file

@ -1130,7 +1130,7 @@ call_function_by_hand_dummy (struct value *function,
if (info.trivially_copy_constructible) if (info.trivially_copy_constructible)
{ {
int length = param_type->length (); int length = param_type->length ();
write_memory (addr, value_contents (args[i]).data (), length); write_memory (addr, args[i]->contents ().data (), length);
} }
else else
{ {

View file

@ -2181,7 +2181,7 @@ default_print_one_register_info (struct ui_file *file,
|| regtype->code () == TYPE_CODE_DECFLOAT) || regtype->code () == TYPE_CODE_DECFLOAT)
{ {
struct value_print_options opts; struct value_print_options opts;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
enum bfd_endian byte_order = type_byte_order (regtype); enum bfd_endian byte_order = type_byte_order (regtype);
get_user_print_options (&opts); get_user_print_options (&opts);

View file

@ -711,7 +711,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
type = args[i]->type (); type = args[i]->type ();
typelen = type->length (); typelen = type->length ();
val = value_contents (args[i]).data (); val = args[i]->contents ().data ();
if (typelen <= 4) if (typelen <= 4)
{ {
/* Char, short, int, float, pointer, and structs <= four bytes. */ /* Char, short, int, float, pointer, and structs <= four bytes. */

View file

@ -260,7 +260,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* FIXME: Handle structures. */ /* FIXME: Handle structures. */
contents = (gdb_byte *) value_contents (arg).data (); contents = (gdb_byte *) arg->contents ().data ();
val = extract_unsigned_integer (contents, arg_type->length (), val = extract_unsigned_integer (contents, arg_type->length (),
byte_order); byte_order);

View file

@ -565,7 +565,7 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
for (int i = 0; i < nargs; i++) for (int i = 0; i < nargs; i++)
{ {
struct value *arg = args[i]; struct value *arg = args[i];
const gdb_byte *val = value_contents (arg).data (); const gdb_byte *val = arg->contents ().data ();
struct type *type = check_typedef (arg->type ()); struct type *type = check_typedef (arg->type ());
size_t len = type->length (); size_t len = type->length ();
int align = type_align (type); int align = type_align (type);

View file

@ -165,7 +165,7 @@ m2_print_unbounded_array (struct value *value,
struct value *val; struct value *val;
struct type *type = check_typedef (value->type ()); struct type *type = check_typedef (value->type ());
const gdb_byte *valaddr = value_contents_for_printing (value).data (); const gdb_byte *valaddr = value->contents_for_printing ().data ();
addr = unpack_pointer (type->field (0).type (), addr = unpack_pointer (type->field (0).type (),
(type->field (0).loc_bitpos () / 8) + (type->field (0).loc_bitpos () / 8) +
@ -305,7 +305,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
unsigned len; unsigned len;
struct type *elttype; struct type *elttype;
CORE_ADDR addr; CORE_ADDR addr;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
const CORE_ADDR address = val->address (); const CORE_ADDR address = val->address ();
struct type *type = check_typedef (val->type ()); struct type *type = check_typedef (val->type ());

View file

@ -2061,7 +2061,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = nargs - 1; i >= 0; i--) for (i = nargs - 1; i >= 0; i--)
{ {
struct value *arg = args[i]; struct value *arg = args[i];
const gdb_byte *arg_bits = value_contents (arg).data (); const gdb_byte *arg_bits = arg->contents ().data ();
struct type *arg_type = arg->type (); struct type *arg_type = arg->type ();
ULONGEST arg_size = arg_type->length (); ULONGEST arg_size = arg_type->length ();

View file

@ -707,11 +707,11 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
/* Value gets right-justified in the register or stack word. */ /* Value gets right-justified in the register or stack word. */
memcpy (valbuf + (register_size (gdbarch, argreg) - len), memcpy (valbuf + (register_size (gdbarch, argreg) - len),
(gdb_byte *) value_contents (args[argnum]).data (), len); (gdb_byte *) args[argnum]->contents ().data (), len);
val = valbuf; val = valbuf;
} }
else else
val = (gdb_byte *) value_contents (args[argnum]).data (); val = (gdb_byte *) args[argnum]->contents ().data ();
while (len > 0) while (len > 0)
{ {

View file

@ -1177,7 +1177,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
ULONGEST v; ULONGEST v;
v = extract_unsigned_integer (value_contents (args[0]).data (), v = extract_unsigned_integer (args[0]->contents ().data (),
type->length (), byte_order); type->length (), byte_order);
first_stack_argnum = 1; first_stack_argnum = 1;
@ -1201,7 +1201,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp--; sp--;
write_memory (sp, &zero, 1); write_memory (sp, &zero, 1);
} }
val = value_contents (args[argnum]).data (); val = args[argnum]->contents ().data ();
sp -= type->length (); sp -= type->length ();
write_memory (sp, val, type->length ()); write_memory (sp, val, type->length ());
} }

View file

@ -559,7 +559,7 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else else
offset = container_len - len; offset = container_len - len;
sp -= container_len; sp -= container_len;
write_memory (sp + offset, value_contents_all (args[i]).data (), len); write_memory (sp + offset, args[i]->contents_all ().data (), len);
} }
/* Store struct value address. */ /* Store struct value address. */

View file

@ -2235,7 +2235,7 @@ push_large_arguments (CORE_ADDR sp, int argc, struct value **argv,
/* Reserve space for the copy, and then round the SP down, to /* Reserve space for the copy, and then round the SP down, to
make sure it's all aligned properly. */ make sure it's all aligned properly. */
sp = (sp - arg_len) & -4; sp = (sp - arg_len) & -4;
write_memory (sp, value_contents (argv[i]).data (), arg_len); write_memory (sp, argv[i]->contents ().data (), arg_len);
copy[i] = sp; copy[i] = sp;
} }
} }
@ -2289,7 +2289,7 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Arguments that fit in a GPR get expanded to fill the GPR. */ /* Arguments that fit in a GPR get expanded to fill the GPR. */
if (argv[i]->type ()->length () <= MEP_GPR_SIZE) if (argv[i]->type ()->length () <= MEP_GPR_SIZE)
value = extract_unsigned_integer (value_contents (argv[i]).data (), value = extract_unsigned_integer (argv[i]->contents ().data (),
argv[i]->type ()->length (), argv[i]->type ()->length (),
byte_order); byte_order);

View file

@ -4612,7 +4612,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_printf (gdb_stdlog, " push"); gdb_printf (gdb_stdlog, " push");
} }
else else
val = value_contents (arg).data (); val = arg->contents ().data ();
/* 32-bit ABIs always start floating point arguments in an /* 32-bit ABIs always start floating point arguments in an
even-numbered floating point register. Round the FP register even-numbered floating point register. Round the FP register
@ -4988,7 +4988,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
"mips_n32n64_push_dummy_call: %d len=%d type=%d", "mips_n32n64_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode); argnum + 1, len, (int) typecode);
val = value_contents (arg).data (); val = arg->contents ().data ();
/* A 128-bit long double value requires an even-odd pair of /* A 128-bit long double value requires an even-odd pair of
floating-point registers. */ floating-point registers. */
@ -5468,7 +5468,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
"mips_o32_push_dummy_call: %d len=%d type=%d", "mips_o32_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode); argnum + 1, len, (int) typecode);
val = value_contents (arg).data (); val = arg->contents ().data ();
/* 32-bit ABIs always start floating point arguments in an /* 32-bit ABIs always start floating point arguments in an
even-numbered floating point register. Round the FP register even-numbered floating point register. Round the FP register
@ -5989,7 +5989,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
"mips_o64_push_dummy_call: %d len=%d type=%d", "mips_o64_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode); argnum + 1, len, (int) typecode);
val = value_contents (arg).data (); val = arg->contents ().data ();
/* Floating point arguments passed in registers have to be /* Floating point arguments passed in registers have to be
treated specially. On 32-bit architectures, doubles are treated specially. On 32-bit architectures, doubles are
@ -6595,7 +6595,7 @@ print_gp_register_row (struct ui_file *file, frame_info_ptr frame,
col++; col++;
continue; continue;
} }
raw_buffer = value_contents_all (value).data (); raw_buffer = value->contents_all ().data ();
/* pad small registers */ /* pad small registers */
for (byte = 0; for (byte = 0;
byte < (mips_abi_regsize (gdbarch) byte < (mips_abi_regsize (gdbarch)

View file

@ -1218,7 +1218,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
else else
{ {
arg_len = (*args)->type ()->length (); arg_len = (*args)->type ()->length ();
val = value_contents (*args).data (); val = (*args)->contents ().data ();
} }
while (regs_used < 2 && arg_len > 0) while (regs_used < 2 && arg_len > 0)

View file

@ -689,7 +689,7 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct value *arg = args[i]; struct value *arg = args[i];
const gdb_byte *arg_bits = value_contents_all (arg).data (); const gdb_byte *arg_bits = arg->contents_all ().data ();
struct type *arg_type = check_typedef (arg->type ()); struct type *arg_type = check_typedef (arg->type ());
ULONGEST arg_size = arg_type->length (); ULONGEST arg_size = arg_type->length ();
int offset; int offset;

View file

@ -1470,7 +1470,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
calling_use_fpr = nds32_check_calling_use_fpr (type); calling_use_fpr = nds32_check_calling_use_fpr (type);
len = type->length (); len = type->length ();
align = type_align (type); align = type_align (type);
val = value_contents (args[i]).data (); val = args[i]->contents ().data ();
/* The size of a composite type larger than 4 bytes will be rounded /* The size of a composite type larger than 4 bytes will be rounded
up to the nearest multiple of 4. */ up to the nearest multiple of 4. */

View file

@ -1839,7 +1839,7 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *arg_type = check_typedef (arg->type ()); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
val = value_contents (arg).data (); val = arg->contents ().data ();
/* Copy the argument to general registers or the stack in /* Copy the argument to general registers or the stack in
register-sized pieces. Large arguments are split between register-sized pieces. Large arguments are split between

View file

@ -140,7 +140,7 @@ lval_func_read (struct value *v)
for (i = offset; i < n; i++) for (i = offset; i < n; i++)
memcpy (v->contents_raw ().data () + j++ * elsize, memcpy (v->contents_raw ().data () + j++ * elsize,
value_contents (c->val).data () + c->indices[i] * elsize, c->val->contents ().data () + c->indices[i] * elsize,
elsize); elsize);
} }
@ -181,7 +181,7 @@ lval_func_write (struct value *v, struct value *fromval)
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 (from_elm_val->contents_writeable ().data (), memcpy (from_elm_val->contents_writeable ().data (),
value_contents (fromval).data () + j++ * elsize, fromval->contents ().data () + j++ * elsize,
elsize); elsize);
value_assign (to_elm_val, from_elm_val); value_assign (to_elm_val, from_elm_val);
} }
@ -315,7 +315,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
memcpy (ret->contents_writeable ().data () memcpy (ret->contents_writeable ().data ()
+ (i * elm_type->length ()), + (i * elm_type->length ()),
value_contents (val).data () val->contents ().data ()
+ (indices[i] * elm_type->length ()), + (indices[i] * elm_type->length ()),
elm_type->length ()); elm_type->length ());
} }
@ -837,7 +837,7 @@ Cannot perform conditional operation on vectors with different sizes"));
tmp = value_logical_not (value_subscript (arg1, i)) ? tmp = value_logical_not (value_subscript (arg1, i)) ?
value_subscript (arg3, i) : value_subscript (arg2, i); value_subscript (arg3, i) : value_subscript (arg2, i);
memcpy (ret->contents_writeable ().data () + memcpy (ret->contents_writeable ().data () +
i * eltype2->length (), value_contents_all (tmp).data (), i * eltype2->length (), tmp->contents_all ().data (),
eltype2->length ()); eltype2->length ());
} }

View file

@ -685,7 +685,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
heap_offset += align_up (len, bpw); heap_offset += align_up (len, bpw);
valaddr = heap_sp + heap_offset; valaddr = heap_sp + heap_offset;
write_memory (valaddr, value_contents (arg).data (), len); write_memory (valaddr, arg->contents ().data (), len);
} }
/* The ABI passes all structures by reference, so get its /* The ABI passes all structures by reference, so get its
@ -697,7 +697,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else else
{ {
/* Everything else, we just get the value. */ /* Everything else, we just get the value. */
val = value_contents (arg).data (); val = arg->contents ().data ();
} }
/* Stick the value in a register. */ /* Stick the value in a register. */
@ -797,7 +797,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
val = valbuf; val = valbuf;
} }
else else
val = value_contents (arg).data (); val = arg->contents ().data ();
while (len > 0) while (len > 0)
{ {

View file

@ -80,7 +80,7 @@ pascal_language::value_print_inner (struct value *val,
struct type *char_type; struct type *char_type;
CORE_ADDR addr; CORE_ADDR addr;
int want_space = 0; int want_space = 0;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
switch (type->code ()) switch (type->code ())
{ {
@ -539,7 +539,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
{ {
struct obstack tmp_obstack = dont_print_statmem_obstack; struct obstack tmp_obstack = dont_print_statmem_obstack;
int fields_seen = 0; int fields_seen = 0;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
if (dont_print_statmem == 0) if (dont_print_statmem == 0)
{ {

View file

@ -124,7 +124,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value *arg = args[argno]; struct value *arg = args[argno];
struct type *type = check_typedef (arg->type ()); struct type *type = check_typedef (arg->type ());
int len = type->length (); int len = type->length ();
const bfd_byte *val = value_contents (arg).data (); const bfd_byte *val = arg->contents ().data ();
if (type->code () == TYPE_CODE_FLT && len <= 8 if (type->code () == TYPE_CODE_FLT && len <= 8
&& !tdep->soft_float) && !tdep->soft_float)
@ -1692,7 +1692,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
{ {
struct value *arg = args[argno]; struct value *arg = args[argno];
struct type *type = check_typedef (arg->type ()); struct type *type = check_typedef (arg->type ());
const bfd_byte *val = value_contents (arg).data (); const bfd_byte *val = arg->contents ().data ();
if (type->code () == TYPE_CODE_COMPLEX) if (type->code () == TYPE_CODE_COMPLEX)
{ {

View file

@ -2457,7 +2457,7 @@ printf_c_string (struct ui_file *stream, const char *format,
null terminated) to be printed without problems. */ null terminated) to be printed without problems. */
gdb_byte *tem_str = (gdb_byte *) alloca (len + 1); gdb_byte *tem_str = (gdb_byte *) alloca (len + 1);
memcpy (tem_str, value_contents (value).data (), len); memcpy (tem_str, value->contents ().data (), len);
tem_str [len] = 0; tem_str [len] = 0;
str = tem_str; str = tem_str;
} }
@ -2521,7 +2521,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
if (VALUE_LVAL (value) == lval_internalvar if (VALUE_LVAL (value) == lval_internalvar
&& c_is_string_type_p (value->type ())) && c_is_string_type_p (value->type ()))
{ {
str = value_contents (value).data (); str = value->contents ().data ();
len = value->type ()->length (); len = value->type ()->length ();
} }
else else
@ -2631,14 +2631,14 @@ printf_floating (struct ui_file *stream, const char *format,
param_type = float_type_from_length (param_type); param_type = float_type_from_length (param_type);
if (param_type != value->type ()) if (param_type != value->type ())
value = value_from_contents (param_type, value = value_from_contents (param_type,
value_contents (value).data ()); value->contents ().data ());
} }
value = value_cast (fmt_type, value); value = value_cast (fmt_type, value);
/* Convert the value to a string and print it. */ /* Convert the value to a string and print it. */
std::string str std::string str
= target_float_to_string (value_contents (value).data (), fmt_type, format); = target_float_to_string (value->contents ().data (), fmt_type, format);
gdb_puts (str.c_str (), stream); gdb_puts (str.c_str (), stream);
} }
@ -2799,7 +2799,7 @@ ui_printf (const char *arg, struct ui_file *stream)
|| valtype->code () != TYPE_CODE_INT) || valtype->code () != TYPE_CODE_INT)
error (_("expected wchar_t argument for %%lc")); error (_("expected wchar_t argument for %%lc"));
bytes = value_contents (val_args[i]).data (); bytes = val_args[i]->contents ().data ();
auto_obstack output; auto_obstack output;

View file

@ -714,7 +714,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
else if (gdbpy_is_value_object (handle_obj)) else if (gdbpy_is_value_object (handle_obj))
{ {
struct value *val = value_object_to_value (handle_obj); struct value *val = value_object_to_value (handle_obj);
bytes = value_contents_all (val).data (); bytes = val->contents_all ().data ();
bytes_len = val->type ()->length (); bytes_len = val->type ()->length ();
} }
else else

View file

@ -131,7 +131,7 @@ pyuw_value_obj_to_pointer (PyObject *pyo_value, CORE_ADDR *addr)
if ((value = value_object_to_value (pyo_value)) != NULL) if ((value = value_object_to_value (pyo_value)) != NULL)
{ {
*addr = unpack_pointer (value->type (), *addr = unpack_pointer (value->type (),
value_contents (value).data ()); value->contents ().data ());
rc = 1; rc = 1;
} }
} }
@ -624,7 +624,7 @@ pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size); cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
memcpy (cached_frame->reg[i].data, memcpy (cached_frame->reg[i].data,
value_contents (value).data (), data_size); value->contents ().data (), data_size);
} }
} }

View file

@ -1537,7 +1537,7 @@ valpy_nonzero (PyObject *self)
nonzero = !!value_as_long (self_value->value); nonzero = !!value_as_long (self_value->value);
else if (is_floating_value (self_value->value)) else if (is_floating_value (self_value->value))
nonzero = !target_float_is_zero nonzero = !target_float_is_zero
(value_contents (self_value->value).data (), type); (self_value->value->contents ().data (), type);
else else
/* All other values are True. */ /* All other values are True. */
nonzero = 1; nonzero = 1;
@ -1755,7 +1755,7 @@ valpy_float (PyObject *self)
type = check_typedef (type); type = check_typedef (type);
if (type->code () == TYPE_CODE_FLT && is_floating_value (value)) if (type->code () == TYPE_CODE_FLT && is_floating_value (value))
d = target_float_to_host_double (value_contents (value).data (), type); d = target_float_to_host_double (value->contents ().data (), type);
else if (type->code () == TYPE_CODE_INT) else if (type->code () == TYPE_CODE_INT)
{ {
/* Note that valpy_long accepts TYPE_CODE_PTR and some /* Note that valpy_long accepts TYPE_CODE_PTR and some

View file

@ -1141,7 +1141,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
&& regtype->field (2).type ()->code () == TYPE_CODE_FLT)) && regtype->field (2).type ()->code () == TYPE_CODE_FLT))
{ {
struct value_print_options opts; struct value_print_options opts;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
enum bfd_endian byte_order = type_byte_order (regtype); enum bfd_endian byte_order = type_byte_order (regtype);
get_user_print_options (&opts); get_user_print_options (&opts);
@ -3070,7 +3070,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
if (info->type != arg_type) if (info->type != arg_type)
arg_value = value_cast (info->type, arg_value); arg_value = value_cast (info->type, arg_value);
info->contents = value_contents (arg_value).data (); info->contents = arg_value->contents ().data ();
} }
/* Adjust the stack pointer and align it. */ /* Adjust the stack pointer and align it. */
@ -3405,7 +3405,7 @@ riscv_return_value (struct gdbarch *gdbarch,
is unscaled. */ is unscaled. */
gdb_mpz unscaled; gdb_mpz unscaled;
unscaled.read (value_contents (abi_val), unscaled.read (abi_val->contents (),
type_byte_order (info.type), type_byte_order (info.type),
info.type->is_unsigned ()); info.type->is_unsigned ());
*read_value = value::allocate (arg_type); *read_value = value::allocate (arg_type);

View file

@ -1346,7 +1346,7 @@ rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp -= container_len; sp -= container_len;
write_memory (rl78_make_data_address (sp), write_memory (rl78_make_data_address (sp),
value_contents_all (args[i]).data (), len); args[i]->contents_all ().data (), len);
} }
/* Store struct value address. */ /* Store struct value address. */

View file

@ -367,7 +367,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_assert (len <= 8); gdb_assert (len <= 8);
target_float_convert (value_contents (arg).data (), type, reg_val, target_float_convert (arg->contents ().data (), type, reg_val,
reg_type); reg_type);
regcache->cooked_write (fp_regnum, reg_val); regcache->cooked_write (fp_regnum, reg_val);
++f_argno; ++f_argno;
@ -382,7 +382,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte word[PPC_MAX_REGISTER_SIZE]; gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, reg_size); memset (word, 0, reg_size);
memcpy (word, memcpy (word,
((char *) value_contents (arg).data ()) + argbytes, ((char *) arg->contents ().data ()) + argbytes,
(len - argbytes) > reg_size (len - argbytes) > reg_size
? reg_size : len - argbytes); ? reg_size : len - argbytes);
regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word); regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
@ -406,9 +406,9 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|| type->code () == TYPE_CODE_CHAR) || type->code () == TYPE_CODE_CHAR)
/* Sign or zero extend the "int" into a "word". */ /* Sign or zero extend the "int" into a "word". */
store_unsigned_integer (word, reg_size, byte_order, store_unsigned_integer (word, reg_size, byte_order,
unpack_long (type, value_contents (arg).data ())); unpack_long (type, arg->contents ().data ()));
else else
memcpy (word, value_contents (arg).data (), len); memcpy (word, arg->contents ().data (), len);
regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word); regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word);
} }
++argno; ++argno;
@ -469,7 +469,7 @@ ran_out_of_registers_for_arguments:
if (argbytes) if (argbytes)
{ {
write_memory (sp + 24 + (ii * 4), write_memory (sp + 24 + (ii * 4),
value_contents (arg).data () + argbytes, arg->contents ().data () + argbytes,
len - argbytes); len - argbytes);
++argno; ++argno;
ii += ((len - argbytes + 3) & -4) / 4; ii += ((len - argbytes + 3) & -4) / 4;
@ -492,11 +492,11 @@ ran_out_of_registers_for_arguments:
gdb_assert (len <= 8); gdb_assert (len <= 8);
regcache->cooked_write (tdep->ppc_fp0_regnum + 1 + f_argno, regcache->cooked_write (tdep->ppc_fp0_regnum + 1 + f_argno,
value_contents (arg).data ()); arg->contents ().data ());
++f_argno; ++f_argno;
} }
write_memory (sp + 24 + (ii * 4), value_contents (arg).data (), len); write_memory (sp + 24 + (ii * 4), arg->contents ().data (), len);
ii += ((len + 3) & -4) / 4; ii += ((len + 3) & -4) / 4;
} }
} }

View file

@ -111,7 +111,7 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
gdb_assert (len <= 8); gdb_assert (len <= 8);
target_float_convert (value_contents (arg).data (), type, reg_val, target_float_convert (arg->contents ().data (), type, reg_val,
reg_type); reg_type);
regcache->cooked_write (fp_regnum, reg_val); regcache->cooked_write (fp_regnum, reg_val);
++f_argno; ++f_argno;
@ -126,7 +126,7 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
gdb_byte word[PPC_MAX_REGISTER_SIZE]; gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, reg_size); memset (word, 0, reg_size);
memcpy (word, memcpy (word,
((char *) value_contents (arg).data ()) + argbytes, ((char *) arg->contents ().data ()) + argbytes,
(len - argbytes) > reg_size (len - argbytes) > reg_size
? reg_size : len - argbytes); ? reg_size : len - argbytes);
regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word); regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
@ -144,7 +144,7 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
gdb_byte word[PPC_MAX_REGISTER_SIZE]; gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, reg_size); memset (word, 0, reg_size);
memcpy (word, value_contents (arg).data (), len); memcpy (word, arg->contents ().data (), len);
regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word); regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word);
} }
++argno; ++argno;
@ -206,7 +206,7 @@ ran_out_of_registers_for_arguments:
if (argbytes) if (argbytes)
{ {
write_memory (sp + 24 + (ii * 4), write_memory (sp + 24 + (ii * 4),
value_contents (arg).data () + argbytes, arg->contents ().data () + argbytes,
len - argbytes); len - argbytes);
++argno; ++argno;
ii += align_up (len - argbytes, 4) / 4; ii += align_up (len - argbytes, 4) / 4;
@ -229,11 +229,11 @@ ran_out_of_registers_for_arguments:
gdb_assert (len <= 8); gdb_assert (len <= 8);
regcache->cooked_write (tdep->ppc_fp0_regnum + 1 + f_argno, regcache->cooked_write (tdep->ppc_fp0_regnum + 1 + f_argno,
value_contents (arg).data ()); arg->contents ().data ());
++f_argno; ++f_argno;
} }
write_memory (sp + 24 + (ii * 4), value_contents (arg).data (), len); write_memory (sp + 24 + (ii * 4), arg->contents ().data (), len);
ii += align_up (len, 4) / 4; ii += align_up (len, 4) / 4;
} }
} }

View file

@ -456,7 +456,7 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
gdb_assert (rust_enum_p (type)); gdb_assert (rust_enum_p (type));
gdb::array_view<const gdb_byte> view gdb::array_view<const gdb_byte> view
(value_contents_for_printing (val).data (), (val->contents_for_printing ().data (),
val->type ()->length ()); val->type ()->length ());
type = resolve_dynamic_type (type, view, val->address ()); type = resolve_dynamic_type (type, view, val->address ());
@ -585,7 +585,7 @@ rust_language::value_print_inner
encoding. */ encoding. */
gdb_puts ("b", stream); gdb_puts ("b", stream);
printstr (stream, type->target_type (), printstr (stream, type->target_type (),
value_contents_for_printing (val).data (), val->contents_for_printing ().data (),
high_bound - low_bound + 1, "ASCII", 0, &opts); high_bound - low_bound + 1, "ASCII", 0, &opts);
} }
break; break;
@ -1374,7 +1374,7 @@ rust_struct_anon::evaluate (struct type *expect_type,
if (rust_enum_p (type)) if (rust_enum_p (type))
{ {
type = resolve_dynamic_type (type, value_contents (lhs), type = resolve_dynamic_type (type, lhs->contents (),
lhs->address ()); lhs->address ());
if (rust_empty_enum_p (type)) if (rust_empty_enum_p (type))
@ -1437,7 +1437,7 @@ rust_structop::evaluate (struct type *expect_type,
struct type *type = lhs->type (); struct type *type = lhs->type ();
if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type)) if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type))
{ {
type = resolve_dynamic_type (type, value_contents (lhs), type = resolve_dynamic_type (type, lhs->contents (),
lhs->address ()); lhs->address ());
if (rust_empty_enum_p (type)) if (rust_empty_enum_p (type))

View file

@ -520,7 +520,7 @@ rx_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
psw_val = rx_frame_prev_register (this_frame, this_cache, psw_val = rx_frame_prev_register (this_frame, this_cache,
RX_PSW_REGNUM); RX_PSW_REGNUM);
psw = extract_unsigned_integer psw = extract_unsigned_integer
(value_contents_all (psw_val).data (), 4, (psw_val->contents_all ().data (), 4,
gdbarch_byte_order (get_frame_arch (this_frame))); gdbarch_byte_order (get_frame_arch (this_frame)));
if ((psw & 0x20000 /* U bit */) != 0) if ((psw & 0x20000 /* U bit */) != 0)
@ -725,7 +725,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct value *arg = args[i]; struct value *arg = args[i];
const gdb_byte *arg_bits = value_contents_all (arg).data (); const gdb_byte *arg_bits = arg->contents_all ().data ();
struct type *arg_type = check_typedef (arg->type ()); struct type *arg_type = check_typedef (arg->type ());
ULONGEST arg_size = arg_type->length (); ULONGEST arg_size = arg_type->length ();

View file

@ -1764,7 +1764,7 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
it occupies the leftmost bits. */ it occupies the leftmost bits. */
if (write_mode) if (write_mode)
as->regcache->cooked_write_part (S390_F0_REGNUM + as->fr, 0, length, as->regcache->cooked_write_part (S390_F0_REGNUM + as->fr, 0, length,
value_contents (arg).data ()); arg->contents ().data ());
as->fr += 2; as->fr += 2;
} }
else else
@ -1773,7 +1773,7 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
it occupies the rightmost bits. */ it occupies the rightmost bits. */
as->argp = align_up (as->argp + length, word_size); as->argp = align_up (as->argp + length, word_size);
if (write_mode) if (write_mode)
write_memory (as->argp - length, value_contents (arg).data (), write_memory (as->argp - length, arg->contents ().data (),
length); length);
} }
} }
@ -1788,13 +1788,13 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
if (write_mode) if (write_mode)
as->regcache->cooked_write_part (regnum, 0, length, as->regcache->cooked_write_part (regnum, 0, length,
value_contents (arg).data ()); arg->contents ().data ());
as->vr++; as->vr++;
} }
else else
{ {
if (write_mode) if (write_mode)
write_memory (as->argp, value_contents (arg).data (), length); write_memory (as->argp, arg->contents ().data (), length);
as->argp = align_up (as->argp + length, word_size); as->argp = align_up (as->argp + length, word_size);
} }
} }
@ -1809,9 +1809,9 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
memory word and sign- or zero-extend to full word size. memory word and sign- or zero-extend to full word size.
This also applies to a struct or union. */ This also applies to a struct or union. */
val = type->is_unsigned () val = type->is_unsigned ()
? extract_unsigned_integer (value_contents (arg).data (), ? extract_unsigned_integer (arg->contents ().data (),
length, byte_order) length, byte_order)
: extract_signed_integer (value_contents (arg).data (), : extract_signed_integer (arg->contents ().data (),
length, byte_order); length, byte_order);
} }
@ -1838,10 +1838,10 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
if (write_mode) if (write_mode)
{ {
as->regcache->cooked_write (S390_R0_REGNUM + as->gr, as->regcache->cooked_write (S390_R0_REGNUM + as->gr,
value_contents (arg).data ()); arg->contents ().data ());
as->regcache->cooked_write as->regcache->cooked_write
(S390_R0_REGNUM + as->gr + 1, (S390_R0_REGNUM + as->gr + 1,
value_contents (arg).data () + word_size); arg->contents ().data () + word_size);
} }
as->gr += 2; as->gr += 2;
} }
@ -1852,7 +1852,7 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
as->gr = 7; as->gr = 7;
if (write_mode) if (write_mode)
write_memory (as->argp, value_contents (arg).data (), length); write_memory (as->argp, arg->contents ().data (), length);
as->argp += length; as->argp += length;
} }
} }
@ -1863,7 +1863,7 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
alignment as a conservative assumption. */ alignment as a conservative assumption. */
as->copy = align_down (as->copy - length, 8); as->copy = align_down (as->copy - length, 8);
if (write_mode) if (write_mode)
write_memory (as->copy, value_contents (arg).data (), length); write_memory (as->copy, arg->contents ().data (), length);
if (as->gr <= 6) if (as->gr <= 6)
{ {

View file

@ -883,12 +883,12 @@ sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, int len)
{ {
/* value gets right-justified in the register or stack word. */ /* value gets right-justified in the register or stack word. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
memcpy (valbuf + (4 - len), value_contents (val).data (), len); memcpy (valbuf + (4 - len), val->contents ().data (), len);
else else
memcpy (valbuf, value_contents (val).data (), len); memcpy (valbuf, val->contents ().data (), len);
return valbuf; return valbuf;
} }
return value_contents (val).data (); return val->contents ().data ();
} }
/* Helper function to eval number of bytes to allocate on stack. */ /* Helper function to eval number of bytes to allocate on stack. */

View file

@ -633,7 +633,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
correct, and wasting a few bytes shouldn't be a problem. */ correct, and wasting a few bytes shouldn't be a problem. */
sp &= ~0x7; sp &= ~0x7;
write_memory (sp, value_contents (args[i]).data (), len); write_memory (sp, args[i]->contents ().data (), len);
args[i] = value_from_pointer (lookup_pointer_type (type), sp); args[i] = value_from_pointer (lookup_pointer_type (type), sp);
num_elements++; num_elements++;
} }
@ -664,7 +664,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
const bfd_byte *valbuf = value_contents (args[i]).data (); const bfd_byte *valbuf = args[i]->contents ().data ();
struct type *type = args[i]->type (); struct type *type = args[i]->type ();
int len = type->length (); int len = type->length ();
gdb_byte buf[4]; gdb_byte buf[4];

View file

@ -1411,7 +1411,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
a problem. */ a problem. */
sp &= ~0xf; sp &= ~0xf;
write_memory (sp, value_contents (args[i]).data (), len); write_memory (sp, args[i]->contents ().data (), len);
args[i] = value_from_pointer (lookup_pointer_type (type), sp); args[i] = value_from_pointer (lookup_pointer_type (type), sp);
num_elements++; num_elements++;
} }
@ -1480,7 +1480,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
const gdb_byte *valbuf = value_contents (args[i]).data (); const gdb_byte *valbuf = args[i]->contents ().data ();
struct type *type = args[i]->type (); struct type *type = args[i]->type ();
int len = type->length (); int len = type->length ();
int regnum = -1; int regnum = -1;

View file

@ -1717,7 +1717,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
int sp_size = register_size (gdbarch, sp_regnum); int sp_size = register_size (gdbarch, sp_regnum);
sp = extract_unsigned_integer sp = extract_unsigned_integer
(value_contents_all (value).data (), sp_size, byte_order); (value->contents_all ().data (), sp_size, byte_order);
gdb_printf (" Previous frame's sp is "); gdb_printf (" Previous frame's sp is ");
gdb_puts (paddress (gdbarch, sp)); gdb_puts (paddress (gdbarch, sp));
@ -2825,7 +2825,7 @@ return_command (const char *retval_exp, int from_tty)
gdbarch_return_value_as_value gdbarch_return_value_as_value
(cache_arch, function, return_type, (cache_arch, function, return_type,
get_current_regcache (), NULL /*read*/, get_current_regcache (), NULL /*read*/,
value_contents (return_value).data () /*write*/); return_value->contents ().data () /*write*/);
} }
/* If we are at the end of a call dummy now, pop the dummy frame /* If we are at the end of a call dummy now, pop the dummy frame

View file

@ -917,7 +917,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = arg_type->length (); int len = arg_type->length ();
enum type_code typecode = arg_type->code (); enum type_code typecode = arg_type->code ();
val = value_contents (arg).data (); val = arg->contents ().data ();
/* Copy the argument to general registers or the stack in /* Copy the argument to general registers or the stack in
register-sized pieces. */ register-sized pieces. */

View file

@ -304,7 +304,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
break; break;
/* Put argument into registers wordwise. */ /* Put argument into registers wordwise. */
val = value_contents (args[i]).data (); val = args[i]->contents ().data ();
for (j = 0; j < typelen; j += tilegx_reg_size) for (j = 0; j < typelen; j += tilegx_reg_size)
{ {
/* ISSUE: Why special handling for "typelen = 4x + 1"? /* ISSUE: Why special handling for "typelen = 4x + 1"?
@ -323,7 +323,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
the stack, word aligned. */ the stack, word aligned. */
for (j = nargs - 1; j >= i; j--) for (j = nargs - 1; j >= i; j--)
{ {
const gdb_byte *contents = value_contents (args[j]).data (); const gdb_byte *contents = args[j]->contents ().data ();
typelen = args[j]->enclosing_type ()->length (); typelen = args[j]->enclosing_type ()->length ();
slacklen = align_up (typelen, 8) - typelen; slacklen = align_up (typelen, 8) - typelen;

View file

@ -1066,7 +1066,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
else else
{ {
len = (*args)->type ()->length (); len = (*args)->type ()->length ();
val = (gdb_byte *) value_contents (*args).data (); val = (gdb_byte *) (*args)->contents ().data ();
} }
if (tdep->eight_byte_align if (tdep->eight_byte_align

View file

@ -718,8 +718,8 @@ value_concat (struct value *arg1, struct value *arg2)
struct value *result = value::allocate (atype); struct value *result = value::allocate (atype);
gdb::array_view<gdb_byte> contents = result->contents_raw (); gdb::array_view<gdb_byte> contents = result->contents_raw ();
gdb::array_view<const gdb_byte> lhs_contents = value_contents (arg1); gdb::array_view<const gdb_byte> lhs_contents = arg1->contents ();
gdb::array_view<const gdb_byte> rhs_contents = value_contents (arg2); gdb::array_view<const gdb_byte> rhs_contents = arg2->contents ();
gdb::copy (lhs_contents, contents.slice (0, lhs_contents.size ())); gdb::copy (lhs_contents, contents.slice (0, lhs_contents.size ()));
gdb::copy (rhs_contents, contents.slice (lhs_contents.size ())); gdb::copy (rhs_contents, contents.slice (lhs_contents.size ()));
@ -785,7 +785,7 @@ value_args_as_target_float (struct value *arg1, struct value *arg2,
if (is_floating_type (type1)) if (is_floating_type (type1))
{ {
*eff_type_x = type1; *eff_type_x = type1;
memcpy (x, value_contents (arg1).data (), type1->length ()); memcpy (x, arg1->contents ().data (), type1->length ());
} }
else if (is_integral_type (type1)) else if (is_integral_type (type1))
{ {
@ -804,7 +804,7 @@ value_args_as_target_float (struct value *arg1, struct value *arg2,
if (is_floating_type (type2)) if (is_floating_type (type2))
{ {
*eff_type_y = type2; *eff_type_y = type2;
memcpy (y, value_contents (arg2).data (), type2->length ()); memcpy (y, arg2->contents ().data (), type2->length ());
} }
else if (is_integral_type (type2)) else if (is_integral_type (type2))
{ {
@ -859,10 +859,10 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
type2 = type1; type2 = type1;
} }
v1.read_fixed_point (value_contents (arg1), v1.read_fixed_point (arg1->contents (),
type_byte_order (type1), type1->is_unsigned (), type_byte_order (type1), type1->is_unsigned (),
type1->fixed_point_scaling_factor ()); type1->fixed_point_scaling_factor ());
v2.read_fixed_point (value_contents (arg2), v2.read_fixed_point (arg2->contents (),
type_byte_order (type2), type2->is_unsigned (), type_byte_order (type2), type2->is_unsigned (),
type2->fixed_point_scaling_factor ()); type2->fixed_point_scaling_factor ());
} }
@ -1587,7 +1587,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type)
for (i = 0; i < high_bound - low_bound + 1; i++) for (i = 0; i < high_bound - low_bound + 1; i++)
/* Duplicate the contents of elval into the destination vector. */ /* Duplicate the contents of elval into the destination vector. */
copy (value_contents_all (elval), copy (elval->contents_all (),
val_contents.slice (i * elt_len, elt_len)); val_contents.slice (i * elt_len, elt_len));
return val; return val;
@ -1635,7 +1635,7 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
{ {
value *tmp = value_binop (value_subscript (val1, i), value *tmp = value_binop (value_subscript (val1, i),
value_subscript (val2, i), op); value_subscript (val2, i), op);
copy (value_contents_all (tmp), copy (tmp->contents_all (),
val_contents.slice (i * elsize, elsize)); val_contents.slice (i * elsize, elsize));
} }
@ -1692,10 +1692,10 @@ value_logical_not (struct value *arg1)
type1 = check_typedef (arg1->type ()); type1 = check_typedef (arg1->type ());
if (is_floating_value (arg1)) if (is_floating_value (arg1))
return target_float_is_zero (value_contents (arg1).data (), type1); return target_float_is_zero (arg1->contents ().data (), type1);
len = type1->length (); len = type1->length ();
p = value_contents (arg1).data (); p = arg1->contents ().data ();
while (--len >= 0) while (--len >= 0)
{ {
@ -1714,8 +1714,8 @@ value_strcmp (struct value *arg1, struct value *arg2)
{ {
int len1 = arg1->type ()->length (); int len1 = arg1->type ()->length ();
int len2 = arg2->type ()->length (); int len2 = arg2->type ()->length ();
const gdb_byte *s1 = value_contents (arg1).data (); const gdb_byte *s1 = arg1->contents ().data ();
const gdb_byte *s2 = value_contents (arg2).data (); const gdb_byte *s2 = arg2->contents ().data ();
int i, len = len1 < len2 ? len1 : len2; int i, len = len1 < len2 ? len1 : len2;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
@ -1790,8 +1790,8 @@ value_equal (struct value *arg1, struct value *arg2)
&& ((len = (int) type1->length ()) && ((len = (int) type1->length ())
== (int) type2->length ())) == (int) type2->length ()))
{ {
p1 = value_contents (arg1).data (); p1 = arg1->contents ().data ();
p2 = value_contents (arg2).data (); p2 = arg2->contents ().data ();
while (--len >= 0) while (--len >= 0)
{ {
if (*p1++ != *p2++) if (*p1++ != *p2++)
@ -1821,8 +1821,8 @@ value_equal_contents (struct value *arg1, struct value *arg2)
return (type1->code () == type2->code () return (type1->code () == type2->code ()
&& type1->length () == type2->length () && type1->length () == type2->length ()
&& memcmp (value_contents (arg1).data (), && memcmp (arg1->contents ().data (),
value_contents (arg2).data (), arg2->contents ().data (),
type1->length ()) == 0); type1->length ()) == 0);
} }
@ -1897,7 +1897,7 @@ value_pos (struct value *arg1)
if (is_integral_type (type) || is_floating_value (arg1) if (is_integral_type (type) || is_floating_value (arg1)
|| (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) || (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
|| type->code () == TYPE_CODE_COMPLEX) || type->code () == TYPE_CODE_COMPLEX)
return value_from_contents (type, value_contents (arg1).data ()); return value_from_contents (type, arg1->contents ().data ());
else else
error (_("Argument to positive operation not a number.")); error (_("Argument to positive operation not a number."));
} }
@ -1930,7 +1930,7 @@ value_neg (struct value *arg1)
for (i = 0; i < high_bound - low_bound + 1; i++) for (i = 0; i < high_bound - low_bound + 1; i++)
{ {
value *tmp = value_neg (value_subscript (arg1, i)); value *tmp = value_neg (value_subscript (arg1, i));
copy (value_contents_all (tmp), copy (tmp->contents_all (),
val_contents.slice (i * elt_len, elt_len)); val_contents.slice (i * elt_len, elt_len));
} }
return val; return val;
@ -1975,7 +1975,7 @@ value_complement (struct value *arg1)
for (i = 0; i < high_bound - low_bound + 1; i++) for (i = 0; i < high_bound - low_bound + 1; i++)
{ {
value *tmp = value_complement (value_subscript (arg1, i)); value *tmp = value_complement (value_subscript (arg1, i));
copy (value_contents_all (tmp), copy (tmp->contents_all (),
val_contents.slice (i * elt_len, elt_len)); val_contents.slice (i * elt_len, elt_len));
} }
} }
@ -2037,7 +2037,7 @@ value_in (struct value *element, struct value *set)
&& eltype->code () != TYPE_CODE_ENUM && eltype->code () != TYPE_CODE_ENUM
&& eltype->code () != TYPE_CODE_BOOL) && eltype->code () != TYPE_CODE_BOOL)
error (_("First argument of 'IN' has wrong type")); error (_("First argument of 'IN' has wrong type"));
member = value_bit_index (settype, value_contents (set).data (), member = value_bit_index (settype, set->contents ().data (),
value_as_long (element)); value_as_long (element));
if (member < 0) if (member < 0)
error (_("First argument of 'IN' not in range")); error (_("First argument of 'IN' not in range"));

View file

@ -342,7 +342,7 @@ value_to_gdb_mpq (struct value *value)
gdb_mpq result; gdb_mpq result;
if (is_floating_type (type)) if (is_floating_type (type))
{ {
double d = target_float_to_host_double (value_contents (value).data (), double d = target_float_to_host_double (value->contents ().data (),
type); type);
mpq_set_d (result.val, d); mpq_set_d (result.val, d);
} }
@ -352,7 +352,7 @@ value_to_gdb_mpq (struct value *value)
|| is_fixed_point_type (type)); || is_fixed_point_type (type));
gdb_mpz vz; gdb_mpz vz;
vz.read (value_contents (value), type_byte_order (type), vz.read (value->contents (), type_byte_order (type),
type->is_unsigned ()); type->is_unsigned ());
mpq_set_z (result.val, vz.val); mpq_set_z (result.val, vz.val);
@ -544,7 +544,7 @@ value_cast (struct type *type, struct value *arg2)
if (is_floating_value (arg2)) if (is_floating_value (arg2))
{ {
struct value *v = value::allocate (to_type); struct value *v = value::allocate (to_type);
target_float_convert (value_contents (arg2).data (), type2, target_float_convert (arg2->contents ().data (), type2,
v->contents_raw ().data (), type); v->contents_raw ().data (), type);
return v; return v;
} }
@ -552,7 +552,7 @@ value_cast (struct type *type, struct value *arg2)
{ {
gdb_mpq fp_val; gdb_mpq fp_val;
fp_val.read_fixed_point (value_contents (arg2), fp_val.read_fixed_point (arg2->contents (),
type_byte_order (type2), type_byte_order (type2),
type2->is_unsigned (), type2->is_unsigned (),
type2->fixed_point_scaling_factor ()); type2->fixed_point_scaling_factor ());
@ -584,7 +584,7 @@ value_cast (struct type *type, struct value *arg2)
bits. */ bits. */
if (code2 == TYPE_CODE_PTR) if (code2 == TYPE_CODE_PTR)
longest = extract_unsigned_integer longest = extract_unsigned_integer
(value_contents (arg2), type_byte_order (type2)); (arg2->contents (), type_byte_order (type2));
else else
longest = value_as_long (arg2); longest = value_as_long (arg2);
return value_from_longest (to_type, convert_to_boolean ? return value_from_longest (to_type, convert_to_boolean ?
@ -902,7 +902,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
return tem; return tem;
result = NULL; result = NULL;
if (dynamic_cast_check_1 (resolved_type->target_type (), if (dynamic_cast_check_1 (resolved_type->target_type (),
value_contents_for_printing (tem).data (), tem->contents_for_printing ().data (),
tem->embedded_offset (), tem->embedded_offset (),
tem->address (), tem, tem->address (), tem,
rtti_type, addr, rtti_type, addr,
@ -918,7 +918,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
result = NULL; result = NULL;
if (is_public_ancestor (arg_type, rtti_type) if (is_public_ancestor (arg_type, rtti_type)
&& dynamic_cast_check_2 (resolved_type->target_type (), && dynamic_cast_check_2 (resolved_type->target_type (),
value_contents_for_printing (tem).data (), tem->contents_for_printing ().data (),
tem->embedded_offset (), tem->embedded_offset (),
tem->address (), tem, tem->address (), tem,
rtti_type, &result) == 1) rtti_type, &result) == 1)
@ -961,7 +961,7 @@ value_one (struct type *type)
for (i = 0; i < high_bound - low_bound + 1; i++) for (i = 0; i < high_bound - low_bound + 1; i++)
{ {
value *tmp = value_one (eltype); value *tmp = value_one (eltype);
copy (value_contents_all (tmp), copy (tmp->contents_all (),
val_contents.slice (i * elt_len, elt_len)); val_contents.slice (i * elt_len, elt_len));
} }
} }
@ -1183,7 +1183,7 @@ value_assign (struct value *toval, struct value *fromval)
{ {
changed_addr = toval->address (); changed_addr = toval->address ();
changed_len = type_length_units (type); changed_len = type_length_units (type);
dest_buffer = value_contents (fromval).data (); dest_buffer = fromval->contents ().data ();
} }
write_memory_with_notification (changed_addr, dest_buffer, changed_len); write_memory_with_notification (changed_addr, dest_buffer, changed_len);
@ -1259,12 +1259,12 @@ value_assign (struct value *toval, struct value *fromval)
format. */ format. */
gdbarch_value_to_register (gdbarch, frame, gdbarch_value_to_register (gdbarch, frame,
VALUE_REGNUM (toval), type, VALUE_REGNUM (toval), type,
value_contents (fromval).data ()); fromval->contents ().data ());
} }
else else
put_frame_register_bytes (frame, value_reg, put_frame_register_bytes (frame, value_reg,
toval->offset (), toval->offset (),
value_contents (fromval)); fromval->contents ());
} }
gdb::observers::register_changed.notify (frame, value_reg); gdb::observers::register_changed.notify (frame, value_reg);
@ -1344,7 +1344,7 @@ value_assign (struct value *toval, struct value *fromval)
implies the returned value is not lazy, even if TOVAL was. */ implies the returned value is not lazy, even if TOVAL was. */
val = value_copy (toval); val = value_copy (toval);
val->set_lazy (0); val->set_lazy (0);
copy (value_contents (fromval), val->contents_raw ()); copy (fromval->contents (), val->contents_raw ());
/* We copy over the enclosing type and pointed-to offset from FROMVAL /* We copy over the enclosing type and pointed-to offset from FROMVAL
in the case of pointer types. For object types, the enclosing type in the case of pointer types. For object types, the enclosing type
@ -1485,7 +1485,7 @@ value_coerce_to_target (struct value *val)
length = check_typedef (val->type ())->length (); length = check_typedef (val->type ())->length ();
addr = allocate_space_in_inferior (length); addr = allocate_space_in_inferior (length);
write_memory (addr, value_contents (val).data (), length); write_memory (addr, val->contents ().data (), length);
return value_at_lazy (val->type (), addr); return value_at_lazy (val->type (), addr);
} }
@ -2083,7 +2083,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
struct value *v2; struct value *v2;
boffset = baseclass_offset (type, i, boffset = baseclass_offset (type, i,
value_contents_for_printing (arg1).data (), arg1->contents_for_printing ().data (),
arg1->embedded_offset () + offset, arg1->embedded_offset () + offset,
arg1->address (), arg1->address (),
arg1); arg1);
@ -2287,13 +2287,13 @@ search_struct_method (const char *name, struct value **arg1p,
base_val = value_from_contents_and_address (baseclass, base_val = value_from_contents_and_address (baseclass,
tmp.data (), tmp.data (),
address + offset); address + offset);
base_valaddr = value_contents_for_printing (base_val).data (); base_valaddr = base_val->contents_for_printing ().data ();
this_offset = 0; this_offset = 0;
} }
else else
{ {
base_val = *arg1p; base_val = *arg1p;
base_valaddr = value_contents_for_printing (*arg1p).data (); base_valaddr = (*arg1p)->contents_for_printing ().data ();
this_offset = offset; this_offset = offset;
} }
@ -2558,7 +2558,7 @@ find_method_list (struct value **argp, const char *method,
if (BASETYPE_VIA_VIRTUAL (type, i)) if (BASETYPE_VIA_VIRTUAL (type, i))
{ {
base_offset = baseclass_offset (type, i, base_offset = baseclass_offset (type, i,
value_contents_for_printing (*argp).data (), (*argp)->contents_for_printing ().data (),
(*argp)->offset () + offset, (*argp)->offset () + offset,
(*argp)->address (), *argp); (*argp)->address (), *argp);
} }
@ -3529,7 +3529,7 @@ get_baseclass_offset (struct type *vt, struct type *cls,
{ {
if (BASETYPE_VIA_VIRTUAL (vt, i)) if (BASETYPE_VIA_VIRTUAL (vt, i))
{ {
const gdb_byte *adr = value_contents_for_printing (v).data (); const gdb_byte *adr = v->contents_for_printing ().data ();
*boffs = baseclass_offset (vt, i, adr, v->offset (), *boffs = baseclass_offset (vt, i, adr, v->offset (),
value_as_long (v), v); value_as_long (v), v);
*isvirt = true; *isvirt = true;
@ -3543,7 +3543,7 @@ get_baseclass_offset (struct type *vt, struct type *cls,
{ {
if (*isvirt == false) /* Add non-virtual base offset. */ if (*isvirt == false) /* Add non-virtual base offset. */
{ {
const gdb_byte *adr = value_contents_for_printing (v).data (); const gdb_byte *adr = v->contents_for_printing ().data ();
*boffs += baseclass_offset (vt, i, adr, v->offset (), *boffs += baseclass_offset (vt, i, adr, v->offset (),
value_as_long (v), v); value_as_long (v), v);
} }
@ -4110,9 +4110,9 @@ value_literal_complex (struct value *arg1,
int len = real_type->length (); int len = real_type->length ();
copy (value_contents (arg1), copy (arg1->contents (),
val->contents_raw ().slice (0, len)); val->contents_raw ().slice (0, len));
copy (value_contents (arg2), copy (arg2->contents (),
val->contents_raw ().slice (len, len)); val->contents_raw ().slice (len, len));
return val; return val;
@ -4157,9 +4157,9 @@ cast_into_complex (struct type *type, struct value *val)
struct value *im_val = value::allocate (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 (val->contents ().slice (0, len),
re_val->contents_raw ()); re_val->contents_raw ());
copy (value_contents (val).slice (len, len), copy (val->contents ().slice (len, len),
im_val->contents_raw ()); im_val->contents_raw ());
return value_literal_complex (re_val, im_val, type); return value_literal_complex (re_val, im_val, type);

View file

@ -513,7 +513,7 @@ generic_value_print_ptr (struct value *val, struct ui_file *stream,
{ {
struct type *type = check_typedef (val->type ()); struct type *type = check_typedef (val->type ());
struct type *elttype = check_typedef (type->target_type ()); struct type *elttype = check_typedef (type->target_type ());
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
CORE_ADDR addr = unpack_pointer (type, valaddr); CORE_ADDR addr = unpack_pointer (type, valaddr);
print_unpacked_pointer (type, elttype, addr, stream, options); print_unpacked_pointer (type, elttype, addr, stream, options);
@ -549,7 +549,7 @@ get_value_addr_contents (struct value *deref_val)
gdb_assert (deref_val != NULL); gdb_assert (deref_val != NULL);
if (deref_val->lval () == lval_memory) if (deref_val->lval () == lval_memory)
return value_contents_for_printing_const (value_addr (deref_val)).data (); return value_addr (deref_val)->contents_for_printing ().data ();
else else
{ {
/* We have a non-addressable value, such as a DW_AT_const_value. */ /* We have a non-addressable value, such as a DW_AT_const_value. */
@ -573,7 +573,7 @@ generic_val_print_ref (struct type *type,
const int must_coerce_ref = ((options->addressprint && value_is_synthetic) const int must_coerce_ref = ((options->addressprint && value_is_synthetic)
|| options->deref_ref); || options->deref_ref);
const int type_is_defined = elttype->code () != TYPE_CODE_UNDEF; const int type_is_defined = elttype->code () != TYPE_CODE_UNDEF;
const gdb_byte *valaddr = value_contents_for_printing (original_value).data (); const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
if (must_coerce_ref && type_is_defined) if (must_coerce_ref && type_is_defined)
{ {
@ -721,7 +721,7 @@ generic_val_print_enum (struct type *type,
gdb_assert (!options->format); gdb_assert (!options->format);
const gdb_byte *valaddr = value_contents_for_printing (original_value).data (); const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
val = unpack_long (type, valaddr + embedded_offset * unit_size); val = unpack_long (type, valaddr + embedded_offset * unit_size);
@ -768,7 +768,7 @@ generic_value_print_bool
} }
else else
{ {
const gdb_byte *valaddr = value_contents_for_printing (value).data (); const gdb_byte *valaddr = value->contents_for_printing ().data ();
struct type *type = check_typedef (value->type ()); struct type *type = check_typedef (value->type ());
LONGEST val = unpack_long (type, valaddr); LONGEST val = unpack_long (type, valaddr);
if (val == 0) if (val == 0)
@ -811,7 +811,7 @@ generic_value_print_char (struct value *value, struct ui_file *stream,
{ {
struct type *unresolved_type = value->type (); struct type *unresolved_type = value->type ();
struct type *type = check_typedef (unresolved_type); struct type *type = check_typedef (unresolved_type);
const gdb_byte *valaddr = value_contents_for_printing (value).data (); const gdb_byte *valaddr = value->contents_for_printing ().data ();
LONGEST val = unpack_long (type, valaddr); LONGEST val = unpack_long (type, valaddr);
if (type->is_unsigned ()) if (type->is_unsigned ())
@ -832,7 +832,7 @@ generic_val_print_float (struct type *type, struct ui_file *stream,
{ {
gdb_assert (!options->format); gdb_assert (!options->format);
const gdb_byte *valaddr = value_contents_for_printing (original_value).data (); const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
print_floating (valaddr, type, stream); print_floating (valaddr, type, stream);
} }
@ -849,7 +849,7 @@ generic_val_print_fixed_point (struct value *val, struct ui_file *stream,
{ {
struct type *type = val->type (); struct type *type = val->type ();
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
gdb_mpf f; gdb_mpf f;
f.read_fixed_point (gdb::make_array_view (valaddr, type->length ()), f.read_fixed_point (gdb::make_array_view (valaddr, type->length ()),
@ -895,7 +895,7 @@ generic_value_print_memberptr
/* Member pointers are essentially specific to C++, and so if we /* Member pointers are essentially specific to C++, and so if we
encounter one, we should print it according to C++ rules. */ encounter one, we should print it according to C++ rules. */
struct type *type = check_typedef (val->type ()); struct type *type = check_typedef (val->type ());
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
cp_print_class_member (valaddr, type, stream, "&"); cp_print_class_member (valaddr, type, stream, "&");
} }
else else
@ -1012,7 +1012,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
break; break;
case TYPE_CODE_METHODPTR: case TYPE_CODE_METHODPTR:
cplus_print_method_ptr (value_contents_for_printing (val).data (), type, cplus_print_method_ptr (val->contents_for_printing ().data (), type,
stream); stream);
break; break;
@ -1226,7 +1226,7 @@ static void
val_print_type_code_flags (struct type *type, struct value *original_value, val_print_type_code_flags (struct type *type, struct value *original_value,
int embedded_offset, struct ui_file *stream) int embedded_offset, struct ui_file *stream)
{ {
const gdb_byte *valaddr = (value_contents_for_printing (original_value).data () const gdb_byte *valaddr = (original_value->contents_for_printing ().data ()
+ embedded_offset); + embedded_offset);
ULONGEST val = unpack_long (type, valaddr); ULONGEST val = unpack_long (type, valaddr);
int field, nfields = type->num_fields (); int field, nfields = type->num_fields ();
@ -1300,7 +1300,7 @@ value_print_scalar_formatted (struct value *val,
/* value_contents_for_printing fetches all VAL's contents. They are /* value_contents_for_printing fetches all VAL's contents. They are
needed to check whether VAL is optimized-out or unavailable needed to check whether VAL is optimized-out or unavailable
below. */ below. */
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = val->contents_for_printing ().data ();
/* A scalar object that does not have all bits available can't be /* A scalar object that does not have all bits available can't be
printed, because all bits contribute to its representation. */ printed, because all bits contribute to its representation. */

View file

@ -1090,12 +1090,12 @@ error_value_optimized_out (void)
throw_error (OPTIMIZED_OUT_ERROR, _("value has been optimized out")); throw_error (OPTIMIZED_OUT_ERROR, _("value has been optimized out"));
} }
static void void
require_not_optimized_out (const struct value *value) value::require_not_optimized_out () const
{ {
if (!value->m_optimized_out.empty ()) if (!m_optimized_out.empty ())
{ {
if (value->m_lval == lval_register) if (m_lval == lval_register)
throw_error (OPTIMIZED_OUT_ERROR, throw_error (OPTIMIZED_OUT_ERROR,
_("register has not been saved in frame")); _("register has not been saved in frame"));
else else
@ -1103,38 +1103,38 @@ require_not_optimized_out (const struct value *value)
} }
} }
static void void
require_available (const struct value *value) value::require_available () const
{ {
if (!value->m_unavailable.empty ()) if (!m_unavailable.empty ())
throw_error (NOT_AVAILABLE_ERROR, _("value is not available")); throw_error (NOT_AVAILABLE_ERROR, _("value is not available"));
} }
gdb::array_view<const gdb_byte> gdb::array_view<const gdb_byte>
value_contents_for_printing (struct value *value) value::contents_for_printing ()
{ {
if (value->m_lazy) if (m_lazy)
value->fetch_lazy (); fetch_lazy ();
ULONGEST length = value->enclosing_type ()->length (); ULONGEST length = enclosing_type ()->length ();
return gdb::make_array_view (value->m_contents.get (), length); return gdb::make_array_view (m_contents.get (), length);
} }
gdb::array_view<const gdb_byte> gdb::array_view<const gdb_byte>
value_contents_for_printing_const (const struct value *value) value::contents_for_printing () const
{ {
gdb_assert (!value->m_lazy); gdb_assert (!m_lazy);
ULONGEST length = value->enclosing_type ()->length (); ULONGEST length = enclosing_type ()->length ();
return gdb::make_array_view (value->m_contents.get (), length); return gdb::make_array_view (m_contents.get (), length);
} }
gdb::array_view<const gdb_byte> gdb::array_view<const gdb_byte>
value_contents_all (struct value *value) value::contents_all ()
{ {
gdb::array_view<const gdb_byte> result = value_contents_for_printing (value); gdb::array_view<const gdb_byte> result = contents_for_printing ();
require_not_optimized_out (value); require_not_optimized_out ();
require_available (value); require_available ();
return result; return result;
} }
@ -1286,11 +1286,11 @@ value_contents_copy (struct value *dst, LONGEST dst_offset,
} }
gdb::array_view<const gdb_byte> gdb::array_view<const gdb_byte>
value_contents (struct value *value) value::contents ()
{ {
gdb::array_view<const gdb_byte> result = value->contents_writeable (); gdb::array_view<const gdb_byte> result = contents_writeable ();
require_not_optimized_out (value); require_not_optimized_out ();
require_available (value); require_available ();
return result; return result;
} }
@ -1604,7 +1604,7 @@ value_non_lval (struct value *arg)
struct type *enc_type = arg->enclosing_type (); struct type *enc_type = arg->enclosing_type ();
struct value *val = value::allocate (enc_type); struct value *val = value::allocate (enc_type);
copy (value_contents_all (arg), val->contents_all_raw ()); copy (arg->contents_all (), val->contents_all_raw ());
val->m_type = arg->m_type; val->m_type = arg->m_type;
val->set_embedded_offset (arg->embedded_offset ()); val->set_embedded_offset (arg->embedded_offset ());
val->set_pointed_to_offset (arg->pointed_to_offset ()); val->set_pointed_to_offset (arg->pointed_to_offset ());
@ -2187,7 +2187,7 @@ set_internalvar_component (struct internalvar *var,
modify_field (var->u.value->type (), addr + offset, modify_field (var->u.value->type (), addr + offset,
value_as_long (newval), bitpos, bitsize); value_as_long (newval), bitpos, bitsize);
else else
memcpy (addr + offset * unit_size, value_contents (newval).data (), memcpy (addr + offset * unit_size, newval->contents ().data (),
newval->type ()->length ()); newval->type ()->length ());
break; break;
@ -2591,7 +2591,7 @@ value_as_long (struct value *val)
in disassemble_command). It also dereferences references, which in disassemble_command). It also dereferences references, which
I suspect is the most logical thing to do. */ I suspect is the most logical thing to do. */
val = coerce_array (val); val = coerce_array (val);
return unpack_long (val->type (), value_contents (val).data ()); return unpack_long (val->type (), val->contents ().data ());
} }
/* Extract a value as a C pointer. Does not deallocate the value. /* Extract a value as a C pointer. Does not deallocate the value.
@ -2694,9 +2694,9 @@ value_as_address (struct value *val)
if (!val->type ()->is_pointer_or_reference () if (!val->type ()->is_pointer_or_reference ()
&& gdbarch_integer_to_address_p (gdbarch)) && gdbarch_integer_to_address_p (gdbarch))
return gdbarch_integer_to_address (gdbarch, val->type (), return gdbarch_integer_to_address (gdbarch, val->type (),
value_contents (val).data ()); val->contents ().data ());
return unpack_long (val->type (), value_contents (val).data ()); return unpack_long (val->type (), val->contents ().data ());
#endif #endif
} }
@ -2820,7 +2820,7 @@ is_floating_value (struct value *val)
if (is_floating_type (type)) if (is_floating_type (type))
{ {
if (!target_float_is_valid (value_contents (val).data (), type)) if (!target_float_is_valid (val->contents ().data (), type))
error (_("Invalid floating value found in program.")); error (_("Invalid floating value found in program."));
return true; return true;
} }
@ -2961,7 +2961,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
for references to ordinary fields of unavailable values. */ for references to ordinary fields of unavailable values. */
if (BASETYPE_VIA_VIRTUAL (arg_type, fieldno)) if (BASETYPE_VIA_VIRTUAL (arg_type, fieldno))
boffset = baseclass_offset (arg_type, fieldno, boffset = baseclass_offset (arg_type, fieldno,
value_contents (arg1).data (), arg1->contents ().data (),
arg1->embedded_offset (), arg1->embedded_offset (),
arg1->address (), arg1->address (),
arg1); arg1);
@ -3709,7 +3709,7 @@ coerce_ref (struct value *arg)
enc_type = check_typedef (arg->enclosing_type ()); enc_type = check_typedef (arg->enclosing_type ());
enc_type = enc_type->target_type (); enc_type = enc_type->target_type ();
CORE_ADDR addr = unpack_pointer (arg->type (), value_contents (arg).data ()); CORE_ADDR addr = unpack_pointer (arg->type (), arg->contents ().data ());
retval = value_at_lazy (enc_type, addr); retval = value_at_lazy (enc_type, addr);
enc_type = retval->type (); enc_type = retval->type ();
return readjust_indirect_value_type (retval, enc_type, value_type_arg_tmp, return readjust_indirect_value_type (retval, enc_type, value_type_arg_tmp,
@ -3790,7 +3790,7 @@ value::fetch_lazy_bitfield ()
parent->fetch_lazy (); parent->fetch_lazy ();
unpack_value_bitfield (this, bitpos (), bitsize (), unpack_value_bitfield (this, bitpos (), bitsize (),
value_contents_for_printing (parent).data (), parent->contents_for_printing ().data (),
offset (), parent); offset (), parent);
} }
@ -3914,7 +3914,7 @@ value::fetch_lazy_register ()
else else
{ {
int i; int i;
gdb::array_view<const gdb_byte> buf = value_contents (new_val); gdb::array_view<const gdb_byte> buf = new_val->contents ();
if (VALUE_LVAL (new_val) == lval_register) if (VALUE_LVAL (new_val) == lval_register)
gdb_printf (&debug_file, " register=%d", gdb_printf (&debug_file, " register=%d",

View file

@ -281,8 +281,8 @@ public:
When we store the entire object, `enclosing_type' is the run-time When we store the entire object, `enclosing_type' is the run-time
type -- the complete object -- and `embedded_offset' is the offset type -- the complete object -- and `embedded_offset' is the offset
of `type' within that larger type, in bytes. The value_contents() of `type' within that larger type, in bytes. The contents()
macro takes `embedded_offset' into account, so most GDB code method takes `embedded_offset' into account, so most GDB code
continues to see the `type' portion of the value, just as the continues to see the `type' portion of the value, just as the
inferior would. inferior would.
@ -367,9 +367,31 @@ public:
get to the real subobject, if the value happens to represent get to the real subobject, if the value happens to represent
something embedded in a larger run-time object. */ something embedded in a larger run-time object. */
gdb::array_view<gdb_byte> contents_raw (); gdb::array_view<gdb_byte> contents_raw ();
/* Actual contents of the value. For use of this value; setting it
uses the stuff above. Not valid if lazy is nonzero. Target
byte-order. We force it to be aligned properly for any possible
value. Note that a value therefore extends beyond what is
declared here. */
gdb::array_view<const gdb_byte> contents ();
/* The ALL variants of the above two methods do not adjust the
returned pointer by the embedded_offset value. */
gdb::array_view<const gdb_byte> contents_all ();
gdb::array_view<gdb_byte> contents_all_raw (); gdb::array_view<gdb_byte> contents_all_raw ();
gdb::array_view<gdb_byte> contents_writeable (); gdb::array_view<gdb_byte> contents_writeable ();
/* Like contents_all, but does not require that the returned bits be
valid. This should only be used in situations where you plan to
check the validity manually. */
gdb::array_view<const gdb_byte> contents_for_printing ();
/* Like contents_for_printing, but accepts a constant value pointer.
Unlike contents_for_printing however, the pointed value must
_not_ be lazy. */
gdb::array_view<const gdb_byte> contents_for_printing () const;
/* Load the actual content of a lazy value. Fetch the data from the /* Load the actual content of a lazy value. Fetch the data from the
user's process and clear the lazy flag to indicate that the data in user's process and clear the lazy flag to indicate that the data in
the buffer is valid. the buffer is valid.
@ -578,7 +600,7 @@ public:
When we store the entire object, `enclosing_type' is the run-time When we store the entire object, `enclosing_type' is the run-time
type -- the complete object -- and `embedded_offset' is the type -- the complete object -- and `embedded_offset' is the
offset of `type' within that larger type, in target addressable memory offset of `type' within that larger type, in target addressable memory
units. The value_contents() macro takes `embedded_offset' into account, units. The contents() method takes `embedded_offset' into account,
so most GDB code continues to see the `type' portion of the value, just so most GDB code continues to see the `type' portion of the value, just
as the inferior would. as the inferior would.
@ -667,6 +689,9 @@ private:
bits. Return true if the available bits match. */ bits. Return true if the available bits match. */
bool contents_bits_eq (int offset1, const struct value *val2, int offset2, bool contents_bits_eq (int offset1, const struct value *val2, int offset2,
int length) const; int length) const;
void require_not_optimized_out () const;
void require_available () const;
}; };
inline void inline void
@ -763,30 +788,6 @@ struct lval_funcs
extern void error_value_optimized_out (void); extern void error_value_optimized_out (void);
/* Actual contents of the value. For use of this value; setting it
uses the stuff above. Not valid if lazy is nonzero. Target
byte-order. We force it to be aligned properly for any possible
value. Note that a value therefore extends beyond what is
declared here. */
extern gdb::array_view<const gdb_byte> value_contents (struct value *);
/* The ALL variants of the above two macros do not adjust the returned
pointer by the embedded_offset value. */
extern gdb::array_view<const gdb_byte> value_contents_all (struct value *);
/* Like value_contents_all, but does not require that the returned
bits be valid. This should only be used in situations where you
plan to check the validity manually. */
extern gdb::array_view<const gdb_byte> value_contents_for_printing (struct value *value);
/* Like value_contents_for_printing, but accepts a constant value
pointer. Unlike value_contents_for_printing however, the pointed
value must _not_ be lazy. */
extern gdb::array_view<const gdb_byte>
value_contents_for_printing_const (const struct value *value);
/* If nonzero, this is the value of a variable which does not actually /* If nonzero, this is the value of a variable which does not actually
exist in the program, at least partially. If the value is lazy, exist in the program, at least partially. If the value is lazy,
this may fetch it now. */ this may fetch it now. */

View file

@ -121,7 +121,7 @@ vax_store_arguments (struct regcache *regcache, int nargs,
sp -= (len + 3) & ~3; sp -= (len + 3) & ~3;
count += (len + 3) / 4; count += (len + 3) / 4;
write_memory (sp, value_contents_all (args[i]).data (), len); write_memory (sp, args[i]->contents_all ().data (), len);
} }
/* Push argument count. */ /* Push argument count. */

View file

@ -252,7 +252,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
break; break;
/* Put argument into registers wordwise. */ /* Put argument into registers wordwise. */
const gdb_byte *val = value_contents (args[i]).data (); const gdb_byte *val = args[i]->contents ().data ();
for (j = 0; j < typelen; j += xstormy16_reg_size) for (j = 0; j < typelen; j += xstormy16_reg_size)
{ {
ULONGEST regval; ULONGEST regval;
@ -270,7 +270,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
wordaligned. */ wordaligned. */
for (j = nargs - 1; j >= i; j--) for (j = nargs - 1; j >= i; j--)
{ {
const gdb_byte *bytes = value_contents (args[j]).data (); const gdb_byte *bytes = args[j]->contents ().data ();
typelen = args[j]->enclosing_type ()->length (); typelen = args[j]->enclosing_type ()->length ();
slacklen = typelen & 1; slacklen = typelen & 1;

View file

@ -1729,7 +1729,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
break; break;
} }
gdb_printf (gdb_stdlog, " %s\n", gdb_printf (gdb_stdlog, " %s\n",
host_address_to_string (value_contents (arg).data ())); host_address_to_string (arg->contents ().data ()));
} }
} }
@ -1785,7 +1785,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
break; break;
} }
info->length = arg_type->length (); info->length = arg_type->length ();
info->contents = value_contents (arg).data (); info->contents = arg->contents ().data ();
/* Align size and onstack_size. */ /* Align size and onstack_size. */
size = (size + info->align - 1) & ~(info->align - 1); size = (size + info->align - 1) & ~(info->align - 1);