diff options
45 files changed, 166 insertions, 167 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 05f8c3f..e13359a 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -571,7 +571,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) result->set_bitsize (val->bitsize ()); result->set_bitpos (val->bitpos ()); if (VALUE_LVAL (result) == lval_memory) - set_value_address (result, value_address (val)); + result->set_address (val->address ()); return result; } } @@ -1764,7 +1764,7 @@ thin_data_pntr (struct value *val) if (type->code () == TYPE_CODE_PTR) return value_cast (data_type, value_copy (val)); else - return value_from_longest (data_type, value_address (val)); + return value_from_longest (data_type, val->address ()); } /* True iff TYPE indicates a "thick" array pointer type. */ @@ -1830,7 +1830,7 @@ desc_bounds (struct value *arr) if (type->code () == TYPE_CODE_PTR) addr = value_as_long (arr); else - addr = value_address (arr); + addr = arr->address (); return value_from_longest (lookup_pointer_type (bounds_type), @@ -2517,7 +2517,7 @@ decode_constrained_packed_array (struct value *arr) we further resolve the array bounds here and then update the sizes. */ const gdb_byte *valaddr = value_contents_for_printing (arr).data (); - CORE_ADDR address = value_address (arr); + CORE_ADDR address = arr->address (); gdb::array_view<const gdb_byte> view = gdb::make_array_view (valaddr, type->length ()); type = resolve_dynamic_type (type, view, address); @@ -2815,9 +2815,9 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, int src_len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8; gdb_byte *buf; - v = value_at (type, value_address (obj) + offset); + v = value_at (type, obj->address () + offset); buf = (gdb_byte *) alloca (src_len); - read_memory (value_address (v), buf, src_len); + read_memory (v->address (), buf, src_len); src = buf; } else @@ -2901,7 +2901,7 @@ ada_value_assign (struct value *toval, struct value *fromval) int from_size; gdb_byte *buffer = (gdb_byte *) alloca (len); struct value *val; - CORE_ADDR to_addr = value_address (toval); + CORE_ADDR to_addr = toval->address (); if (type->code () == TYPE_CODE_FLT) fromval = value_cast (type, fromval); @@ -2949,7 +2949,7 @@ value_assign_to_component (struct value *container, struct value *component, struct value *val) { LONGEST offset_in_container = - (LONGEST) (value_address (component) - value_address (container)); + (LONGEST) (component->address () - container->address ()); int bit_offset_in_container = component->bitpos () - container->bitpos (); int bits; @@ -4357,7 +4357,7 @@ ensure_lval (struct value *val) value_as_long (value_allocate_space_in_inferior (len)); VALUE_LVAL (val) = lval_memory; - set_value_address (val, addr); + val->set_address (addr); write_memory (addr, value_contents (val).data (), len); } @@ -4425,9 +4425,9 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) CORE_ADDR address; if (t->code () == TYPE_CODE_PTR) - address = value_address (ada_value_ind (arg)); + address = ada_value_ind (arg)->address (); else - address = value_address (ada_coerce_ref (arg)); + address = ada_coerce_ref (arg)->address (); /* Check to see if this is a tagged type. We also need to handle the case where the type is a reference to a tagged type, but @@ -4566,7 +4566,7 @@ value_pointer (struct value *value, struct type *type) gdb_byte *buf = (gdb_byte *) alloca (len); CORE_ADDR addr; - addr = value_address (value); + addr = value->address (); gdbarch_address_to_pointer (type->arch (), type, buf, addr); addr = extract_unsigned_integer (buf, len, type_byte_order (type)); return addr; @@ -6510,7 +6510,7 @@ ada_tag_value_at_base_address (struct value *obj) offset_to_top = -offset_to_top; } - base_address = value_address (obj) + offset_to_top; + base_address = obj->address () + offset_to_top; tag = value_tag_from_contents_and_address (obj_type, NULL, base_address); /* Make sure that we have a proper tag at the new address. @@ -8591,7 +8591,7 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr, if (real_type != NULL) return to_fixed_record_type (real_type, NULL, - value_address (ada_tag_value_at_base_address (obj)), NULL); + ada_tag_value_at_base_address (obj)->address (), NULL); } /* Check to see if there is a parallel ___XVZ variable. @@ -8860,7 +8860,7 @@ struct value * ada_to_fixed_value (struct value *val) { val = unwrap_value (val); - val = ada_to_fixed_value_create (val->type (), value_address (val), val); + val = ada_to_fixed_value_create (val->type (), val->address (), val); return val; } @@ -9225,7 +9225,7 @@ unwrap_value (struct value *val) return coerce_unspec_val_to_type (val, ada_to_fixed_type (raw_real_type, 0, - value_address (val), + val->address (), NULL, 1)); } } @@ -12033,7 +12033,7 @@ ada_exception_message_1 (void) return NULL; gdb::unique_xmalloc_ptr<char> e_msg ((char *) xmalloc (e_msg_len + 1)); - read_memory (value_address (e_msg_val), (gdb_byte *) e_msg.get (), + read_memory (e_msg_val->address (), (gdb_byte *) e_msg.get (), e_msg_len); e_msg.get ()[e_msg_len] = '\0'; diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 979d64a..671ad7a 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -484,7 +484,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len) /* Extract LEN characters from the fat string. */ array_val = value_ind (value_field (val, array_fieldno)); - read_memory (value_address (array_val), (gdb_byte *) dest, len); + read_memory (array_val->address (), (gdb_byte *) dest, len); /* Add the NUL character to close the string. */ dest[len] = '\0'; diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 64d7ac1..814678e 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -1022,7 +1022,7 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse, struct type *saved_type = type; const gdb_byte *valaddr = value_contents_for_printing (val).data (); - CORE_ADDR address = value_address (val); + CORE_ADDR address = val->address (); gdb::array_view<const gdb_byte> view = gdb::make_array_view (valaddr, type->length ()); type = ada_check_typedef (resolve_dynamic_type (type, view, address)); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 0c36ec0..d6ebb5e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2108,7 +2108,7 @@ update_watchpoint (struct watchpoint *b, bool reparse) bitsize = b->val_bitsize; } - addr = value_address (v); + addr = v->address (); if (bitsize != 0) { /* Skip the bytes that don't contain the bitfield. */ @@ -10435,7 +10435,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals) || (vtype->code () != TYPE_CODE_STRUCT && vtype->code () != TYPE_CODE_ARRAY)) { - CORE_ADDR vaddr = value_address (v); + CORE_ADDR vaddr = v->address (); int len; int num_regs; diff --git a/gdb/c-lang.c b/gdb/c-lang.c index c2c7631..a2c50c3 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -331,7 +331,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer, if (VALUE_LVAL (value) != lval_memory) error (_("Attempt to take address of value " "not located in memory.")); - addr = value_address (value); + addr = value->address (); } else addr = value_as_address (value); diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 8cfb378..63f3e50 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -236,7 +236,7 @@ c_value_print_array (struct value *val, const struct value_print_options *options) { struct type *type = check_typedef (val->type ()); - CORE_ADDR address = value_address (val); + CORE_ADDR address = val->address (); const gdb_byte *valaddr = value_contents_for_printing (val).data (); struct type *unresolved_elttype = type->target_type (); struct type *elttype = check_typedef (unresolved_elttype); diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index e1d40c0..1e00517 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -232,7 +232,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format) if (VALUE_LVAL (val)) { - vaddr = value_address (val); + vaddr = val->address (); } else { diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 00ac452..5b53ab3 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -162,7 +162,7 @@ convert_one_symbol (compile_c_instance *context, sym.symbol->print_name ()); kind = GCC_C_SYMBOL_VARIABLE; - addr = value_address (val); + addr = val->address (); } break; diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index 2df68b7..2844777 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -156,7 +156,7 @@ convert_one_symbol (compile_cplus_instance *instance, sym.symbol->print_name ()); kind = GCC_CP_SYMBOL_VARIABLE; - addr = value_address (val); + addr = val->address (); } break; diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c index 517cf89..ae30dd6 100644 --- a/gdb/compile/compile-loc2c.c +++ b/gdb/compile/compile-loc2c.c @@ -654,7 +654,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, gdb_printf (stream, "%*s%s = %s;\n", indent, "", result_name, - core_addr_to_string (value_address (val))); + core_addr_to_string (val->address ())); gdb_printf (stream, "%*s}\n", indent - 2, ""); return; } diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 634f5a9..ebed52c 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -390,7 +390,7 @@ cp_print_value (struct value *val, struct ui_file *stream, struct type **dont_print_vb) { struct type *type = check_typedef (val->type ()); - CORE_ADDR address = value_address (val); + CORE_ADDR address = val->address (); struct type **last_dont_print = (struct type **) obstack_next_free (&dont_print_vb_obstack); struct obstack tmp_obstack = dont_print_vb_obstack; @@ -560,7 +560,7 @@ cp_print_static_field (struct type *type, if (real_type->code () == TYPE_CODE_STRUCT) { CORE_ADDR *first_dont_print; - CORE_ADDR addr = value_address (val); + CORE_ADDR addr = val->address (); int i; first_dont_print diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c index bebe02c..173623e 100644 --- a/gdb/d-valprint.c +++ b/gdb/d-valprint.c @@ -82,7 +82,7 @@ d_value_print_inner (struct value *val, struct ui_file *stream, int recurse, { case TYPE_CODE_STRUCT: ret = dynamic_array_type (type, val->embedded_offset (), - value_address (val), + val->address (), stream, recurse, val, options); if (ret == 0) break; diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index 7f2bcf2..a83df21 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -236,7 +236,7 @@ execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size, value *result_val = ctx.evaluate (exp, len, true, nullptr, this_frame); if (VALUE_LVAL (result_val) == lval_memory) - return value_address (result_val); + return result_val->address (); else return value_as_address (result_val); } diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index e975f28..b1dc5ab 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -516,7 +516,7 @@ locexpr_get_frame_base (struct symbol *framefunc, frame_info_ptr frame) dwarf2_evaluate_loc_desc returns a value representing a variable at that address. The frame base address is thus this variable's address. */ - return value_address (result); + return result->address (); } /* Vector for inferior functions as represented by LOC_BLOCK, if the inferior @@ -573,7 +573,7 @@ loclist_get_frame_base (struct symbol *framefunc, frame_info_ptr frame) dwarf2_evaluate_loc_desc returns a value representing a variable at that address. The frame base address is thus this variable's address. */ - return value_address (result); + return result->address (); } /* Vector for inferior functions as represented by LOC_BLOCK, if the inferior @@ -685,7 +685,7 @@ call_site_target::iterate_over_addresses dwarf_block->per_objfile); /* DW_AT_call_target is a DWARF expression, not a DWARF location. */ if (VALUE_LVAL (val) == lval_memory) - callback (value_address (val)); + callback (val->address ()); else callback (value_as_address (val)); } @@ -1613,7 +1613,7 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, return 0; if (VALUE_LVAL (result) == lval_memory) - *valp = value_address (result); + *valp = result->address (); else { if (VALUE_LVAL (result) == not_lval) diff --git a/gdb/elfread.c b/gdb/elfread.c index 45cd73b..02d4735 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -924,7 +924,7 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc) function = allocate_value (func_func_type); VALUE_LVAL (function) = lval_memory; - set_value_address (function, pc); + function->set_address (pc); /* STT_GNU_IFUNC resolver functions usually receive the HWCAP vector as parameter. FUNCTION is the function entry address. ADDRESS may be a @@ -1035,7 +1035,7 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b) func_func = allocate_value (func_func_type); VALUE_LVAL (func_func) = lval_memory; - set_value_address (func_func, b->loc->related_address); + func_func->set_address (b->loc->related_address); value = allocate_value (value_type); gdbarch_return_value_as_value (gdbarch, func_func, value_type, regcache, @@ -651,7 +651,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside, { if (ftype->is_gnu_ifunc ()) { - CORE_ADDR address = value_address (callee); + CORE_ADDR address = callee->address (); type *resolved_type = find_gnu_ifunc_target_type (address); if (resolved_type != NULL) @@ -964,7 +964,7 @@ structop_base_operation::evaluate_funcall ``this'' pointer if necessary, so modify it to reflect any ``this'' changes. */ vals[0] = value_from_longest (lookup_pointer_type (temp->type ()), - value_address (temp) + temp->address () + temp->embedded_offset ()); } @@ -1136,7 +1136,7 @@ eval_op_func_static_var (struct type *expect_type, struct expression *exp, enum noside noside, value *func, const char *var) { - CORE_ADDR addr = value_address (func); + CORE_ADDR addr = func->address (); const block *blk = block_for_pc (addr); struct block_symbol sym = lookup_symbol (var, blk, VAR_DOMAIN, NULL); if (sym.symbol == NULL) diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 57c31ef..68d4516 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -408,7 +408,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang, if (pointer_type->code () == TYPE_CODE_PTR) pointer_addr = value_as_address (pointer); else - pointer_addr = value_address (pointer); + pointer_addr = pointer->address (); /* The single argument case, is POINTER associated with anything? */ if (target == nullptr) @@ -470,7 +470,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang, if (target_type->code () == TYPE_CODE_PTR) target_addr = value_as_address (target); else - target_addr = value_address (target); + target_addr = target->address (); /* Wrap the following checks inside a do { ... } while (false) loop so that we can use `break' to jump out of the loop. */ @@ -1074,7 +1074,7 @@ eval_op_f_loc (struct type *expect_type, struct expression *exp, else result_type = builtin_f_type (exp->gdbarch)->builtin_integer_s8; - LONGEST result_value = value_address (arg1); + LONGEST result_value = arg1->address (); return value_from_longest (result_type, result_value); } @@ -1410,7 +1410,7 @@ fortran_undetermined::value_subarray (value *array, debug_printf (" |-> Total offset: %s\n", plongest (total_offset)); debug_printf (" |-> Base address: %s\n", - core_addr_to_string (value_address (array))); + core_addr_to_string (array->address ())); debug_printf (" '-> Contiguous = %s\n", (is_all_contiguous ? "Yes" : "No")); } @@ -1446,13 +1446,13 @@ fortran_undetermined::value_subarray (value *array, > check_typedef (array->type ())->length ())) { fortran_array_walker<fortran_lazy_array_repacker_impl> p - (array_slice_type, value_address (array) + total_offset, dest); + (array_slice_type, array->address () + total_offset, dest); p.walk (); } else { fortran_array_walker<fortran_array_repacker_impl> p - (array_slice_type, value_address (array) + total_offset, + (array_slice_type, array->address () + total_offset, total_offset, array, dest); p.walk (); } @@ -1470,11 +1470,11 @@ fortran_undetermined::value_subarray (value *array, || (total_offset + array_slice_type->length () > check_typedef (array->type ())->length ())) array = value_at_lazy (array_slice_type, - value_address (array) + total_offset); + array->address () + total_offset); else array = value_from_contents_and_address (array_slice_type, value_contents (array).data () + total_offset, - value_address (array) + total_offset); + array->address () + total_offset); } else if (!array->lazy ()) array = value_from_component (array, array_slice_type, total_offset); @@ -1632,7 +1632,7 @@ fortran_structop_operation::evaluate (struct type *expect_type, if (is_dynamic_type (elt_type)) { const gdb_byte *valaddr = value_contents_for_printing (elt).data (); - CORE_ADDR address = value_address (elt); + CORE_ADDR address = elt->address (); gdb::array_view<const gdb_byte> view = gdb::make_array_view (valaddr, elt_type->length ()); elt_type = resolve_dynamic_type (elt_type, view, address); diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 92b35fd..1867962 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -457,7 +457,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream, CORE_ADDR addr; int index; const gdb_byte *valaddr = value_contents_for_printing (val).data (); - const CORE_ADDR address = value_address (val); + const CORE_ADDR address = val->address (); switch (type->code ()) { diff --git a/gdb/frame.c b/gdb/frame.c index dd9d6bf..a4c4482 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1192,7 +1192,7 @@ frame_register_unwind (frame_info_ptr next_frame, int regnum, *optimizedp = value_optimized_out (value); *unavailablep = !value_entirely_available (value); *lvalp = VALUE_LVAL (value); - *addrp = value_address (value); + *addrp = value->address (); if (*lvalp == lval_register) *realnump = VALUE_REGNUM (value); else @@ -1302,7 +1302,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum) else if (VALUE_LVAL (value) == lval_memory) gdb_printf (&debug_file, " address=%s", paddress (gdbarch, - value_address (value))); + value->address ())); else gdb_printf (&debug_file, " computed"); diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 0922a8e..e9c9a9c 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1238,7 +1238,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION) { store_unsigned_integer (valbuf, 4, byte_order, - value_address (arg)); + arg->address ()); typecode = TYPE_CODE_PTR; len = 4; val = valbuf; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 75a567d..ff8de6b 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -4009,7 +4009,7 @@ is_unique_ancestor (struct type *base, struct value *val) return is_unique_ancestor_worker (base, val->type (), &offset, value_contents_for_printing (val).data (), val->embedded_offset (), - value_address (val), val) == 1; + val->address (), val) == 1; } /* See gdbtypes.h. */ diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index 76dc719..908581a 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -234,7 +234,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc) /* We can't use value_ind here, because it would want to use RTTI, and we'd waste a bunch of time figuring out we already know the type. Besides, we don't care about the type, just the actual pointer. */ - if (value_address (value_field (v, known_type_vptr_fieldno)) == 0) + if (value_field (v, known_type_vptr_fieldno)->address () == 0) return NULL; vtbl = value_as_address (value_field (v, known_type_vptr_fieldno)); diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index dc249f0..2fa4008 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -325,7 +325,7 @@ gnuv3_rtti_type (struct value *value, /* Find the linker symbol for this vtable. */ vtable_symbol - = lookup_minimal_symbol_by_pc (value_address (vtable) + = lookup_minimal_symbol_by_pc (vtable->address () + vtable->embedded_offset ()).minsym; if (! vtable_symbol) return NULL; @@ -804,7 +804,7 @@ hash_value_and_voffset (const void *p) { const struct value_and_voffset *o = (const struct value_and_voffset *) p; - return value_address (o->value) + o->value->embedded_offset (); + return o->value->address () + o->value->embedded_offset (); } /* Equality function for value_and_voffset. */ @@ -815,8 +815,8 @@ eq_value_and_voffset (const void *a, const void *b) const struct value_and_voffset *ova = (const struct value_and_voffset *) a; const struct value_and_voffset *ovb = (const struct value_and_voffset *) b; - return (value_address (ova->value) + ova->value->embedded_offset () - == value_address (ovb->value) + ovb->value->embedded_offset ()); + return (ova->value->address () + ova->value->embedded_offset () + == ovb->value->address () + ovb->value->embedded_offset ()); } /* Comparison function for value_and_voffset. */ @@ -825,9 +825,9 @@ static bool compare_value_and_voffset (const struct value_and_voffset *va, const struct value_and_voffset *vb) { - CORE_ADDR addra = (value_address (va->value) + CORE_ADDR addra = (va->value->address () + va->value->embedded_offset ()); - CORE_ADDR addrb = (value_address (vb->value) + CORE_ADDR addrb = (vb->value->address () + vb->value->embedded_offset ()); return addra < addrb; @@ -907,15 +907,15 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value, CORE_ADDR vt_addr; vtable = gnuv3_get_vtable (gdbarch, type, - value_address (value) + value->address () + value->embedded_offset ()); - vt_addr = value_address (value_field (vtable, - vtable_field_virtual_functions)); + vt_addr = value_field (vtable, + vtable_field_virtual_functions)->address (); gdb_printf (_("vtable for '%s' @ %s (subobject @ %s):\n"), TYPE_SAFE_NAME (type), paddress (gdbarch, vt_addr), - paddress (gdbarch, (value_address (value) + paddress (gdbarch, (value->address () + value->embedded_offset ()))); for (i = 0; i <= max_voffset; ++i) @@ -1138,7 +1138,7 @@ gnuv3_get_typeid (struct value *value) && gnuv3_dynamic_class (type)) { struct value *vtable, *typeinfo_value; - CORE_ADDR address = value_address (value) + value->embedded_offset (); + CORE_ADDR address = value->address () + value->embedded_offset (); vtable = gnuv3_get_vtable (gdbarch, type, address); if (vtable == NULL) diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c index dce7bd6..8f6c884 100644 --- a/gdb/go-valprint.c +++ b/gdb/go-valprint.c @@ -105,7 +105,7 @@ go_language::value_print_inner (struct value *val, struct ui_file *stream, if (! options->raw) { print_go_string (type, val->embedded_offset (), - value_address (val), + val->address (), stream, recurse, val, options); return; } diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index 5b9a4cf..8f292c2 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -1194,7 +1194,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest) low_bound, low_bound + length - 1); } - addr = value_address (value); + addr = value->address (); break; } case TYPE_CODE_PTR: @@ -1204,7 +1204,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest) break; default: /* Should flag an error here. PR 20769. */ - addr = value_address (value); + addr = value->address (); break; } diff --git a/gdb/infcall.c b/gdb/infcall.c index b58dc20..3e0da94 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -290,7 +290,7 @@ find_function_addr (struct value *function, /* Determine address to call. */ if (ftype->code () == TYPE_CODE_FUNC || ftype->code () == TYPE_CODE_METHOD) - funaddr = value_address (function); + funaddr = function->address (); else if (ftype->code () == TYPE_CODE_PTR) { funaddr = value_as_address (function); @@ -962,7 +962,7 @@ call_function_by_hand_dummy (struct value *function, lastval = get_last_thread_stack_temporary (call_thread.get ()); if (lastval != NULL) { - CORE_ADDR lastval_addr = value_address (lastval); + CORE_ADDR lastval_addr = lastval->address (); if (gdbarch_inner_than (gdbarch, 1, 2)) { diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index c718798..73f9e37 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -270,7 +270,7 @@ m2_print_array_contents (struct value *val, || ((current_language->la_language == language_m2) && (type->code () == TYPE_CODE_CHAR))) && (options->format == 0 || options->format == 's')) - val_print_string (type, NULL, value_address (val), len+1, stream, + val_print_string (type, NULL, val->address (), len+1, stream, options); else { @@ -306,7 +306,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream, struct type *elttype; CORE_ADDR addr; const gdb_byte *valaddr = value_contents_for_printing (val).data (); - const CORE_ADDR address = value_address (val); + const CORE_ADDR address = val->address (); struct type *type = check_typedef (val->type ()); switch (type->code ()) diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index ceab11d..a1d2ad6 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -698,7 +698,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function, && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) { store_unsigned_integer (valbuf, 4, byte_order, - value_address (args[argnum])); + args[argnum]->address ()); typecode = TYPE_CODE_PTR; len = 4; val = valbuf; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 38ec39d..349a89e 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -4604,7 +4604,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { gdb_assert (abi_regsize <= ARRAY_SIZE (ref_valbuf)); store_unsigned_integer (ref_valbuf, abi_regsize, byte_order, - value_address (arg)); + arg->address ()); typecode = TYPE_CODE_PTR; len = abi_regsize; val = ref_valbuf; diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index ac2b4a7..aade7c3 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1212,7 +1212,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch, arg_len = push_size; gdb_assert (push_size <= MN10300_MAX_REGISTER_SIZE); store_unsigned_integer (valbuf, push_size, byte_order, - value_address (*args)); + (*args)->address ()); val = &valbuf[0]; } else diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c index 30a28d0..d4a40d4 100644 --- a/gdb/msp430-tdep.c +++ b/gdb/msp430-tdep.c @@ -703,7 +703,7 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { /* Aggregates of any size are passed by reference. */ store_unsigned_integer (struct_addr_buf, 4, byte_order, - value_address (arg)); + arg->address ()); arg_bits = struct_addr_buf; arg_size = (code_model == MSP_LARGE_CODE_MODEL) ? 4 : 2; } diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c index d8c3043..d485d55 100644 --- a/gdb/or1k-tdep.c +++ b/gdb/or1k-tdep.c @@ -672,7 +672,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if ((TYPE_CODE_STRUCT == typecode) || (TYPE_CODE_UNION == typecode) || (len > bpw * 2)) { - CORE_ADDR valaddr = value_address (arg); + CORE_ADDR valaddr = arg->address (); /* If the arg is fabricated (i.e. 3*i, instead of i) valaddr is undefined. */ @@ -792,7 +792,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, || (len > bpw * 2)) { store_unsigned_integer (valbuf, bpa, byte_order, - value_address (arg)); + arg->address ()); len = bpa; val = valbuf; } diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 2628ebd..c6b9b55 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -143,7 +143,7 @@ pascal_language::value_print_inner (struct value *val, break; } /* Array of unspecified length: treat like pointer to first elt. */ - addr = value_address (val); + addr = val->address (); } goto print_unpacked_pointer; @@ -748,7 +748,7 @@ pascal_object_print_value (struct value *val, struct ui_file *stream, if (boffset < 0 || boffset >= type->length ()) { - CORE_ADDR address= value_address (val); + CORE_ADDR address= val->address (); gdb::byte_vector buf (baseclass->length ()); if (target_read_memory (address + boffset, buf.data (), @@ -836,7 +836,7 @@ pascal_object_print_static_field (struct value *val, while (--i >= 0) { - if (value_address (val) == first_dont_print[i]) + if (val->address () == first_dont_print[i]) { fputs_styled (_("\ <same as static member of an already seen type>"), @@ -845,7 +845,7 @@ pascal_object_print_static_field (struct value *val, } } - addr = value_address (val); + addr = val->address (); obstack_grow (&dont_print_statmem_obstack, (char *) &addr, sizeof (CORE_ADDR)); diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index d6d1d0f..6d4bf2c 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -2510,7 +2510,7 @@ ppc_linux_nat_target::check_condition (CORE_ADDR watch_addr, if (num_accesses_left == 1 && num_accesses_right == 0 && VALUE_LVAL (left_val) == lval_memory - && value_address (left_val) == watch_addr) + && left_val->address () == watch_addr) { *data_value = value_as_long (right_val); @@ -2520,7 +2520,7 @@ ppc_linux_nat_target::check_condition (CORE_ADDR watch_addr, } else if (num_accesses_left == 0 && num_accesses_right == 1 && VALUE_LVAL (right_val) == lval_memory - && value_address (right_val) == watch_addr) + && right_val->address () == watch_addr) { *data_value = value_as_long (left_val); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 9e77bf1..ba7d2978 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -298,7 +298,7 @@ print_formatted (struct value *val, int size, int len = type->length (); if (VALUE_LVAL (val) == lval_memory) - next_address = value_address (val) + len; + next_address = val->address () + len; if (size) { @@ -308,9 +308,9 @@ print_formatted (struct value *val, int size, { struct type *elttype = val->type (); - next_address = (value_address (val) + next_address = (val->address () + val_print_string (elttype, NULL, - value_address (val), -1, + val->address (), -1, stream, options) * len); } return; @@ -318,9 +318,9 @@ print_formatted (struct value *val, int size, case 'i': /* We often wrap here if there are long symbolic names. */ stream->wrap_here (4); - next_address = (value_address (val) + next_address = (val->address () + gdb_print_insn (type->arch (), - value_address (val), stream, + val->address (), stream, &branch_delay_insns)); return; } @@ -1905,7 +1905,7 @@ x_command (const char *exp, int from_tty) pointers to functions. This makes "x/i main" work. */ if (val->type ()->code () == TYPE_CODE_FUNC && VALUE_LVAL (val) == lval_memory) - next_address = value_address (val); + next_address = val->address (); else next_address = value_as_address (val); diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 0e3bc69..b387bb81 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -538,7 +538,7 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw) low_bound, low_bound + length - 1); } - addr = value_address (value); + addr = value->address (); break; } case TYPE_CODE_PTR: @@ -548,7 +548,7 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw) break; default: /* Should flag an error here. PR 20769. */ - addr = value_address (value); + addr = value->address (); break; } diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index f6e5089..aa15900 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -351,7 +351,7 @@ rust_val_print_slice (struct value *val, struct ui_file *stream, int recurse, llen - 1); struct value *array = allocate_value_lazy (array_type); VALUE_LVAL (array) = lval_memory; - set_value_address (array, value_as_address (base)); + array->set_address (value_as_address (base)); value_fetch_lazy (array); generic_value_print (array, stream, recurse, options, &rust_decorations); @@ -458,7 +458,7 @@ rust_language::print_enum (struct value *val, struct ui_file *stream, gdb::array_view<const gdb_byte> view (value_contents_for_printing (val).data (), val->type ()->length ()); - type = resolve_dynamic_type (type, view, value_address (val)); + type = resolve_dynamic_type (type, view, val->address ()); if (rust_empty_enum_p (type)) { @@ -1375,7 +1375,7 @@ rust_struct_anon::evaluate (struct type *expect_type, if (rust_enum_p (type)) { type = resolve_dynamic_type (type, value_contents (lhs), - value_address (lhs)); + lhs->address ()); if (rust_empty_enum_p (type)) error (_("Cannot access field %d of empty enum %s"), @@ -1438,7 +1438,7 @@ rust_structop::evaluate (struct type *expect_type, if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type)) { type = resolve_dynamic_type (type, value_contents (lhs), - value_address (lhs)); + lhs->address ()); if (rust_empty_enum_p (type)) error (_("Cannot access field %s of empty enum %s"), diff --git a/gdb/stack.c b/gdb/stack.c index 5efe024..9952c3a 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1726,7 +1726,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p) else if (VALUE_LVAL (value) == lval_memory) { gdb_printf (" Previous frame's sp at "); - gdb_puts (paddress (gdbarch, value_address (value))); + gdb_puts (paddress (gdbarch, value->address ())); gdb_printf ("\n"); } else if (VALUE_LVAL (value) == lval_register) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 7e172dfb..4c181dc 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1376,7 +1376,7 @@ encode_actions_1 (struct command_line *action, { /* Safe because we know it's a simple expression. */ tempval = evaluate_expression (exp.get ()); - addr = value_address (tempval); + addr = tempval->address (); expr::unop_memval_operation *memop = (gdb::checked_static_cast<expr::unop_memval_operation *> (exp->op.get ())); diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index fd80154..74451bb 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1059,7 +1059,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch, && (*args)->type ()->length () > E_MAX_RETTYPE_SIZE_IN_REGS) { store_unsigned_integer (valbuf, 4, byte_order, - value_address (*args)); + (*args)->address ()); len = 4; val = valbuf; } diff --git a/gdb/valarith.c b/gdb/valarith.c index 98ccbc7..47493a6 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -193,7 +193,7 @@ value_subscript (struct value *array, LONGEST index) struct value *val = allocate_value (elt_type); mark_value_bytes_unavailable (val, 0, elt_size); VALUE_LVAL (val) = lval_memory; - set_value_address (val, value_address (array) + elt_size * index); + val->set_address (array->address () + elt_size * index); return val; } @@ -249,7 +249,7 @@ value_subscripted_rvalue (struct value *array, LONGEST index, { CORE_ADDR address; - address = value_address (array) + elt_offs; + address = array->address () + elt_offs; elt_type = resolve_dynamic_type (elt_type, {}, address); } diff --git a/gdb/valops.c b/gdb/valops.c index 0d321e8..cea9d3c 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -253,7 +253,7 @@ value_cast_structs (struct type *type, struct value *v2) if (real_type) { v = value_full_object (v2, real_type, full, top, using_enc); - v = value_at_lazy (real_type, value_address (v)); + v = value_at_lazy (real_type, v->address ()); real_type = v->type (); /* We might be trying to cast to the outermost enclosing @@ -275,9 +275,9 @@ value_cast_structs (struct type *type, struct value *v2) if (v) { /* Downcasting is possible (t1 is superclass of v2). */ - CORE_ADDR addr2 = value_address (v2) + v2->embedded_offset (); + CORE_ADDR addr2 = v2->address () + v2->embedded_offset (); - addr2 -= value_address (v) + v->embedded_offset (); + addr2 -= v->address () + v->embedded_offset (); return value_at (type, addr2); } } @@ -654,7 +654,7 @@ value_cast (struct type *type, struct value *arg2) return arg2; } else if (VALUE_LVAL (arg2) == lval_memory) - return value_at_lazy (to_type, value_address (arg2)); + return value_at_lazy (to_type, arg2->address ()); else { if (current_language->la_language == language_ada) @@ -876,7 +876,7 @@ value_dynamic_cast (struct type *type, struct value *arg) error (_("Couldn't determine value's most derived type for dynamic_cast")); /* Compute the most derived object's address. */ - addr = value_address (arg); + addr = arg->address (); if (full) { /* Done. */ @@ -904,7 +904,7 @@ value_dynamic_cast (struct type *type, struct value *arg) if (dynamic_cast_check_1 (resolved_type->target_type (), value_contents_for_printing (tem).data (), tem->embedded_offset (), - value_address (tem), tem, + tem->address (), tem, rtti_type, addr, arg_type, &result) == 1) @@ -920,7 +920,7 @@ value_dynamic_cast (struct type *type, struct value *arg) && dynamic_cast_check_2 (resolved_type->target_type (), value_contents_for_printing (tem).data (), tem->embedded_offset (), - value_address (tem), tem, + tem->address (), tem, rtti_type, &result) == 1) return value_cast (type, is_ref @@ -1154,7 +1154,7 @@ value_assign (struct value *toval, struct value *fromval) { struct value *parent = toval->parent (); - changed_addr = value_address (parent) + toval->offset (); + changed_addr = parent->address () + toval->offset (); changed_len = (toval->bitpos () + toval->bitsize () + HOST_CHAR_BIT - 1) @@ -1181,7 +1181,7 @@ value_assign (struct value *toval, struct value *fromval) } else { - changed_addr = value_address (toval); + changed_addr = toval->address (); changed_len = type_length_units (type); dest_buffer = value_contents (fromval).data (); } @@ -1374,9 +1374,9 @@ value_repeat (struct value *arg1, int count) val = allocate_repeat_value (arg1->enclosing_type (), count); VALUE_LVAL (val) = lval_memory; - set_value_address (val, value_address (arg1)); + val->set_address (arg1->address ()); - read_value_memory (val, 0, val->stack (), value_address (val), + read_value_memory (val, 0, val->stack (), val->address (), value_contents_all_raw (val).data (), type_length_units (val->enclosing_type ())); @@ -1409,7 +1409,7 @@ address_of_variable (struct symbol *var, const struct block *b) if ((VALUE_LVAL (val) == lval_memory && val->lazy ()) || type->code () == TYPE_CODE_FUNC) { - CORE_ADDR addr = value_address (val); + CORE_ADDR addr = val->address (); return value_from_pointer (lookup_pointer_type (type), addr); } @@ -1526,7 +1526,7 @@ value_coerce_array (struct value *arg1) error (_("Attempt to take address of value not located in memory.")); return value_from_pointer (lookup_pointer_type (type->target_type ()), - value_address (arg1)); + arg1->address ()); } /* Given a value which is a function, return a value which is a pointer @@ -1541,7 +1541,7 @@ value_coerce_function (struct value *arg1) error (_("Attempt to take address of value not located in memory.")); retval = value_from_pointer (lookup_pointer_type (arg1->type ()), - value_address (arg1)); + arg1->address ()); return retval; } @@ -1591,7 +1591,7 @@ value_addr (struct value *arg1) /* Get target memory address. */ arg2 = value_from_pointer (lookup_pointer_type (arg1->type ()), - (value_address (arg1) + (arg1->address () + arg1->embedded_offset ())); /* This may be a pointer to a base subobject; so remember the @@ -2085,7 +2085,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset, boffset = baseclass_offset (type, i, value_contents_for_printing (arg1).data (), arg1->embedded_offset () + offset, - value_address (arg1), + arg1->address (), arg1); /* The virtual base class pointer might have been clobbered @@ -2098,7 +2098,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset, { CORE_ADDR base_addr; - base_addr = value_address (arg1) + boffset; + base_addr = arg1->address () + boffset; v2 = value_at_lazy (basetype, base_addr); if (target_read_memory (base_addr, value_contents_raw (v2).data (), @@ -2278,7 +2278,7 @@ search_struct_method (const char *name, struct value **arg1p, CORE_ADDR address; gdb::byte_vector tmp (baseclass->length ()); - address = value_address (*arg1p); + address = (*arg1p)->address (); if (target_read_memory (address + offset, tmp.data (), baseclass->length ()) != 0) @@ -2298,7 +2298,7 @@ search_struct_method (const char *name, struct value **arg1p, } base_offset = baseclass_offset (type, i, base_valaddr, - this_offset, value_address (base_val), + this_offset, base_val->address (), base_val); } else @@ -2560,7 +2560,7 @@ find_method_list (struct value **argp, const char *method, base_offset = baseclass_offset (type, i, value_contents_for_printing (*argp).data (), (*argp)->offset () + offset, - value_address (*argp), *argp); + (*argp)->address (), *argp); } else /* Non-virtual base, simply use bit position from debug info. */ @@ -3766,7 +3766,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, result = allocate_value (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j))); cplus_make_method_ptr (result->type (), value_contents_writeable (result).data (), - value_address (v), 0); + v->address (), 0); } } return result; @@ -3977,7 +3977,7 @@ value_full_object (struct value *argp, /* Go back by the computed top_offset from the beginning of the object, adjusting for the embedded offset of argp if that's what value_rtti_type used for its computation. */ - new_val = value_at_lazy (real_type, value_address (argp) - top + + new_val = value_at_lazy (real_type, argp->address () - top + (using_enc ? 0 : argp->embedded_offset ())); new_val->deprecated_set_type (argp->type ()); new_val->set_embedded_offset ((using_enc diff --git a/gdb/valprint.c b/gdb/valprint.c index fbbaaa4..98b9e48 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -494,7 +494,7 @@ generic_val_print_array (struct value *val, else { /* Array of unspecified length: treat like pointer to first elt. */ - print_unpacked_pointer (type, elttype, value_address (val), + print_unpacked_pointer (type, elttype, val->address (), stream, options); } @@ -965,7 +965,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse, if (options->format) value_print_scalar_formatted (val, options, 0, stream); else - generic_val_print_func (type, 0, value_address (val), stream, + generic_val_print_func (type, 0, val->address (), stream, val, options); break; diff --git a/gdb/value.c b/gdb/value.c index 399e2d1..5917ba5 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1399,34 +1399,34 @@ value::computed_closure () const } CORE_ADDR -value_address (const struct value *value) +value::address () const { - if (value->m_lval != lval_memory) + if (m_lval != lval_memory) return 0; - if (value->m_parent != NULL) - return value_address (value->m_parent.get ()) + value->m_offset; - if (NULL != TYPE_DATA_LOCATION (value->type ())) + if (m_parent != NULL) + return m_parent.get ()->address () + m_offset; + if (NULL != TYPE_DATA_LOCATION (type ())) { - gdb_assert (PROP_CONST == TYPE_DATA_LOCATION_KIND (value->type ())); - return TYPE_DATA_LOCATION_ADDR (value->type ()); + gdb_assert (PROP_CONST == TYPE_DATA_LOCATION_KIND (type ())); + return TYPE_DATA_LOCATION_ADDR (type ()); } - return value->m_location.address + value->m_offset; + return m_location.address + m_offset; } CORE_ADDR -value_raw_address (const struct value *value) +value::raw_address () const { - if (value->m_lval != lval_memory) + if (m_lval != lval_memory) return 0; - return value->m_location.address; + return m_location.address; } void -set_value_address (struct value *value, CORE_ADDR addr) +value::set_address (CORE_ADDR addr) { - gdb_assert (value->m_lval == lval_memory); - value->m_location.address = addr; + gdb_assert (m_lval == lval_memory); + m_location.address = addr; } struct internalvar ** @@ -1677,7 +1677,7 @@ set_value_component_location (struct value *component, type = whole->type (); if (NULL != TYPE_DATA_LOCATION (type) && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST) - set_value_address (component, TYPE_DATA_LOCATION_ADDR (type)); + component->set_address (TYPE_DATA_LOCATION_ADDR (type)); /* Similarly, if the COMPONENT value has a dynamically resolved location property then update its address. */ @@ -1709,7 +1709,7 @@ set_value_component_location (struct value *component, } else gdb_assert (VALUE_LVAL (component) == lval_memory); - set_value_address (component, TYPE_DATA_LOCATION_ADDR (type)); + component->set_address (TYPE_DATA_LOCATION_ADDR (type)); } } @@ -2655,7 +2655,7 @@ value_as_address (struct value *val) Upon entry to this function, if VAL is a value of type `function' (that is, TYPE_CODE (val->type ()) == TYPE_CODE_FUNC), then - value_address (val) is the address of the function. This is what + val->address () is the address of the function. This is what you'll get if you evaluate an expression like `main'. The call to COERCE_ARRAY below actually does all the usual unary conversions, which includes converting values of type `function' @@ -2675,7 +2675,7 @@ value_as_address (struct value *val) function, just return its address directly. */ if (val->type ()->code () == TYPE_CODE_FUNC || val->type ()->code () == TYPE_CODE_METHOD) - return value_address (val); + return val->address (); val = coerce_array (val); @@ -2988,7 +2988,7 @@ value_primitive_field (struct value *arg1, LONGEST offset, boffset = baseclass_offset (arg_type, fieldno, value_contents (arg1).data (), arg1->embedded_offset (), - value_address (arg1), + arg1->address (), arg1); else boffset = arg_type->field (fieldno).loc_bitpos () / 8; @@ -3082,7 +3082,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f, VALUE_LVAL (v) = lval_memory; if (sym) { - set_value_address (v, sym->value_block ()->entry_pc ()); + v->set_address (sym->value_block ()->entry_pc ()); } else { @@ -3091,10 +3091,9 @@ value_fn_field (struct value **arg1p, struct fn_field *f, struct objfile *objfile = msym.objfile; struct gdbarch *gdbarch = objfile->arch (); - set_value_address (v, - gdbarch_convert_from_func_ptr_addr - (gdbarch, msym.value_address (), - current_inferior ()->top_target ())); + v->set_address (gdbarch_convert_from_func_ptr_addr + (gdbarch, msym.value_address (), + current_inferior ()->top_target ())); } if (arg1p) @@ -3511,7 +3510,7 @@ value_from_contents_and_address_unresolved (struct type *type, else v = value_from_contents (type, valaddr); VALUE_LVAL (v) = lval_memory; - set_value_address (v, address); + v->set_address (address); return v; } @@ -3540,7 +3539,7 @@ value_from_contents_and_address (struct type *type, && TYPE_DATA_LOCATION_KIND (resolved_type_no_typedef) == PROP_CONST) address = TYPE_DATA_LOCATION_ADDR (resolved_type_no_typedef); VALUE_LVAL (v) = lval_memory; - set_value_address (v, address); + v->set_address (address); return v; } @@ -3828,7 +3827,7 @@ value_fetch_lazy_memory (struct value *val) { gdb_assert (VALUE_LVAL (val) == lval_memory); - CORE_ADDR addr = value_address (val); + CORE_ADDR addr = val->address (); struct type *type = check_typedef (val->enclosing_type ()); /* Figure out how much we should copy from memory. Usually, this is just @@ -3949,7 +3948,7 @@ value_fetch_lazy_register (struct value *val) else if (VALUE_LVAL (new_val) == lval_memory) gdb_printf (&debug_file, " address=%s", paddress (gdbarch, - value_address (new_val))); + new_val->address ())); else gdb_printf (&debug_file, " computed"); diff --git a/gdb/value.h b/gdb/value.h index e813970..6422cfb 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -325,6 +325,19 @@ struct value void set_initialized (int value) { m_initialized = value; } + /* If lval == lval_memory, return the address in the inferior. If + lval == lval_register, return the byte offset into the registers + structure. Otherwise, return 0. The returned address + includes the offset, if any. */ + CORE_ADDR address () const; + + /* Like address, except the result does not include value's + offset. */ + CORE_ADDR raw_address () const; + + /* Set the address of a value. */ + void set_address (CORE_ADDR); + /* Type of value; either not an lval, or one of the various different possible kinds of lval. */ @@ -678,19 +691,6 @@ extern void set_value_component_location (struct value *component, possible kinds of lval. */ #define VALUE_LVAL(val) (*((val)->deprecated_lval_hack ())) -/* If lval == lval_memory, return the address in the inferior. If - lval == lval_register, return the byte offset into the registers - structure. Otherwise, return 0. The returned address - includes the offset, if any. */ -extern CORE_ADDR value_address (const struct value *); - -/* Like value_address, except the result does not include value's - offset. */ -extern CORE_ADDR value_raw_address (const struct value *); - -/* Set the address of a value. */ -extern void set_value_address (struct value *, CORE_ADDR); - /* Pointer to internal variable. */ extern struct internalvar **deprecated_value_internalvar_hack (struct value *); #define VALUE_INTERNALVAR(val) (*deprecated_value_internalvar_hack (val)) |