aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog89
-rw-r--r--gdb/ada-lang.c40
-rw-r--r--gdb/ada-tasks.c2
-rw-r--r--gdb/ada-valprint.c6
-rw-r--r--gdb/breakpoint.c4
-rw-r--r--gdb/c-valprint.c6
-rw-r--r--gdb/cli/cli-dump.c2
-rw-r--r--gdb/cp-valprint.c10
-rw-r--r--gdb/darwin-nat-info.c2
-rw-r--r--gdb/dwarf2loc.c2
-rw-r--r--gdb/eval.c6
-rw-r--r--gdb/findvar.c10
-rw-r--r--gdb/frame.c4
-rw-r--r--gdb/frv-tdep.c2
-rw-r--r--gdb/gnu-v2-abi.c2
-rw-r--r--gdb/gnu-v3-abi.c3
-rw-r--r--gdb/infcall.c2
-rw-r--r--gdb/jv-lang.c16
-rw-r--r--gdb/jv-valprint.c6
-rw-r--r--gdb/m32r-tdep.c2
-rw-r--r--gdb/mi/mi-main.c2
-rw-r--r--gdb/mips-tdep.c2
-rw-r--r--gdb/mn10300-tdep.c2
-rw-r--r--gdb/p-valprint.c9
-rw-r--r--gdb/printcmd.c12
-rw-r--r--gdb/tracepoint.c2
-rw-r--r--gdb/v850-tdep.c2
-rw-r--r--gdb/valops.c57
-rw-r--r--gdb/valprint.c2
-rw-r--r--gdb/value.c44
-rw-r--r--gdb/value.h17
31 files changed, 239 insertions, 128 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b5df971..3b598a3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,93 @@
2009-05-27 Tom Tromey <tromey@redhat.com>
+ Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * mi/mi-main.c (mi_cmd_data_evaluate_expression): Use
+ value_address.
+ * cli/cli-dump.c (dump_value_to_file): Use value_address.
+ * valprint.c (common_val_print): Likewise.
+ * v850-tdep.c (v850_push_dummy_call): Use value_address.
+ * tracepoint.c (encode_actions): Use value_address.
+ * printcmd.c (print_formatted): Use value_address.
+ (x_command): Likewise.
+ * p-valprint.c (pascal_object_print_static_field): Use
+ value_address.
+ * mn10300-tdep.c (mn10300_push_dummy_call): Use value_address.
+ * mips-tdep.c (mips_eabi_push_dummy_call): Use value_address.
+ * m32r-tdep.c (m32r_push_dummy_call): Use value_address.
+ * jv-valprint.c (java_value_print): Use value_address.
+ * infcall.c (find_function_addr): Use value_address.
+ * gnu-v3-abi.c (gnuv3_rtti_type): Use value_address.
+ * gnu-v2-abi.c (gnuv2_value_rtti_type): Use value_address.
+ * frv-tdep.c (frv_push_dummy_call): Use value_address.
+ * frame.c (frame_register_unwind): Use value_address.
+ (frame_unwind_register_value): Likewise.
+ * darwin-nat-info.c (info_mach_region_command): Use
+ value_address.
+ * cp-valprint.c (cp_print_static_field): Use value_address.
+ * c-valprint.c (c_value_print): Use value_address.
+ * breakpoint.c (update_watchpoint): Use value_address.
+ (can_use_hardware_watchpoint): Likewise.
+ * ada-valprint.c (ada_val_print_1): Use value_address.
+ (ada_value_print): Likewise.
+ * ada-tasks.c (read_fat_string_value): Use value_address.
+ * jv-lang.c (java_link_class_type): Use set_value_address.
+ (java_link_class_type): Likewise.
+ (get_java_utf8_name): Use value_address.
+ (type_from_class): Likewise.
+ (java_link_class_type): Likewise.
+ * findvar.c (value_of_register): Use set_value_address.
+ (read_var_value): Likewise.
+ (read_var_value): Likewise.
+ * eval.c (evaluate_subexp_standard): Use set_value_address.
+ (evaluate_subexp_standard): Use value_address.
+ * dwarf2loc.c (dwarf2_evaluate_loc_desc): Use set_value_address.
+ * ada-lang.c (coerce_unspec_val_to_type): Use set_value_address.
+ (ada_value_primitive_packed_val): Likewise.
+ (ensure_lval): Likewise.
+ (thin_data_pntr): Use value_address.
+ (desc_bounds): Likewise.
+ (ada_value_primitive_packed_val): Likewise.
+ (value_assign_to_component): Likewise.
+ (ensure_lval): Likewise.
+ (make_array_descriptor): Likewise.
+ (ada_to_fixed_value): Likewise.
+ (unwrap_value): Likewise.
+ * value.c (deprecated_value_address_hack): Remove.
+ (value_address): New function.
+ (value_raw_address): Likewise.
+ (set_value_address): Likewise.
+ (value_fn_field): Use set_value_address.
+ (value_from_contents_and_address): Likewise.
+ (value_fn_field): Likewise.
+ (allocate_value_lazy): Don't use VALUE_ADDRESS.
+ (value_as_address): Use value_address.
+ (value_static_field): Likewise.
+ * valops.c (search_struct_field): Use set_value_address.
+ (value_at): Likewise.
+ (value_at_lazy): Likewise.
+ (value_repeat): Likewise.
+ (value_cast_structs): Use value_address.
+ (value_cast): Likewise.
+ (value_fetch_lazy): Likewise.
+ (value_assign): Likewise.
+ (value_repeat): Likewise.
+ (address_of_variable): Likewise.
+ (value_coerce_array): Likewise.
+ (value_coerce_function): Likewise.
+ (value_addr): Likewise.
+ (search_struct_field): Likewise.
+ (search_struct_method): Likewise.
+ (find_method_list): Likewise.
+ (value_struct_elt_for_reference): Likewise.
+ (value_full_object): Likewise.
+ * jv-valprint.c (java_value_print): Use set_value_address.
+ * value.h (deprecated_value_address_hack): Remove.
+ (VALUE_ADDRESS): Remove.
+ (value_address): Declare.
+ (value_raw_address): Declare.
+ (set_value_address): Declare.
+
+2009-05-27 Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
Phil Muldoon <pmuldoon@redhat.com>
Paul Pluzhnikov <ppluzhnikov@google.com>
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 4a45a62..02c7821 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -485,7 +485,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
set_value_component_location (result, val);
set_value_bitsize (result, value_bitsize (val));
set_value_bitpos (result, value_bitpos (val));
- VALUE_ADDRESS (result) += value_offset (val);
+ set_value_address (result, value_address (val));
if (value_lazy (val)
|| TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
set_value_lazy (result, 1);
@@ -1287,8 +1287,7 @@ thin_data_pntr (struct value *val)
if (TYPE_CODE (type) == TYPE_CODE_PTR)
return value_cast (data_type, value_copy (val));
else
- return value_from_longest (data_type,
- VALUE_ADDRESS (val) + value_offset (val));
+ return value_from_longest (data_type, value_address (val));
}
/* True iff TYPE indicates a "thick" array pointer type. */
@@ -1353,7 +1352,7 @@ desc_bounds (struct value *arr)
if (TYPE_CODE (type) == TYPE_CODE_PTR)
addr = value_as_long (arr);
else
- addr = VALUE_ADDRESS (arr) + value_offset (arr);
+ addr = value_address (arr);
return
value_from_longest (lookup_pointer_type (bounds_type),
@@ -1968,9 +1967,9 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
else if (VALUE_LVAL (obj) == lval_memory && value_lazy (obj))
{
v = value_at (type,
- VALUE_ADDRESS (obj) + value_offset (obj) + offset);
+ value_address (obj) + offset);
bytes = (unsigned char *) alloca (len);
- read_memory (VALUE_ADDRESS (v), bytes, len);
+ read_memory (value_address (v), bytes, len);
}
else
{
@@ -1980,15 +1979,17 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
if (obj != NULL)
{
+ CORE_ADDR new_addr;
set_value_component_location (v, obj);
- VALUE_ADDRESS (v) += value_offset (obj) + offset;
+ new_addr = value_address (obj) + offset;
set_value_bitpos (v, bit_offset + value_bitpos (obj));
set_value_bitsize (v, bit_size);
if (value_bitpos (v) >= HOST_CHAR_BIT)
{
- VALUE_ADDRESS (v) += 1;
+ ++new_addr;
set_value_bitpos (v, value_bitpos (v) - HOST_CHAR_BIT);
}
+ set_value_address (v, new_addr);
}
else
set_value_bitsize (v, bit_size);
@@ -2181,7 +2182,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
int from_size;
char *buffer = (char *) alloca (len);
struct value *val;
- CORE_ADDR to_addr = VALUE_ADDRESS (toval) + value_offset (toval);
+ CORE_ADDR to_addr = value_address (toval);
if (TYPE_CODE (type) == TYPE_CODE_FLT)
fromval = value_cast (type, fromval);
@@ -2222,8 +2223,7 @@ value_assign_to_component (struct value *container, struct value *component,
struct value *val)
{
LONGEST offset_in_container =
- (LONGEST) (VALUE_ADDRESS (component) + value_offset (component)
- - VALUE_ADDRESS (container) - value_offset (container));
+ (LONGEST) (value_address (component) - value_address (container));
int bit_offset_in_container =
value_bitpos (component) - value_bitpos (container);
int bits;
@@ -3750,7 +3750,7 @@ parse_old_style_renaming (struct type *type,
/* Return an lvalue containing the value VAL. This is the identity on
lvalues, and otherwise has the side-effect of pushing a copy of VAL
on the stack, using and updating *SP as the stack pointer, and
- returning an lvalue whose VALUE_ADDRESS points to the copy. */
+ returning an lvalue whose value_address points to the copy. */
static struct value *
ensure_lval (struct value *val, CORE_ADDR *sp)
@@ -3764,12 +3764,12 @@ ensure_lval (struct value *val, CORE_ADDR *sp)
indicated. */
if (gdbarch_inner_than (current_gdbarch, 1, 2))
{
- /* Stack grows downward. Align SP and VALUE_ADDRESS (val) after
+ /* Stack grows downward. Align SP and value_address (val) after
reserving sufficient space. */
*sp -= len;
if (gdbarch_frame_align_p (current_gdbarch))
*sp = gdbarch_frame_align (current_gdbarch, *sp);
- VALUE_ADDRESS (val) = *sp;
+ set_value_address (val, *sp);
}
else
{
@@ -3777,14 +3777,14 @@ ensure_lval (struct value *val, CORE_ADDR *sp)
then again, re-align the frame. */
if (gdbarch_frame_align_p (current_gdbarch))
*sp = gdbarch_frame_align (current_gdbarch, *sp);
- VALUE_ADDRESS (val) = *sp;
+ set_value_address (val, *sp);
*sp += len;
if (gdbarch_frame_align_p (current_gdbarch))
*sp = gdbarch_frame_align (current_gdbarch, *sp);
}
VALUE_LVAL (val) = lval_memory;
- write_memory (VALUE_ADDRESS (val), value_contents_raw (val), len);
+ write_memory (value_address (val), value_contents_raw (val), len);
}
return val;
@@ -3873,12 +3873,12 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp)
bounds = ensure_lval (bounds, sp);
modify_general_field (value_contents_writeable (descriptor),
- VALUE_ADDRESS (ensure_lval (arr, sp)),
+ value_address (ensure_lval (arr, sp)),
fat_pntr_data_bitpos (desc_type),
fat_pntr_data_bitsize (desc_type));
modify_general_field (value_contents_writeable (descriptor),
- VALUE_ADDRESS (bounds),
+ value_address (bounds),
fat_pntr_bounds_bitpos (desc_type),
fat_pntr_bounds_bitsize (desc_type));
@@ -7430,7 +7430,7 @@ static struct value *
ada_to_fixed_value (struct value *val)
{
return ada_to_fixed_value_create (value_type (val),
- VALUE_ADDRESS (val) + value_offset (val),
+ value_address (val),
val);
}
@@ -7776,7 +7776,7 @@ unwrap_value (struct value *val)
return
coerce_unspec_val_to_type
(val, ada_to_fixed_type (raw_real_type, 0,
- VALUE_ADDRESS (val) + value_offset (val),
+ value_address (val),
NULL, 1));
}
}
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 14f2503..c0d2ed5 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -271,7 +271,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), dest, len);
+ read_memory (value_address (array_val), 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 1db677d..a6f3f48 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -690,7 +690,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
}
else
retn = ada_val_print_1 (value_type (val), value_contents (val), 0,
- VALUE_ADDRESS (val), stream, recurse, options);
+ value_address (val), stream, recurse, options);
value_free_to_mark (mark);
return retn;
}
@@ -894,7 +894,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
deref_val_int));
val_print (value_type (deref_val),
value_contents (deref_val), 0,
- VALUE_ADDRESS (deref_val), stream, recurse + 1,
+ value_address (deref_val), stream, recurse + 1,
options, current_language);
}
else
@@ -934,7 +934,7 @@ ada_value_print (struct value *val0, struct ui_file *stream,
const struct value_print_options *options)
{
const gdb_byte *valaddr = value_contents (val0);
- CORE_ADDR address = VALUE_ADDRESS (val0) + value_offset (val0);
+ CORE_ADDR address = value_address (val0);
struct type *type =
ada_to_fixed_type (value_type (val0), valaddr, address, NULL, 1);
struct value *val =
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1235946..8b2d55e 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -992,7 +992,7 @@ update_watchpoint (struct breakpoint *b, int reparse)
int len, type;
struct bp_location *loc, **tmp;
- addr = VALUE_ADDRESS (v) + value_offset (v);
+ addr = value_address (v);
len = TYPE_LENGTH (value_type (v));
type = hw_write;
if (b->type == bp_read_watchpoint)
@@ -6339,7 +6339,7 @@ can_use_hardware_watchpoint (struct value *v)
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
&& TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
{
- CORE_ADDR vaddr = VALUE_ADDRESS (v) + value_offset (v);
+ CORE_ADDR vaddr = value_address (v);
int len = TYPE_LENGTH (value_type (v));
if (!target_region_ok_for_hw_watchpoint (vaddr, len))
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index cfdf2c0..3433da2 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -668,7 +668,7 @@ c_value_print (struct value *val, struct ui_file *stream,
/* Print out object: enclosing type is same as real_type if full */
return val_print (value_enclosing_type (val),
value_contents_all (val), 0,
- VALUE_ADDRESS (val), stream, 0,
+ value_address (val), stream, 0,
&opts, current_language);
/* Note: When we look up RTTI entries, we don't get any information on
const or volatile attributes */
@@ -680,7 +680,7 @@ c_value_print (struct value *val, struct ui_file *stream,
TYPE_NAME (value_enclosing_type (val)));
return val_print (value_enclosing_type (val),
value_contents_all (val), 0,
- VALUE_ADDRESS (val), stream, 0,
+ value_address (val), stream, 0,
&opts, current_language);
}
/* Otherwise, we end up at the return outside this "if" */
@@ -688,6 +688,6 @@ c_value_print (struct value *val, struct ui_file *stream,
return val_print (val_type, value_contents_all (val),
value_embedded_offset (val),
- VALUE_ADDRESS (val) + value_offset (val),
+ value_address (val),
stream, 0, &opts, current_language);
}
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index ee29f2a..96e6111 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -296,7 +296,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format)
if (VALUE_LVAL (val))
{
- vaddr = VALUE_ADDRESS (val);
+ vaddr = value_address (val);
}
else
{
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 8b7d868e..181b4ff 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -461,6 +461,7 @@ cp_print_static_field (struct type *type,
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
CORE_ADDR *first_dont_print;
+ CORE_ADDR addr;
int i;
first_dont_print
@@ -470,7 +471,7 @@ cp_print_static_field (struct type *type,
while (--i >= 0)
{
- if (VALUE_ADDRESS (val) == first_dont_print[i])
+ if (value_address (val) == first_dont_print[i])
{
fputs_filtered ("<same as static member of an already"
" seen type>",
@@ -479,12 +480,13 @@ cp_print_static_field (struct type *type,
}
}
- obstack_grow (&dont_print_statmem_obstack, (char *) &VALUE_ADDRESS (val),
+ addr = value_address (val);
+ obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
sizeof (CORE_ADDR));
CHECK_TYPEDEF (type);
cp_print_value_fields (type, type, value_contents_all (val),
- value_embedded_offset (val), VALUE_ADDRESS (val),
+ value_embedded_offset (val), addr,
stream, recurse, options, NULL, 1);
return;
}
@@ -492,7 +494,7 @@ cp_print_static_field (struct type *type,
opts = *options;
opts.deref_ref = 0;
val_print (type, value_contents_all (val),
- value_embedded_offset (val), VALUE_ADDRESS (val),
+ value_embedded_offset (val), value_address (val),
stream, recurse, &opts, current_language);
}
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index 93a1779..c48d2fe 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -684,7 +684,7 @@ info_mach_region_command (char *exp, int from_tty)
if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory)
{
- address = VALUE_ADDRESS (val);
+ address = value_address (val);
}
else
{
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index cad3db8..5ffccd3 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -264,7 +264,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
retval = allocate_value (SYMBOL_TYPE (var));
VALUE_LVAL (retval) = lval_memory;
set_value_lazy (retval, 1);
- VALUE_ADDRESS (retval) = address;
+ set_value_address (retval, address);
}
set_value_initialized (retval, ctx->initialized);
diff --git a/gdb/eval.c b/gdb/eval.c
index 8dda837..aac8f20 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1211,9 +1211,9 @@ evaluate_subexp_standard (struct type *expect_type,
if (TYPE_CODE (value_type (method)) != TYPE_CODE_FUNC)
error (_("method address has symbol information with non-function type; skipping"));
if (struct_return)
- VALUE_ADDRESS (method) = value_as_address (msg_send_stret);
+ set_value_address (method, value_as_address (msg_send_stret));
else
- VALUE_ADDRESS (method) = value_as_address (msg_send);
+ set_value_address (method, value_as_address (msg_send));
called_method = method;
}
else
@@ -1437,7 +1437,7 @@ evaluate_subexp_standard (struct type *expect_type,
of the ``this'' pointer if necessary, so modify argvec[1] to
reflect any ``this'' changes. */
arg2 = value_from_longest (lookup_pointer_type(value_type (temp)),
- VALUE_ADDRESS (temp) + value_offset (temp)
+ value_address (temp)
+ value_embedded_offset (temp));
argvec[1] = arg2; /* the ``this'' pointer */
}
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 1048887..4f20139 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -275,7 +275,7 @@ value_of_register (int regnum, struct frame_info *frame)
memcpy (value_contents_raw (reg_val), raw_buffer,
register_size (gdbarch, regnum));
VALUE_LVAL (reg_val) = lval;
- VALUE_ADDRESS (reg_val) = addr;
+ set_value_address (reg_val, addr);
VALUE_REGNUM (reg_val) = regnum;
set_value_optimized_out (reg_val, optim);
VALUE_FRAME_ID (reg_val) = get_frame_id (frame);
@@ -477,10 +477,10 @@ read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_BLOCK:
if (overlay_debugging)
- VALUE_ADDRESS (v) = symbol_overlayed_address
- (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var));
+ set_value_address (v, symbol_overlayed_address
+ (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var)));
else
- VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (var));
+ set_value_address (v, BLOCK_START (SYMBOL_BLOCK_VALUE (var)));
return v;
case LOC_REGISTER:
@@ -551,7 +551,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
break;
}
- VALUE_ADDRESS (v) = addr;
+ set_value_address (v, addr);
set_value_lazy (v, 1);
return v;
}
diff --git a/gdb/frame.c b/gdb/frame.c
index b0a99fb..44a9c65 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -602,7 +602,7 @@ frame_register_unwind (struct frame_info *frame, int regnum,
*optimizedp = value_optimized_out (value);
*lvalp = VALUE_LVAL (value);
- *addrp = VALUE_ADDRESS (value);
+ *addrp = value_address (value);
*realnump = VALUE_REGNUM (value);
if (bufferp)
@@ -688,7 +688,7 @@ frame_unwind_register_value (struct frame_info *frame, int regnum)
VALUE_REGNUM (value));
else if (VALUE_LVAL (value) == lval_memory)
fprintf_unfiltered (gdb_stdlog, " address=0x%s",
- paddr_nz (VALUE_ADDRESS (value)));
+ paddr_nz (value_address (value)));
else
fprintf_unfiltered (gdb_stdlog, " computed");
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index ff387db..452f70c 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1230,7 +1230,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, VALUE_ADDRESS (arg));
+ store_unsigned_integer (valbuf, 4, value_address (arg));
typecode = TYPE_CODE_PTR;
len = 4;
val = valbuf;
diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
index 7cacac1..a456228 100644
--- a/gdb/gnu-v2-abi.c
+++ b/gdb/gnu-v2-abi.c
@@ -242,7 +242,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
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_address (value_field (v, known_type_vptr_fieldno)) == 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 3a52df3..ece910b 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -269,8 +269,7 @@ gnuv3_rtti_type (struct value *value,
/* Find the linker symbol for this vtable. */
vtable_symbol
- = lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtable)
- + value_offset (vtable)
+ = lookup_minimal_symbol_by_pc (value_address (vtable)
+ value_embedded_offset (vtable));
if (! vtable_symbol)
return NULL;
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 0dfd4ed..193a15b 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -217,7 +217,7 @@ find_function_addr (struct value *function, struct type **retval_type)
/* Determine address to call. */
if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
{
- funaddr = VALUE_ADDRESS (function);
+ funaddr = value_address (function);
value_type = TYPE_TARGET_TYPE (ftype);
}
else if (code == TYPE_CODE_PTR)
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index ce17a28..4b3f803 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -211,8 +211,7 @@ get_java_utf8_name (struct obstack *obstack, struct value *name)
CORE_ADDR data_addr;
temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
name_length = (int) value_as_long (temp);
- data_addr = VALUE_ADDRESS (temp) + value_offset (temp)
- + TYPE_LENGTH (value_type (temp));
+ data_addr = value_address (temp) + TYPE_LENGTH (value_type (temp));
chrs = obstack_alloc (obstack, name_length + 1);
chrs[name_length] = '\0';
read_memory (data_addr, (gdb_byte *) chrs, name_length);
@@ -267,7 +266,7 @@ type_from_class (struct value *clas)
return NULL;
clas = value_ind (clas);
}
- addr = VALUE_ADDRESS (clas) + value_offset (clas);
+ addr = value_address (clas);
#if 0
get_java_class_symtab ();
@@ -422,8 +421,7 @@ java_link_class_type (struct type *type, struct value *clas)
fields = NULL;
nfields--; /* First set up dummy "class" field. */
- SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields),
- VALUE_ADDRESS (clas) + value_offset (clas));
+ SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas));
TYPE_FIELD_NAME (type, nfields) = "class";
TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
SET_TYPE_FIELD_PRIVATE (type, nfields);
@@ -440,7 +438,9 @@ java_link_class_type (struct type *type, struct value *clas)
}
else
{ /* Re-use field value for next field. */
- VALUE_ADDRESS (field) += TYPE_LENGTH (value_type (field));
+ CORE_ADDR addr
+ = value_address (field) + TYPE_LENGTH (value_type (field));
+ set_value_address (field, addr);
set_value_lazy (field, 1);
}
temp = field;
@@ -510,7 +510,9 @@ java_link_class_type (struct type *type, struct value *clas)
}
else
{ /* Re-use method value for next method. */
- VALUE_ADDRESS (method) += TYPE_LENGTH (value_type (method));
+ CORE_ADDR addr
+ = value_address (method) + TYPE_LENGTH (value_type (method));
+ set_value_address (method, addr);
set_value_lazy (method, 1);
}
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index a1b8a71..cdcb440 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -45,7 +45,7 @@ java_value_print (struct value *val, struct ui_file *stream,
struct value_print_options opts;
type = value_type (val);
- address = VALUE_ADDRESS (val) + value_offset (val);
+ address = value_address (val);
if (is_object_type (type))
{
@@ -143,8 +143,8 @@ java_value_print (struct value *val, struct ui_file *stream,
struct value *v = allocate_value (el_type);
struct value *next_v = allocate_value (el_type);
- VALUE_ADDRESS (v) = address + JAVA_OBJECT_SIZE + 4;
- VALUE_ADDRESS (next_v) = VALUE_ADDRESS (v);
+ set_value_address (v, address + JAVA_OBJECT_SIZE + 4);
+ set_value_address (next_v, value_raw_address (v));
while (i < length && things_printed < options->print_max)
{
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 5f4b9a6..eccfe31 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -713,7 +713,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (len > 8
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
{
- store_unsigned_integer (valbuf, 4, VALUE_ADDRESS (args[argnum]));
+ store_unsigned_integer (valbuf, 4, value_address (args[argnum]));
typecode = TYPE_CODE_PTR;
len = 4;
val = valbuf;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 74e8ab9..0bf2b84 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -788,7 +788,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
get_user_print_options (&opts);
opts.deref_ref = 0;
val_print (value_type (val), value_contents (val),
- value_embedded_offset (val), VALUE_ADDRESS (val),
+ value_embedded_offset (val), value_address (val),
stb->stream, 0, &opts, current_language);
ui_out_field_stream (uiout, "value", stb);
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 66793fd..e6aa8ff 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -2766,7 +2766,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (len > regsize
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
{
- store_unsigned_integer (valbuf, regsize, VALUE_ADDRESS (arg));
+ store_unsigned_integer (valbuf, regsize, value_address (arg));
typecode = TYPE_CODE_PTR;
len = regsize;
val = valbuf;
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 2586475..e2ca050 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1267,7 +1267,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
/* Change to pointer-to-type. */
arg_len = push_size;
store_unsigned_integer (valbuf, push_size,
- VALUE_ADDRESS (*args));
+ value_address (*args));
val = &valbuf[0];
}
else
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 68ff54a..30d0650 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -930,7 +930,7 @@ pascal_object_print_static_field (struct value *val,
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
- CORE_ADDR *first_dont_print;
+ CORE_ADDR *first_dont_print, addr;
int i;
first_dont_print
@@ -940,7 +940,7 @@ pascal_object_print_static_field (struct value *val,
while (--i >= 0)
{
- if (VALUE_ADDRESS (val) == first_dont_print[i])
+ if (value_address (val) == first_dont_print[i])
{
fputs_filtered ("<same as static member of an already seen type>",
stream);
@@ -948,11 +948,12 @@ pascal_object_print_static_field (struct value *val,
}
}
- obstack_grow (&dont_print_statmem_obstack, (char *) &VALUE_ADDRESS (val),
+ addr = value_address (val);
+ obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
sizeof (CORE_ADDR));
CHECK_TYPEDEF (type);
- pascal_object_print_value_fields (type, value_contents (val), VALUE_ADDRESS (val),
+ pascal_object_print_value_fields (type, value_contents (val), addr,
stream, recurse, options, NULL, 1);
return;
}
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 8403d5f..cab7032 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -270,7 +270,7 @@ print_formatted (struct value *val, int size,
int len = TYPE_LENGTH (type);
if (VALUE_LVAL (val) == lval_memory)
- next_address = VALUE_ADDRESS (val) + len;
+ next_address = value_address (val) + len;
if (size)
{
@@ -279,9 +279,9 @@ print_formatted (struct value *val, int size,
case 's':
{
struct type *elttype = value_type (val);
- next_address = (VALUE_ADDRESS (val)
+ next_address = (value_address (val)
+ val_print_string (elttype,
- VALUE_ADDRESS (val), -1,
+ value_address (val), -1,
stream, options));
}
return;
@@ -289,8 +289,8 @@ print_formatted (struct value *val, int size,
case 'i':
/* We often wrap here if there are long symbolic names. */
wrap_here (" ");
- next_address = (VALUE_ADDRESS (val)
- + gdb_print_insn (VALUE_ADDRESS (val), stream,
+ next_address = (value_address (val)
+ + gdb_print_insn (value_address (val), stream,
&branch_delay_insns));
return;
}
@@ -1325,7 +1325,7 @@ x_command (char *exp, int from_tty)
if (/* last_format == 'i' && */
TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory)
- next_address = VALUE_ADDRESS (val);
+ next_address = value_address (val);
else
next_address = value_as_address (val);
do_cleanups (old_chain);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index af962a6..31c5f4a 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1144,7 +1144,7 @@ encode_actions (struct breakpoint *t, char ***tdp_actions,
case UNOP_MEMVAL:
/* safe because we know it's a simple expression */
tempval = evaluate_expression (exp);
- addr = VALUE_ADDRESS (tempval) + value_offset (tempval);
+ addr = value_address (tempval);
len = TYPE_LENGTH (check_typedef (exp->elts[1].type));
add_memrange (collect, memrange_absolute, addr, len);
break;
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 9850de4..285fe3f 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -705,7 +705,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
if (!v850_type_is_scalar (value_type (*args))
&& TYPE_LENGTH (value_type (*args)) > E_MAX_RETTYPE_SIZE_IN_REGS)
{
- store_unsigned_integer (valbuf, 4, VALUE_ADDRESS (*args));
+ store_unsigned_integer (valbuf, 4, value_address (*args));
len = 4;
val = valbuf;
}
diff --git a/gdb/valops.c b/gdb/valops.c
index a5bef37..f06d32c 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -254,10 +254,8 @@ 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);
- addr2 -= (VALUE_ADDRESS (v)
- + value_offset (v)
- + value_embedded_offset (v));
+ CORE_ADDR addr2 = value_address (v2);
+ addr2 -= value_address (v) + value_embedded_offset (v);
return value_at (type, addr2);
}
}
@@ -510,8 +508,7 @@ value_cast (struct type *type, struct value *arg2)
return arg2;
}
else if (VALUE_LVAL (arg2) == lval_memory)
- return value_at_lazy (type,
- VALUE_ADDRESS (arg2) + value_offset (arg2));
+ return value_at_lazy (type, value_address (arg2));
else if (code1 == TYPE_CODE_VOID)
{
return value_zero (builtin_type_void, not_lval);
@@ -593,7 +590,7 @@ value_at (struct type *type, CORE_ADDR addr)
read_memory (addr, value_contents_all_raw (val), TYPE_LENGTH (type));
VALUE_LVAL (val) = lval_memory;
- VALUE_ADDRESS (val) = addr;
+ set_value_address (val, addr);
return val;
}
@@ -611,7 +608,7 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
val = allocate_value_lazy (type);
VALUE_LVAL (val) = lval_memory;
- VALUE_ADDRESS (val) = addr;
+ set_value_address (val, addr);
return val;
}
@@ -637,7 +634,7 @@ value_fetch_lazy (struct value *val)
allocate_value_contents (val);
if (VALUE_LVAL (val) == lval_memory)
{
- CORE_ADDR addr = VALUE_ADDRESS (val) + value_offset (val);
+ CORE_ADDR addr = value_address (val);
int length = TYPE_LENGTH (check_typedef (value_enclosing_type (val)));
if (length)
@@ -709,7 +706,7 @@ value_fetch_lazy (struct value *val)
VALUE_REGNUM (new_val));
else if (VALUE_LVAL (new_val) == lval_memory)
fprintf_unfiltered (gdb_stdlog, " address=0x%s",
- paddr_nz (VALUE_ADDRESS (new_val)));
+ paddr_nz (value_address (new_val)));
else
fprintf_unfiltered (gdb_stdlog, " computed");
@@ -813,16 +810,15 @@ value_assign (struct value *toval, struct value *fromval)
error (_("Can't handle bitfields which don't fit in a %d bit word."),
(int) sizeof (LONGEST) * HOST_CHAR_BIT);
- read_memory (VALUE_ADDRESS (toval) + value_offset (toval),
- buffer, changed_len);
+ read_memory (value_address (toval), buffer, changed_len);
modify_field (buffer, value_as_long (fromval),
value_bitpos (toval), value_bitsize (toval));
- changed_addr = VALUE_ADDRESS (toval) + value_offset (toval);
+ changed_addr = value_address (toval);
dest_buffer = buffer;
}
else
{
- changed_addr = VALUE_ADDRESS (toval) + value_offset (toval);
+ changed_addr = value_address (toval);
changed_len = TYPE_LENGTH (type);
dest_buffer = value_contents (fromval);
}
@@ -985,11 +981,11 @@ value_repeat (struct value *arg1, int count)
val = allocate_repeat_value (value_enclosing_type (arg1), count);
- read_memory (VALUE_ADDRESS (arg1) + value_offset (arg1),
+ read_memory (value_address (arg1),
value_contents_all_raw (val),
TYPE_LENGTH (value_enclosing_type (val)));
VALUE_LVAL (val) = lval_memory;
- VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + value_offset (arg1);
+ set_value_address (val, value_address (arg1));
return val;
}
@@ -1039,7 +1035,7 @@ address_of_variable (struct symbol *var, struct block *b)
if ((VALUE_LVAL (val) == lval_memory && value_lazy (val))
|| TYPE_CODE (type) == TYPE_CODE_FUNC)
{
- CORE_ADDR addr = VALUE_ADDRESS (val);
+ CORE_ADDR addr = value_address (val);
return value_from_pointer (lookup_pointer_type (type), addr);
}
@@ -1155,7 +1151,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 (type)),
- (VALUE_ADDRESS (arg1) + value_offset (arg1)));
+ value_address (arg1));
}
/* Given a value which is a function, return a value which is a pointer
@@ -1170,7 +1166,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 (value_type (arg1)),
- (VALUE_ADDRESS (arg1) + value_offset (arg1)));
+ value_address (arg1));
return retval;
}
@@ -1205,8 +1201,7 @@ value_addr (struct value *arg1)
/* Get target memory address */
arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
- (VALUE_ADDRESS (arg1)
- + value_offset (arg1)
+ (value_address (arg1)
+ value_embedded_offset (arg1)));
/* This may be a pointer to a base subobject; so remember the
@@ -1618,8 +1613,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
boffset = baseclass_offset (type, i,
value_contents (arg1) + offset,
- VALUE_ADDRESS (arg1)
- + value_offset (arg1) + offset);
+ value_address (arg1) + offset);
if (boffset == -1)
error (_("virtual baseclass botch"));
@@ -1633,14 +1627,13 @@ search_struct_field (char *name, struct value *arg1, int offset,
CORE_ADDR base_addr;
v2 = allocate_value (basetype);
- base_addr =
- VALUE_ADDRESS (arg1) + value_offset (arg1) + boffset;
+ base_addr = value_address (arg1) + boffset;
if (target_read_memory (base_addr,
value_contents_raw (v2),
TYPE_LENGTH (basetype)) != 0)
error (_("virtual baseclass botch"));
VALUE_LVAL (v2) = lval_memory;
- VALUE_ADDRESS (v2) = base_addr;
+ set_value_address (v2, base_addr);
}
else
{
@@ -1763,8 +1756,7 @@ search_struct_method (char *name, struct value **arg1p,
if (offset < 0 || offset >= TYPE_LENGTH (type))
{
gdb_byte *tmp = alloca (TYPE_LENGTH (baseclass));
- if (target_read_memory (VALUE_ADDRESS (*arg1p)
- + value_offset (*arg1p) + offset,
+ if (target_read_memory (value_address (*arg1p) + offset,
tmp, TYPE_LENGTH (baseclass)) != 0)
error (_("virtual baseclass botch"));
base_valaddr = tmp;
@@ -1773,8 +1765,7 @@ search_struct_method (char *name, struct value **arg1p,
base_valaddr = value_contents (*arg1p) + offset;
base_offset = baseclass_offset (type, i, base_valaddr,
- VALUE_ADDRESS (*arg1p)
- + value_offset (*arg1p) + offset);
+ value_address (*arg1p) + offset);
if (base_offset == -1)
error (_("virtual baseclass botch"));
}
@@ -1983,7 +1974,7 @@ find_method_list (struct value **argp, char *method,
base_offset = value_offset (*argp) + offset;
base_offset = baseclass_offset (type, i,
value_contents (*argp) + base_offset,
- VALUE_ADDRESS (*argp) + base_offset);
+ value_address (*argp) + base_offset);
if (base_offset == -1)
error (_("virtual baseclass botch"));
}
@@ -2743,7 +2734,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 (value_type (result),
value_contents_writeable (result),
- VALUE_ADDRESS (v), 0);
+ value_address (v), 0);
}
}
return result;
@@ -2902,7 +2893,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, value_address (argp) - top +
(using_enc ? 0 : value_embedded_offset (argp)));
deprecated_set_value_type (new_val, value_type (argp));
set_value_embedded_offset (new_val, (using_enc
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 34b9422..5659f99 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -315,7 +315,7 @@ common_val_print (struct value *val, struct ui_file *stream, int recurse,
return 0;
return val_print (value_type (val), value_contents_all (val),
- value_embedded_offset (val), VALUE_ADDRESS (val),
+ value_embedded_offset (val), value_address (val),
stream, recurse, options, language);
}
diff --git a/gdb/value.c b/gdb/value.c
index 9c08a41..215ead5 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -249,7 +249,7 @@ allocate_value_lazy (struct type *type)
val->type = type;
val->enclosing_type = type;
VALUE_LVAL (val) = not_lval;
- VALUE_ADDRESS (val) = 0;
+ val->location.address = 0;
VALUE_FRAME_ID (val) = null_frame_id;
val->offset = 0;
val->bitpos = 0;
@@ -525,10 +525,30 @@ deprecated_value_lval_hack (struct value *value)
return &value->lval;
}
-CORE_ADDR *
-deprecated_value_address_hack (struct value *value)
+CORE_ADDR
+value_address (struct value *value)
+{
+ if (value->lval == lval_internalvar
+ || value->lval == lval_internalvar_component)
+ return 0;
+ return value->location.address + value->offset;
+}
+
+CORE_ADDR
+value_raw_address (struct value *value)
+{
+ if (value->lval == lval_internalvar
+ || value->lval == lval_internalvar_component)
+ return 0;
+ return value->location.address;
+}
+
+void
+set_value_address (struct value *value, CORE_ADDR addr)
{
- return &value->location.address;
+ gdb_assert (value->lval != lval_internalvar
+ && value->lval != lval_internalvar_component);
+ value->location.address = addr;
}
struct internalvar **
@@ -1292,7 +1312,7 @@ value_as_address (struct value *val)
Upon entry to this function, if VAL is a value of type `function'
(that is, TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC), then
- VALUE_ADDRESS (val) is the address of the function. This is what
+ value_address (val) 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'
@@ -1312,7 +1332,7 @@ value_as_address (struct value *val)
function, just return its address directly. */
if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
|| TYPE_CODE (value_type (val)) == TYPE_CODE_METHOD)
- return VALUE_ADDRESS (val);
+ return value_address (val);
val = coerce_array (val);
@@ -1543,7 +1563,7 @@ value_static_field (struct type *type, int fieldno)
}
if (retval && VALUE_LVAL (retval) == lval_memory)
SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
- VALUE_ADDRESS (retval));
+ value_address (retval));
}
return retval;
}
@@ -1688,7 +1708,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f, int j, struct type *ty
v = allocate_value (ftype);
if (sym)
{
- VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
+ set_value_address (v, BLOCK_START (SYMBOL_BLOCK_VALUE (sym)));
}
else
{
@@ -1697,9 +1717,9 @@ value_fn_field (struct value **arg1p, struct fn_field *f, int j, struct type *ty
struct objfile *objfile = msymbol_objfile (msym);
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- VALUE_ADDRESS (v)
- = gdbarch_convert_from_func_ptr_addr
- (gdbarch, SYMBOL_VALUE_ADDRESS (msym), &current_target);
+ set_value_address (v,
+ gdbarch_convert_from_func_ptr_addr
+ (gdbarch, SYMBOL_VALUE_ADDRESS (msym), &current_target));
}
if (arg1p)
@@ -1912,7 +1932,7 @@ value_from_contents_and_address (struct type *type,
set_value_lazy (v, 1);
else
memcpy (value_contents_raw (v), valaddr, TYPE_LENGTH (type));
- VALUE_ADDRESS (v) = address;
+ set_value_address (v, address);
VALUE_LVAL (v) = lval_memory;
return v;
}
diff --git a/gdb/value.h b/gdb/value.h
index 69a59a2..456c9c8 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -272,11 +272,18 @@ extern void set_value_component_location (struct value *component,
extern enum lval_type *deprecated_value_lval_hack (struct value *);
#define VALUE_LVAL(val) (*deprecated_value_lval_hack (val))
-/* If lval == lval_memory, this is the address in the inferior. If
- lval == lval_register, this is the byte offset into the registers
- structure. */
-extern CORE_ADDR *deprecated_value_address_hack (struct value *);
-#define VALUE_ADDRESS(val) (*deprecated_value_address_hack (val))
+/* 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 (struct value *);
+
+/* Like value_address, except the result does not include value's
+ offset. */
+extern CORE_ADDR value_raw_address (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 *);