diff options
author | Tom Tromey <tom@tromey.com> | 2023-01-31 13:45:40 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-02-13 15:21:08 -0700 |
commit | bbe912ba8898f5440028a35d0a206d70a6877ed6 (patch) | |
tree | 0ffc199020a35bd2968ce1a69d3686737eca7933 /gdb | |
parent | ee7bb2944b75ce482dbf3bdb2d396efc98f1cf89 (diff) | |
download | gdb-bbe912ba8898f5440028a35d0a206d70a6877ed6.zip gdb-bbe912ba8898f5440028a35d0a206d70a6877ed6.tar.gz gdb-bbe912ba8898f5440028a35d0a206d70a6877ed6.tar.bz2 |
Turn some value_contents functions into methods
This turns value_contents_raw, value_contents_writeable, and
value_contents_all_raw into methods on value. The remaining functions
will be changed later in the series; they were a bit trickier and so I
didn't include them in this patch.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/aarch64-linux-tdep.c | 2 | ||||
-rw-r--r-- | gdb/aarch64-tdep.c | 6 | ||||
-rw-r--r-- | gdb/ada-lang.c | 26 | ||||
-rw-r--r-- | gdb/amd64-tdep.c | 4 | ||||
-rw-r--r-- | gdb/amd64-windows-tdep.c | 2 | ||||
-rw-r--r-- | gdb/arch-utils.c | 2 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 4 | ||||
-rw-r--r-- | gdb/c-lang.c | 2 | ||||
-rw-r--r-- | gdb/cp-valprint.c | 2 | ||||
-rw-r--r-- | gdb/dummy-frame.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2/expr.c | 6 | ||||
-rw-r--r-- | gdb/dwarf2/loc.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 2 | ||||
-rw-r--r-- | gdb/eval.c | 10 | ||||
-rw-r--r-- | gdb/findvar.c | 6 | ||||
-rw-r--r-- | gdb/frame-unwind.c | 6 | ||||
-rw-r--r-- | gdb/frame.c | 4 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 4 | ||||
-rw-r--r-- | gdb/infrun.c | 4 | ||||
-rw-r--r-- | gdb/opencl-lang.c | 12 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 2 | ||||
-rw-r--r-- | gdb/regcache.c | 4 | ||||
-rw-r--r-- | gdb/riscv-tdep.c | 8 | ||||
-rw-r--r-- | gdb/sparc-tdep.c | 2 | ||||
-rw-r--r-- | gdb/std-regs.c | 4 | ||||
-rw-r--r-- | gdb/tracepoint.c | 2 | ||||
-rw-r--r-- | gdb/valarith.c | 20 | ||||
-rw-r--r-- | gdb/valops.c | 32 | ||||
-rw-r--r-- | gdb/valprint.c | 2 | ||||
-rw-r--r-- | gdb/value.c | 65 | ||||
-rw-r--r-- | gdb/value.h | 34 | ||||
-rw-r--r-- | gdb/windows-tdep.c | 2 |
32 files changed, 142 insertions, 145 deletions
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 20a041c..9d6ed35 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -1668,7 +1668,7 @@ aarch64_linux_set_memtags (struct gdbarch *gdbarch, struct value *address, /* Update the value's content with the tag. */ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - gdb_byte *srcbuf = value_contents_raw (address).data (); + gdb_byte *srcbuf = address->contents_raw ().data (); store_unsigned_integer (srcbuf, sizeof (addr), byte_order, addr); } else diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 76c92fd..1a6fdbe 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2494,7 +2494,7 @@ aarch64_return_value (struct gdbarch *gdbarch, struct value *func_value, { *read_value = value::allocate (valtype); aarch64_extract_return_value (valtype, regcache, - value_contents_raw (*read_value).data ()); + (*read_value)->contents_raw ().data ()); } aarch64_debug_printf ("return value in registers"); @@ -2769,7 +2769,7 @@ aarch64_pseudo_read_value_1 (struct gdbarch *gdbarch, mark_value_bytes_unavailable (result_value, 0, result_value->type ()->length ()); else - memcpy (value_contents_raw (result_value).data (), reg_buf, regsize); + memcpy (result_value->contents_raw ().data (), reg_buf, regsize); return result_value; } @@ -2803,7 +2803,7 @@ aarch64_pseudo_read_value (struct gdbarch *gdbarch, readable_regcache *regcache, if (regcache->raw_read_part (x_regnum, offset, 4, data) != REG_VALID) mark_value_bytes_unavailable (result_value, 0, 4); else - memcpy (value_contents_raw (result_value).data (), data, 4); + memcpy (result_value->contents_raw ().data (), data, 4); return result_value; } diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 53265ca..274b5e3 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2846,7 +2846,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, } else v->set_bitsize (bit_size); - unpacked = value_contents_writeable (v).data (); + unpacked = v->contents_writeable ().data (); if (bit_size == 0) { @@ -2921,7 +2921,7 @@ ada_value_assign (struct value *toval, struct value *fromval) write_memory_with_notification (to_addr, buffer, len); val = value_copy (toval); - memcpy (value_contents_raw (val).data (), + memcpy (val->contents_raw ().data (), value_contents (fromval).data (), type->length ()); val->deprecated_set_type (type); @@ -2970,13 +2970,13 @@ value_assign_to_component (struct value *container, struct value *component, = component->type ()->length () * TARGET_CHAR_BIT - bits; else src_offset = 0; - copy_bitwise ((value_contents_writeable (container).data () + copy_bitwise ((container->contents_writeable ().data () + offset_in_container), container->bitpos () + bit_offset_in_container, value_contents (val).data (), src_offset, bits, 1); } else - copy_bitwise ((value_contents_writeable (container).data () + copy_bitwise ((container->contents_writeable ().data () + offset_in_container), container->bitpos () + bit_offset_in_container, value_contents (val).data (), 0, bits, 0); @@ -4529,7 +4529,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0) actual_type = ada_check_typedef (actual->type ()); val = value::allocate (actual_type); - copy (value_contents (actual), value_contents_raw (val)); + copy (value_contents (actual), val->contents_raw ()); actual = ensure_lval (val); } result = value_addr (actual); @@ -4592,12 +4592,12 @@ make_array_descriptor (struct type *type, struct value *arr) i > 0; i -= 1) { modify_field (bounds->type (), - value_contents_writeable (bounds).data (), + bounds->contents_writeable ().data (), ada_array_bound (arr, i, 0), desc_bound_bitpos (bounds_type, i, 0), desc_bound_bitsize (bounds_type, i, 0)); modify_field (bounds->type (), - value_contents_writeable (bounds).data (), + bounds->contents_writeable ().data (), ada_array_bound (arr, i, 1), desc_bound_bitpos (bounds_type, i, 1), desc_bound_bitsize (bounds_type, i, 1)); @@ -4606,14 +4606,14 @@ make_array_descriptor (struct type *type, struct value *arr) bounds = ensure_lval (bounds); modify_field (descriptor->type (), - value_contents_writeable (descriptor).data (), + descriptor->contents_writeable ().data (), value_pointer (ensure_lval (arr), desc_type->field (0).type ()), fat_pntr_data_bitpos (desc_type), fat_pntr_data_bitsize (desc_type)); modify_field (descriptor->type (), - value_contents_writeable (descriptor).data (), + descriptor->contents_writeable ().data (), value_pointer (bounds, desc_type->field (1).type ()), fat_pntr_bounds_bitpos (desc_type), @@ -9282,7 +9282,7 @@ ada_promote_array_of_integrals (struct type *type, struct value *val) error (_("unable to determine array bounds")); value *res = value::allocate (type); - gdb::array_view<gdb_byte> res_contents = value_contents_writeable (res); + gdb::array_view<gdb_byte> res_contents = res->contents_writeable (); /* Promote each array element. */ for (i = 0; i < hi - lo + 1; i++) @@ -9404,7 +9404,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) } val = value::allocate (type1); - store_unsigned_integer (value_contents_raw (val).data (), + store_unsigned_integer (val->contents_raw ().data (), val->type ()->length (), type_byte_order (type1), v); return val; @@ -10668,7 +10668,7 @@ ada_string_operation::evaluate (struct type *expect_type, struct type *stringtype = lookup_array_range_type (char_type, 1, str.length ()); struct value *val = value::allocate (stringtype); - memcpy (value_contents_raw (val).data (), str.c_str (), + memcpy (val->contents_raw ().data (), str.c_str (), str.length ()); return val; } @@ -10703,7 +10703,7 @@ ada_string_operation::evaluate (struct type *expect_type, obstack_object_size (&converted) / char_type->length ()); struct value *val = value::allocate (stringtype); - memcpy (value_contents_raw (val).data (), + memcpy (val->contents_raw ().data (), obstack_base (&converted), obstack_object_size (&converted)); return val; diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 03e9ac9..085e532 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -358,7 +358,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch, value *result_value = value::allocate (register_type (gdbarch, regnum)); VALUE_LVAL (result_value) = lval_register; VALUE_REGNUM (result_value) = regnum; - gdb_byte *buf = value_contents_raw (result_value).data (); + gdb_byte *buf = result_value->contents_raw ().data (); if (i386_byte_regnum_p (gdbarch, regnum)) { @@ -832,7 +832,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function, if (read_value != nullptr) { *read_value = value::allocate (type); - readbuf = value_contents_raw (*read_value).data (); + readbuf = (*read_value)->contents_raw ().data (); } /* 8. If the class is COMPLEX_X87, the real part of the value is diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index aea8aaa..7a7fbbb 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -410,7 +410,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function, { *read_value = value::allocate (type); regcache->raw_read_part (regnum, 0, len, - value_contents_raw (*read_value).data ()); + (*read_value)->contents_raw ().data ()); } if (writebuf) regcache->raw_write_part (regnum, 0, len, writebuf); diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 49c699f..e3af9ce 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -1179,7 +1179,7 @@ default_gdbarch_return_value if (read_value != nullptr) { *read_value = value::allocate (valtype); - readbuf = value_contents_raw (*read_value).data (); + readbuf = (*read_value)->contents_raw ().data (); } return gdbarch->return_value (gdbarch, function, valtype, regcache, diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index c4b92ea..bf38880 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9193,7 +9193,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function, if (read_value != nullptr) { *read_value = value::allocate (valtype); - readbuf = value_contents_raw (*read_value).data (); + readbuf = (*read_value)->contents_raw ().data (); } for (i = 0; i < vfp_base_count; i++) @@ -9269,7 +9269,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function, if (read_value != nullptr) { *read_value = value::allocate (valtype); - gdb_byte *readbuf = value_contents_raw (*read_value).data (); + gdb_byte *readbuf = (*read_value)->contents_raw ().data (); arm_extract_return_value (valtype, regcache, readbuf); } diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 2559018..ec2e060 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -674,7 +674,7 @@ c_string_operation::evaluate (struct type *expect_type, error (_("Too many array elements")); result = value::allocate (expect_type); - memcpy (value_contents_raw (result).data (), obstack_base (&output), + memcpy (result->contents_raw ().data (), obstack_base (&output), obstack_object_size (&output)); } else diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 268a414..dd39682 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -762,7 +762,7 @@ test_print_fields (gdbarch *arch) } value *val = value::allocate (the_struct); - gdb_byte *contents = value_contents_writeable (val).data (); + gdb_byte *contents = val->contents_writeable ().data (); store_unsigned_integer (contents, val->enclosing_type ()->length (), gdbarch_byte_order (arch), 0xe9); diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 6c3dfb1..961b3ac 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -354,7 +354,7 @@ dummy_frame_prev_register (frame_info_ptr this_frame, constructs either a raw or pseudo register from the raw register cache. */ cache->prev_regcache->cooked_read - (regnum, value_contents_writeable (reg_val).data ()); + (regnum, reg_val->contents_writeable ().data ()); return reg_val; } diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index bb77a96..e08dca0 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -164,7 +164,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized) if (check_optimized) v_contents = nullptr; else - v_contents = value_contents_raw (v).data (); + v_contents = v->contents_raw ().data (); from_contents = nullptr; } @@ -1026,7 +1026,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type, subobj_offset += n - max; copy (value_contents_all (val).slice (subobj_offset, len), - value_contents_raw (retval)); + retval->contents_raw ()); } break; @@ -1038,7 +1038,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type, invalid_synthetic_pointer (); retval = value::allocate (subobj_type); - bfd_byte *contents = value_contents_raw (retval).data (); + bfd_byte *contents = retval->contents_raw ().data (); memcpy (contents, this->m_data + subobj_offset, n); } break; diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 96686d9..0aa6aaf 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -1363,8 +1363,8 @@ value_of_dwarf_reg_entry (struct type *type, frame_info_ptr frame, release_value (target_val).release ()); /* Copy the referencing pointer to the new computed value. */ - memcpy (value_contents_raw (val).data (), - value_contents_raw (outer_val).data (), + memcpy (val->contents_raw ().data (), + outer_val->contents_raw ().data (), checked_type->length ()); val->set_lazy (0); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 754e6be..470ff12 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -8992,7 +8992,7 @@ dwarf2_compute_name (const char *name, else if (bytes != NULL) { v = value::allocate (type); - memcpy (value_contents_writeable (v).data (), bytes, + memcpy (v->contents_writeable ().data (), bytes, type->length ()); } else @@ -2413,7 +2413,7 @@ array_operation::evaluate_struct_tuple (struct value *struct_val, bitsize = TYPE_FIELD_BITSIZE (struct_type, fieldno); bitpos = struct_type->field (fieldno).loc_bitpos (); - addr = value_contents_writeable (struct_val).data () + bitpos / 8; + addr = struct_val->contents_writeable ().data () + bitpos / 8; if (bitsize) modify_field (struct_type, addr, value_as_long (val), bitpos % 8, bitsize); @@ -2442,7 +2442,7 @@ array_operation::evaluate (struct type *expect_type, { struct value *rec = value::allocate (expect_type); - memset (value_contents_raw (rec).data (), '\0', type->length ()); + memset (rec->contents_raw ().data (), '\0', type->length ()); return evaluate_struct_tuple (rec, exp, noside, nargs); } @@ -2461,7 +2461,7 @@ array_operation::evaluate (struct type *expect_type, high_bound = (type->length () / element_size) - 1; } index = low_bound; - memset (value_contents_raw (array).data (), 0, expect_type->length ()); + memset (array->contents_raw ().data (), 0, expect_type->length ()); for (tem = nargs; --nargs >= 0;) { struct value *element; @@ -2473,7 +2473,7 @@ array_operation::evaluate (struct type *expect_type, if (index > high_bound) /* To avoid memory corruption. */ error (_("Too many array elements")); - memcpy (value_contents_raw (array).data () + memcpy (array->contents_raw ().data () + (index - low_bound) * element_size, value_contents (element).data (), element_size); @@ -2486,7 +2486,7 @@ array_operation::evaluate (struct type *expect_type, && type->code () == TYPE_CODE_SET) { struct value *set = value::allocate (expect_type); - gdb_byte *valaddr = value_contents_raw (set).data (); + gdb_byte *valaddr = set->contents_raw ().data (); struct type *element_type = type->index_type (); struct type *check_type = element_type; LONGEST low_bound, high_bound; diff --git a/gdb/findvar.c b/gdb/findvar.c index 048e439..a64b35c 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -587,7 +587,7 @@ language_defn::read_var_value (struct symbol *var, } /* Put the constant back in target format. */ v = value::allocate (type); - store_signed_integer (value_contents_raw (v).data (), type->length (), + store_signed_integer (v->contents_raw ().data (), type->length (), type_byte_order (type), var->value_longest ()); VALUE_LVAL (v) = not_lval; return v; @@ -627,7 +627,7 @@ language_defn::read_var_value (struct symbol *var, type = resolve_dynamic_type (type, {}, /* Unused address. */ 0); } v = value::allocate (type); - memcpy (value_contents_raw (v).data (), var->value_bytes (), + memcpy (v->contents_raw ().data (), var->value_bytes (), type->length ()); VALUE_LVAL (v) = not_lval; return v; @@ -900,7 +900,7 @@ value_from_register (struct type *type, int regnum, frame_info_ptr frame) VALUE_NEXT_FRAME_ID (v) = get_frame_id (get_next_frame_sentinel_okay (frame)); VALUE_REGNUM (v) = regnum; ok = gdbarch_register_to_value (gdbarch, frame, regnum, type1, - value_contents_raw (v).data (), &optim, + v->contents_raw ().data (), &optim, &unavail); if (!ok) diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index c884cdd..e5f8dc6 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -305,7 +305,7 @@ frame_unwind_got_constant (frame_info_ptr frame, int regnum, struct value *reg_val; reg_val = value::zero (register_type (gdbarch, regnum), not_lval); - store_unsigned_integer (value_contents_writeable (reg_val).data (), + store_unsigned_integer (reg_val->contents_writeable ().data (), register_size (gdbarch, regnum), byte_order, val); return reg_val; } @@ -317,7 +317,7 @@ frame_unwind_got_bytes (frame_info_ptr frame, int regnum, const gdb_byte *buf) struct value *reg_val; reg_val = value::zero (register_type (gdbarch, regnum), not_lval); - memcpy (value_contents_raw (reg_val).data (), buf, + memcpy (reg_val->contents_raw ().data (), buf, register_size (gdbarch, regnum)); return reg_val; } @@ -334,7 +334,7 @@ frame_unwind_got_address (frame_info_ptr frame, int regnum, struct value *reg_val; reg_val = value::zero (register_type (gdbarch, regnum), not_lval); - pack_long (value_contents_writeable (reg_val).data (), + pack_long (reg_val->contents_writeable ().data (), register_type (gdbarch, regnum), addr); return reg_val; } diff --git a/gdb/frame.c b/gdb/frame.c index a4c4482..834adc3 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1598,10 +1598,10 @@ put_frame_register_bytes (frame_info_ptr frame, int regnum, regnum); gdb_assert (value != NULL); - memcpy ((char *) value_contents_writeable (value).data () + offset, + memcpy ((char *) value->contents_writeable ().data () + offset, myaddr, curr_len); put_frame_register (frame, regnum, - value_contents_raw (value).data ()); + value->contents_raw ().data ()); release_value (value); } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 3462125..94ec1cc 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -3095,7 +3095,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function, { *read_value = value::allocate (type); i386_extract_return_value (gdbarch, type, regcache, - value_contents_raw (*read_value).data ()); + (*read_value)->contents_raw ().data ()); } if (writebuf) i386_store_return_value (gdbarch, type, regcache, writebuf); @@ -3379,7 +3379,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch, { gdb_byte raw_buf[I386_MAX_REGISTER_SIZE]; enum register_status status; - gdb_byte *buf = value_contents_raw (result_value).data (); + gdb_byte *buf = result_value->contents_raw ().data (); if (i386_mmx_regnum_p (gdbarch, regnum)) { diff --git a/gdb/infrun.c b/gdb/infrun.c index c45c6b5..c571858 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -9143,7 +9143,7 @@ siginfo_value_read (struct value *v) target_read (current_inferior ()->top_target (), TARGET_OBJECT_SIGNAL_INFO, nullptr, - value_contents_all_raw (v).data (), + v->contents_all_raw ().data (), v->offset (), v->type ()->length ()); @@ -9166,7 +9166,7 @@ siginfo_value_write (struct value *v, struct value *fromval) transferred = target_write (current_inferior ()->top_target (), TARGET_OBJECT_SIGNAL_INFO, nullptr, - value_contents_all_raw (fromval).data (), + fromval->contents_all_raw ().data (), v->offset (), fromval->type ()->length ()); diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index dc34dee..8bc727c 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -139,7 +139,7 @@ lval_func_read (struct value *v) gdb_assert (n <= c->n); for (i = offset; i < n; i++) - memcpy (value_contents_raw (v).data () + j++ * elsize, + memcpy (v->contents_raw ().data () + j++ * elsize, value_contents (c->val).data () + c->indices[i] * elsize, elsize); } @@ -180,7 +180,7 @@ lval_func_write (struct value *v, struct value *fromval) struct value *from_elm_val = value::allocate (eltype); struct value *to_elm_val = value_subscript (c->val, c->indices[i]); - memcpy (value_contents_writeable (from_elm_val).data (), + memcpy (from_elm_val->contents_writeable ().data (), value_contents (fromval).data () + j++ * elsize, elsize); value_assign (to_elm_val, from_elm_val); @@ -314,7 +314,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside, /* Copy src val contents into the destination value. */ for (i = 0; i < n; i++) - memcpy (value_contents_writeable (ret).data () + memcpy (ret->contents_writeable ().data () + (i * elm_type->length ()), value_contents (val).data () + (indices[i] * elm_type->length ()), @@ -472,7 +472,7 @@ opencl_logical_not (struct type *expect_type, struct expression *exp, value of its operand compares unequal to 0, and -1 (i.e. all bits set) if the value of its operand compares equal to 0. */ int tmp = value_logical_not (value_subscript (arg, i)) ? -1 : 0; - memset ((value_contents_writeable (ret).data () + memset ((ret->contents_writeable ().data () + i * eltype->length ()), tmp, eltype->length ()); } @@ -573,7 +573,7 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2, if the specified relation is true. */ int tmp = scalar_relop (value_subscript (val1, i), value_subscript (val2, i), op) ? -1 : 0; - memset ((value_contents_writeable (ret).data () + memset ((ret->contents_writeable ().data () + i * eltype1->length ()), tmp, eltype1->length ()); } @@ -837,7 +837,7 @@ Cannot perform conditional operation on vectors with different sizes")); { tmp = value_logical_not (value_subscript (arg1, i)) ? value_subscript (arg3, i) : value_subscript (arg2, i); - memcpy (value_contents_writeable (ret).data () + + memcpy (ret->contents_writeable ().data () + i * eltype2->length (), value_contents_all (tmp).data (), eltype2->length ()); } diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 2084e2b..fcddb20 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -255,7 +255,7 @@ ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function, if (read_value != nullptr) { *read_value = value::allocate (valtype); - readbuf = value_contents_raw (*read_value).data (); + readbuf = (*read_value)->contents_raw ().data (); } if ((valtype->code () == TYPE_CODE_STRUCT diff --git a/gdb/regcache.c b/gdb/regcache.c index 4a31dd5..9098959 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -716,7 +716,7 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf) computed = gdbarch_pseudo_register_read_value (m_descr->gdbarch, this, regnum); if (value_entirely_available (computed)) - memcpy (buf, value_contents_raw (computed).data (), + memcpy (buf, computed->contents_raw ().data (), m_descr->sizeof_register[regnum]); else { @@ -751,7 +751,7 @@ readable_regcache::cooked_read_value (int regnum) direction than in the other one, even though the value-based API is preferred. */ if (cooked_read (regnum, - value_contents_raw (result).data ()) == REG_UNAVAILABLE) + result->contents_raw ().data ()) == REG_UNAVAILABLE) mark_value_bytes_unavailable (result, 0, result->type ()->length ()); diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 375ba42..f8be46c 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -3278,7 +3278,7 @@ riscv_return_value (struct gdbarch *gdbarch, type_byte_order (arg_type), arg_type->is_unsigned ()); abi_val = value::allocate (info.type); - unscaled.write (value_contents_raw (abi_val), + unscaled.write (abi_val->contents_raw (), type_byte_order (info.type), info.type->is_unsigned ()); } @@ -3287,12 +3287,12 @@ riscv_return_value (struct gdbarch *gdbarch, arg_val = value_from_contents (arg_type, writebuf); abi_val = value_cast (info.type, arg_val); } - writebuf = value_contents_raw (abi_val).data (); + writebuf = abi_val->contents_raw ().data (); } else { abi_val = value::allocate (info.type); - readbuf = value_contents_raw (abi_val).data (); + readbuf = abi_val->contents_raw ().data (); } arg_len = info.type->length (); @@ -3409,7 +3409,7 @@ riscv_return_value (struct gdbarch *gdbarch, type_byte_order (info.type), info.type->is_unsigned ()); *read_value = value::allocate (arg_type); - unscaled.write (value_contents_raw (*read_value), + unscaled.write ((*read_value)->contents_raw (), type_byte_order (arg_type), arg_type->is_unsigned ()); } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 44f1621..5e582c7 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1531,7 +1531,7 @@ sparc32_return_value (struct gdbarch *gdbarch, struct value *function, if (read_value != nullptr) { *read_value = value::allocate (type); - gdb_byte *readbuf = value_contents_raw (*read_value).data (); + gdb_byte *readbuf = (*read_value)->contents_raw ().data (); sparc32_extract_return_value (type, regcache, readbuf); } if (writebuf) diff --git a/gdb/std-regs.c b/gdb/std-regs.c index 5520789..54cf901 100644 --- a/gdb/std-regs.c +++ b/gdb/std-regs.c @@ -44,7 +44,7 @@ value_of_builtin_frame_fp_reg (frame_info_ptr frame, const void *baton) { struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr; struct value *val = value::allocate (data_ptr_type); - gdb_byte *buf = value_contents_raw (val).data (); + gdb_byte *buf = val->contents_raw ().data (); gdbarch_address_to_pointer (gdbarch, data_ptr_type, buf, get_frame_base_address (frame)); @@ -63,7 +63,7 @@ value_of_builtin_frame_pc_reg (frame_info_ptr frame, const void *baton) { struct type *func_ptr_type = builtin_type (gdbarch)->builtin_func_ptr; struct value *val = value::allocate (func_ptr_type); - gdb_byte *buf = value_contents_raw (val).data (); + gdb_byte *buf = val->contents_raw ().data (); gdbarch_address_to_pointer (gdbarch, func_ptr_type, buf, get_frame_pc (frame)); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index bd02cae..1c1fea7 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -3778,7 +3778,7 @@ sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var, type = init_vector_type (builtin_type (gdbarch)->builtin_true_char, buf->size ()); v = value::allocate (type); - memcpy (value_contents_raw (v).data (), buf->data (), buf->size ()); + memcpy (v->contents_raw ().data (), buf->data (), buf->size ()); return v; } else diff --git a/gdb/valarith.c b/gdb/valarith.c index 715879d..cd3a9c8 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -717,7 +717,7 @@ value_concat (struct value *arg1, struct value *arg2) lowbound + n_elts - 1); struct value *result = value::allocate (atype); - gdb::array_view<gdb_byte> contents = value_contents_raw (result); + 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> rhs_contents = value_contents (arg2); gdb::copy (lhs_contents, contents.slice (0, lhs_contents.size ())); @@ -872,7 +872,7 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) value *fp_val = value::allocate (type1); fp.write_fixed_point - (value_contents_raw (fp_val), + (fp_val->contents_raw (), type_byte_order (type1), type1->is_unsigned (), type1->fixed_point_scaling_factor ()); @@ -1191,7 +1191,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) v2.data (), &eff_type_v2); target_float_binop (op, v1.data (), eff_type_v1, v2.data (), eff_type_v2, - value_contents_raw (val).data (), result_type); + val->contents_raw ().data (), result_type); } else if (type1->code () == TYPE_CODE_BOOL || type2->code () == TYPE_CODE_BOOL) @@ -1230,7 +1230,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) result_type = type1; val = value::allocate (result_type); - store_signed_integer (value_contents_raw (val).data (), + store_signed_integer (val->contents_raw ().data (), result_type->length (), type_byte_order (result_type), v); @@ -1376,7 +1376,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) } val = value::allocate (result_type); - store_unsigned_integer (value_contents_raw (val).data (), + store_unsigned_integer (val->contents_raw ().data (), val->type ()->length (), type_byte_order (result_type), v); @@ -1537,7 +1537,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) } val = value::allocate (result_type); - store_signed_integer (value_contents_raw (val).data (), + store_signed_integer (val->contents_raw ().data (), val->type ()->length (), type_byte_order (result_type), v); @@ -1582,7 +1582,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type) error (_("conversion of scalar to vector involves truncation")); value *val = value::allocate (vector_type); - gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val); + gdb::array_view<gdb_byte> val_contents = val->contents_writeable (); int elt_len = eltype->length (); for (i = 0; i < high_bound - low_bound + 1; i++) @@ -1629,7 +1629,7 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op) error (_("Cannot perform operation on vectors with different types")); value *val = value::allocate (type1); - gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val); + gdb::array_view<gdb_byte> val_contents = val->contents_writeable (); scoped_value_mark mark; for (i = 0; i < high_bound1 - low_bound1 + 1; i++) { @@ -1924,7 +1924,7 @@ value_neg (struct value *arg1) if (!get_array_bounds (type, &low_bound, &high_bound)) error (_("Could not determine the vector bounds")); - gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val); + gdb::array_view<gdb_byte> val_contents = val->contents_writeable (); int elt_len = eltype->length (); for (i = 0; i < high_bound - low_bound + 1; i++) @@ -1969,7 +1969,7 @@ value_complement (struct value *arg1) error (_("Could not determine the vector bounds")); val = value::allocate (type); - gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val); + gdb::array_view<gdb_byte> val_contents = val->contents_writeable (); int elt_len = eltype->length (); for (i = 0; i < high_bound - low_bound + 1; i++) diff --git a/gdb/valops.c b/gdb/valops.c index 50f8903..99dede8 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -392,7 +392,7 @@ value_cast_to_fixed_point (struct type *to_type, struct value *from_val) /* Finally, create the result value, and pack the unscaled value in it. */ struct value *result = value::allocate (to_type); - unscaled.write (value_contents_raw (result), + unscaled.write (result->contents_raw (), type_byte_order (to_type), to_type->is_unsigned ()); @@ -545,7 +545,7 @@ value_cast (struct type *type, struct value *arg2) { struct value *v = value::allocate (to_type); target_float_convert (value_contents (arg2).data (), type2, - value_contents_raw (v).data (), type); + v->contents_raw ().data (), type); return v; } else if (is_fixed_point_type (type2)) @@ -558,7 +558,7 @@ value_cast (struct type *type, struct value *arg2) type2->fixed_point_scaling_factor ()); struct value *v = value::allocate (to_type); - target_float_from_host_double (value_contents_raw (v).data (), + target_float_from_host_double (v->contents_raw ().data (), to_type, mpq_get_d (fp_val.val)); return v; } @@ -621,7 +621,7 @@ value_cast (struct type *type, struct value *arg2) struct value *result = value::allocate (to_type); cplus_make_method_ptr (to_type, - value_contents_writeable (result).data (), 0, 0); + result->contents_writeable ().data (), 0, 0); return result; } else if (code1 == TYPE_CODE_MEMBERPTR && code2 == TYPE_CODE_INT @@ -955,7 +955,7 @@ value_one (struct type *type) error (_("Could not determine the vector bounds")); val = value::allocate (type); - gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val); + gdb::array_view<gdb_byte> val_contents = val->contents_writeable (); int elt_len = eltype->length (); for (i = 0; i < high_bound - low_bound + 1; i++) @@ -1344,7 +1344,7 @@ value_assign (struct value *toval, struct value *fromval) implies the returned value is not lazy, even if TOVAL was. */ val = value_copy (toval); val->set_lazy (0); - copy (value_contents (fromval), value_contents_raw (val)); + copy (value_contents (fromval), val->contents_raw ()); /* We copy over the enclosing type and pointed-to offset from FROMVAL in the case of pointer types. For object types, the enclosing type @@ -1377,7 +1377,7 @@ value_repeat (struct value *arg1, int count) val->set_address (arg1->address ()); read_value_memory (val, 0, val->stack (), val->address (), - value_contents_all_raw (val).data (), + val->contents_all_raw ().data (), type_length_units (val->enclosing_type ())); return val; @@ -1750,7 +1750,7 @@ value_cstring (const char *ptr, ssize_t len, struct type *char_type) = lookup_array_range_type (char_type, lowbound, highbound + lowbound - 1); val = value::allocate (stringtype); - memcpy (value_contents_raw (val).data (), ptr, len); + memcpy (val->contents_raw ().data (), ptr, len); return val; } @@ -1773,7 +1773,7 @@ value_string (const char *ptr, ssize_t len, struct type *char_type) = lookup_string_range_type (char_type, lowbound, highbound + lowbound - 1); val = value::allocate (stringtype); - memcpy (value_contents_raw (val).data (), ptr, len); + memcpy (val->contents_raw ().data (), ptr, len); return val; } @@ -2101,7 +2101,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset, base_addr = arg1->address () + boffset; v2 = value_at_lazy (basetype, base_addr); if (target_read_memory (base_addr, - value_contents_raw (v2).data (), + v2->contents_raw ().data (), v2->type ()->length ()) != 0) error (_("virtual baseclass botch")); } @@ -3740,7 +3740,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, result = value::allocate (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j))); cplus_make_method_ptr (result->type (), - value_contents_writeable (result).data (), + result->contents_writeable ().data (), TYPE_FN_FIELD_VOFFSET (f, j), 1); } else if (noside == EVAL_AVOID_SIDE_EFFECTS) @@ -3765,7 +3765,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, { result = value::allocate (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j))); cplus_make_method_ptr (result->type (), - value_contents_writeable (result).data (), + result->contents_writeable ().data (), v->address (), 0); } } @@ -4111,9 +4111,9 @@ value_literal_complex (struct value *arg1, int len = real_type->length (); copy (value_contents (arg1), - value_contents_raw (val).slice (0, len)); + val->contents_raw ().slice (0, len)); copy (value_contents (arg2), - value_contents_raw (val).slice (len, len)); + val->contents_raw ().slice (len, len)); return val; } @@ -4158,9 +4158,9 @@ cast_into_complex (struct type *type, struct value *val) int len = val_real_type->length (); copy (value_contents (val).slice (0, len), - value_contents_raw (re_val)); + re_val->contents_raw ()); copy (value_contents (val).slice (len, len), - value_contents_raw (im_val)); + im_val->contents_raw ()); return value_literal_complex (re_val, im_val, type); } diff --git a/gdb/valprint.c b/gdb/valprint.c index 578a229..1ad964a 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -3100,7 +3100,7 @@ test_print_flags (gdbarch *arch) append_flags_type_field (flags_type, 5, 3, field_type, "C"); value *val = value::allocate (flags_type); - gdb_byte *contents = value_contents_writeable (val).data (); + gdb_byte *contents = val->contents_writeable ().data (); store_unsigned_integer (contents, 4, gdbarch_byte_order (arch), 0xaa); string_file out; diff --git a/gdb/value.c b/gdb/value.c index 4dfd8fe..811c635 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1023,25 +1023,24 @@ value::allocate_optimized_out (struct type *type) /* Accessor methods. */ gdb::array_view<gdb_byte> -value_contents_raw (struct value *value) +value::contents_raw () { - struct gdbarch *arch = value->arch (); - int unit_size = gdbarch_addressable_memory_unit_size (arch); + int unit_size = gdbarch_addressable_memory_unit_size (arch ()); - allocate_value_contents (value, true); + allocate_value_contents (this, true); - ULONGEST length = value->type ()->length (); + ULONGEST length = type ()->length (); return gdb::make_array_view - (value->m_contents.get () + value->m_embedded_offset * unit_size, length); + (m_contents.get () + m_embedded_offset * unit_size, length); } gdb::array_view<gdb_byte> -value_contents_all_raw (struct value *value) +value::contents_all_raw () { - allocate_value_contents (value, true); + allocate_value_contents (this, true); - ULONGEST length = value->enclosing_type ()->length (); - return gdb::make_array_view (value->m_contents.get (), length); + ULONGEST length = enclosing_type ()->length (); + return gdb::make_array_view (m_contents.get (), length); } /* Look at value.h for description. */ @@ -1215,10 +1214,10 @@ value_contents_copy_raw (struct value *dst, LONGEST dst_offset, /* Copy the data. */ gdb::array_view<gdb_byte> dst_contents - = value_contents_all_raw (dst).slice (dst_offset * unit_size, + = dst->contents_all_raw ().slice (dst_offset * unit_size, length * unit_size); gdb::array_view<const gdb_byte> src_contents - = value_contents_all_raw (src).slice (src_offset * unit_size, + = src->contents_all_raw ().slice (src_offset * unit_size, length * unit_size); copy (src_contents, dst_contents); @@ -1256,8 +1255,8 @@ value_contents_copy_raw_bitwise (struct value *dst, LONGEST dst_bit_offset, bit_length)); /* Copy the data. */ - gdb::array_view<gdb_byte> dst_contents = value_contents_all_raw (dst); - gdb::array_view<const gdb_byte> src_contents = value_contents_all_raw (src); + gdb::array_view<gdb_byte> dst_contents = dst->contents_all_raw (); + gdb::array_view<const gdb_byte> src_contents = src->contents_all_raw (); copy_bitwise (dst_contents.data (), dst_bit_offset, src_contents.data (), src_bit_offset, bit_length, @@ -1292,18 +1291,18 @@ value_contents_copy (struct value *dst, LONGEST dst_offset, gdb::array_view<const gdb_byte> value_contents (struct value *value) { - gdb::array_view<const gdb_byte> result = value_contents_writeable (value); + gdb::array_view<const gdb_byte> result = value->contents_writeable (); require_not_optimized_out (value); require_available (value); return result; } gdb::array_view<gdb_byte> -value_contents_writeable (struct value *value) +value::contents_writeable () { - if (value->m_lazy) - value_fetch_lazy (value); - return value_contents_raw (value); + if (m_lazy) + value_fetch_lazy (this); + return contents_raw (); } int @@ -1577,7 +1576,7 @@ value_copy (const value *arg) allocate_value_contents (val, false); gdb::array_view<gdb_byte> val_contents - = value_contents_all_raw (val).slice (0, length); + = val->contents_all_raw ().slice (0, length); copy (arg_view, val_contents); } @@ -1621,7 +1620,7 @@ value_non_lval (struct value *arg) struct type *enc_type = arg->enclosing_type (); struct value *val = value::allocate (enc_type); - copy (value_contents_all (arg), value_contents_all_raw (val)); + copy (value_contents_all (arg), val->contents_all_raw ()); val->m_type = arg->m_type; val->set_embedded_offset (arg->embedded_offset ()); val->set_pointed_to_offset (arg->pointed_to_offset ()); @@ -1637,7 +1636,7 @@ value_force_lval (struct value *v, CORE_ADDR addr) { gdb_assert (VALUE_LVAL (v) == not_lval); - write_memory (addr, value_contents_raw (v).data (), v->type ()->length ()); + write_memory (addr, v->contents_raw ().data (), v->type ()->length ()); v->m_lval = lval_memory; v->m_location.address = addr; } @@ -2190,15 +2189,15 @@ set_internalvar_component (struct internalvar *var, LONGEST bitsize, struct value *newval) { gdb_byte *addr; - struct gdbarch *arch; + struct gdbarch *gdbarch; int unit_size; switch (var->kind) { case INTERNALVAR_VALUE: - addr = value_contents_writeable (var->u.value).data (); - arch = var->u.value->arch (); - unit_size = gdbarch_addressable_memory_unit_size (arch); + addr = var->u.value->contents_writeable ().data (); + gdbarch = var->u.value->arch (); + unit_size = gdbarch_addressable_memory_unit_size (gdbarch); if (bitsize) modify_field (var->u.value->type (), addr + offset, @@ -3231,7 +3230,7 @@ unpack_value_bitfield (struct value *dest_val, num = unpack_bits_as_long (field_type, valaddr + embedded_offset, bitpos, bitsize); - store_signed_integer (value_contents_raw (dest_val).data (), + store_signed_integer (dest_val->contents_raw ().data (), field_type->length (), byte_order, num); } @@ -3437,7 +3436,7 @@ value_from_longest (struct type *type, LONGEST num) { struct value *val = value::allocate (type); - pack_long (value_contents_raw (val).data (), type, num); + pack_long (val->contents_raw ().data (), type, num); return val; } @@ -3449,7 +3448,7 @@ value_from_ulongest (struct type *type, ULONGEST num) { struct value *val = value::allocate (type); - pack_unsigned_long (value_contents_raw (val).data (), type, num); + pack_unsigned_long (val->contents_raw ().data (), type, num); return val; } @@ -3463,7 +3462,7 @@ value_from_pointer (struct type *type, CORE_ADDR addr) { struct value *val = value::allocate (type); - store_typed_address (value_contents_raw (val).data (), + store_typed_address (val->contents_raw ().data (), check_typedef (type), addr); return val; } @@ -3477,7 +3476,7 @@ value_from_host_double (struct type *type, double d) { struct value *value = value::allocate (type); gdb_assert (type->code () == TYPE_CODE_FLT); - target_float_from_host_double (value_contents_raw (value).data (), + target_float_from_host_double (value->contents_raw ().data (), value->type (), d); return value; } @@ -3543,7 +3542,7 @@ value_from_contents (struct type *type, const gdb_byte *contents) struct value *result; result = value::allocate (type); - memcpy (value_contents_raw (result).data (), contents, type->length ()); + memcpy (result->contents_raw ().data (), contents, type->length ()); return result; } @@ -3837,7 +3836,7 @@ value_fetch_lazy_memory (struct value *val) if (len > 0) read_value_memory (val, 0, val->stack (), addr, - value_contents_all_raw (val).data (), len); + val->contents_all_raw ().data (), len); } /* Helper for value_fetch_lazy when the value is in a register. */ diff --git a/gdb/value.h b/gdb/value.h index 4213a55..66074a1 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -370,6 +370,22 @@ public: int *deprecated_regnum_hack (); + /* contents() and contents_raw() both return the address of the gdb + buffer used to hold a copy of the contents of the lval. + contents() is used when the contents of the buffer are needed -- + it uses fetch_lazy() to load the buffer from the process being + debugged if it hasn't already been loaded (contents_writeable() + is used when a writeable but fetched buffer is required).. + contents_raw() is used when data is being stored into the buffer, + or when it is certain that the contents of the buffer are valid. + + Note: The contents pointer is adjusted by the offset required to + get to the real subobject, if the value happens to represent + something embedded in a larger run-time object. */ + gdb::array_view<gdb_byte> contents_raw (); + gdb::array_view<gdb_byte> contents_all_raw (); + gdb::array_view<gdb_byte> contents_writeable (); + /* Type of value; either not an lval, or one of the various different possible kinds of lval. */ @@ -636,22 +652,6 @@ struct lval_funcs extern void error_value_optimized_out (void); -/* value_contents() and value_contents_raw() both return the address - of the gdb buffer used to hold a copy of the contents of the lval. - value_contents() is used when the contents of the buffer are needed - -- it uses value_fetch_lazy() to load the buffer from the process - being debugged if it hasn't already been loaded - (value_contents_writeable() is used when a writeable but fetched - buffer is required).. value_contents_raw() is used when data is - being stored into the buffer, or when it is certain that the - contents of the buffer are valid. - - Note: The contents pointer is adjusted by the offset required to - get to the real subobject, if the value happens to represent - something embedded in a larger run-time object. */ - -extern gdb::array_view<gdb_byte> value_contents_raw (struct value *); - /* 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 @@ -659,12 +659,10 @@ extern gdb::array_view<gdb_byte> value_contents_raw (struct value *); declared here. */ extern gdb::array_view<const gdb_byte> value_contents (struct value *); -extern gdb::array_view<gdb_byte> value_contents_writeable (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<gdb_byte> value_contents_all_raw (struct value *); extern gdb::array_view<const gdb_byte> value_contents_all (struct value *); /* Like value_contents_all, but does not require that the returned diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 893e34d..9719952 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -404,7 +404,7 @@ tlb_value_read (struct value *val) if (!target_get_tib_address (inferior_ptid, &tlb)) error (_("Unable to read tlb")); - store_typed_address (value_contents_raw (val).data (), type, tlb); + store_typed_address (val->contents_raw ().data (), type, tlb); } /* This function implements the lval_computed support for writing a |