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.
This commit is contained in:
Tom Tromey 2009-05-28 00:53:52 +00:00
parent 2c74e83381
commit 42ae523077
31 changed files with 239 additions and 128 deletions

View File

@ -1,3 +1,92 @@
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> 2009-05-27 Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com> Thiago Jung Bauermann <bauerman@br.ibm.com>
Phil Muldoon <pmuldoon@redhat.com> Phil Muldoon <pmuldoon@redhat.com>

View File

@ -485,7 +485,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
set_value_component_location (result, val); set_value_component_location (result, val);
set_value_bitsize (result, value_bitsize (val)); set_value_bitsize (result, value_bitsize (val));
set_value_bitpos (result, value_bitpos (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) if (value_lazy (val)
|| TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
set_value_lazy (result, 1); set_value_lazy (result, 1);
@ -1287,8 +1287,7 @@ thin_data_pntr (struct value *val)
if (TYPE_CODE (type) == TYPE_CODE_PTR) if (TYPE_CODE (type) == TYPE_CODE_PTR)
return value_cast (data_type, value_copy (val)); return value_cast (data_type, value_copy (val));
else else
return value_from_longest (data_type, return value_from_longest (data_type, value_address (val));
VALUE_ADDRESS (val) + value_offset (val));
} }
/* True iff TYPE indicates a "thick" array pointer type. */ /* 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) if (TYPE_CODE (type) == TYPE_CODE_PTR)
addr = value_as_long (arr); addr = value_as_long (arr);
else else
addr = VALUE_ADDRESS (arr) + value_offset (arr); addr = value_address (arr);
return return
value_from_longest (lookup_pointer_type (bounds_type), 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)) else if (VALUE_LVAL (obj) == lval_memory && value_lazy (obj))
{ {
v = value_at (type, v = value_at (type,
VALUE_ADDRESS (obj) + value_offset (obj) + offset); value_address (obj) + offset);
bytes = (unsigned char *) alloca (len); bytes = (unsigned char *) alloca (len);
read_memory (VALUE_ADDRESS (v), bytes, len); read_memory (value_address (v), bytes, len);
} }
else else
{ {
@ -1980,15 +1979,17 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
if (obj != NULL) if (obj != NULL)
{ {
CORE_ADDR new_addr;
set_value_component_location (v, obj); 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_bitpos (v, bit_offset + value_bitpos (obj));
set_value_bitsize (v, bit_size); set_value_bitsize (v, bit_size);
if (value_bitpos (v) >= HOST_CHAR_BIT) 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_bitpos (v, value_bitpos (v) - HOST_CHAR_BIT);
} }
set_value_address (v, new_addr);
} }
else else
set_value_bitsize (v, bit_size); set_value_bitsize (v, bit_size);
@ -2181,7 +2182,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
int from_size; int from_size;
char *buffer = (char *) alloca (len); char *buffer = (char *) alloca (len);
struct value *val; 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) if (TYPE_CODE (type) == TYPE_CODE_FLT)
fromval = value_cast (type, fromval); fromval = value_cast (type, fromval);
@ -2222,8 +2223,7 @@ value_assign_to_component (struct value *container, struct value *component,
struct value *val) struct value *val)
{ {
LONGEST offset_in_container = LONGEST offset_in_container =
(LONGEST) (VALUE_ADDRESS (component) + value_offset (component) (LONGEST) (value_address (component) - value_address (container));
- VALUE_ADDRESS (container) - value_offset (container));
int bit_offset_in_container = int bit_offset_in_container =
value_bitpos (component) - value_bitpos (container); value_bitpos (component) - value_bitpos (container);
int bits; 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 /* 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 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 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 * static struct value *
ensure_lval (struct value *val, CORE_ADDR *sp) ensure_lval (struct value *val, CORE_ADDR *sp)
@ -3764,12 +3764,12 @@ ensure_lval (struct value *val, CORE_ADDR *sp)
indicated. */ indicated. */
if (gdbarch_inner_than (current_gdbarch, 1, 2)) 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. */ reserving sufficient space. */
*sp -= len; *sp -= len;
if (gdbarch_frame_align_p (current_gdbarch)) if (gdbarch_frame_align_p (current_gdbarch))
*sp = gdbarch_frame_align (current_gdbarch, *sp); *sp = gdbarch_frame_align (current_gdbarch, *sp);
VALUE_ADDRESS (val) = *sp; set_value_address (val, *sp);
} }
else else
{ {
@ -3777,14 +3777,14 @@ ensure_lval (struct value *val, CORE_ADDR *sp)
then again, re-align the frame. */ then again, re-align the frame. */
if (gdbarch_frame_align_p (current_gdbarch)) if (gdbarch_frame_align_p (current_gdbarch))
*sp = gdbarch_frame_align (current_gdbarch, *sp); *sp = gdbarch_frame_align (current_gdbarch, *sp);
VALUE_ADDRESS (val) = *sp; set_value_address (val, *sp);
*sp += len; *sp += len;
if (gdbarch_frame_align_p (current_gdbarch)) if (gdbarch_frame_align_p (current_gdbarch))
*sp = gdbarch_frame_align (current_gdbarch, *sp); *sp = gdbarch_frame_align (current_gdbarch, *sp);
} }
VALUE_LVAL (val) = lval_memory; 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; return val;
@ -3873,12 +3873,12 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp)
bounds = ensure_lval (bounds, sp); bounds = ensure_lval (bounds, sp);
modify_general_field (value_contents_writeable (descriptor), 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_bitpos (desc_type),
fat_pntr_data_bitsize (desc_type)); fat_pntr_data_bitsize (desc_type));
modify_general_field (value_contents_writeable (descriptor), modify_general_field (value_contents_writeable (descriptor),
VALUE_ADDRESS (bounds), value_address (bounds),
fat_pntr_bounds_bitpos (desc_type), fat_pntr_bounds_bitpos (desc_type),
fat_pntr_bounds_bitsize (desc_type)); fat_pntr_bounds_bitsize (desc_type));
@ -7430,7 +7430,7 @@ static struct value *
ada_to_fixed_value (struct value *val) ada_to_fixed_value (struct value *val)
{ {
return ada_to_fixed_value_create (value_type (val), return ada_to_fixed_value_create (value_type (val),
VALUE_ADDRESS (val) + value_offset (val), value_address (val),
val); val);
} }
@ -7776,7 +7776,7 @@ unwrap_value (struct value *val)
return return
coerce_unspec_val_to_type coerce_unspec_val_to_type
(val, ada_to_fixed_type (raw_real_type, 0, (val, ada_to_fixed_type (raw_real_type, 0,
VALUE_ADDRESS (val) + value_offset (val), value_address (val),
NULL, 1)); NULL, 1));
} }
} }

View File

@ -271,7 +271,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len)
/* Extract LEN characters from the fat string. */ /* Extract LEN characters from the fat string. */
array_val = value_ind (value_field (val, array_fieldno)); 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. */ /* Add the NUL character to close the string. */
dest[len] = '\0'; dest[len] = '\0';

View File

@ -690,7 +690,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
} }
else else
retn = ada_val_print_1 (value_type (val), value_contents (val), 0, 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); value_free_to_mark (mark);
return retn; return retn;
} }
@ -894,7 +894,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
deref_val_int)); deref_val_int));
val_print (value_type (deref_val), val_print (value_type (deref_val),
value_contents (deref_val), 0, value_contents (deref_val), 0,
VALUE_ADDRESS (deref_val), stream, recurse + 1, value_address (deref_val), stream, recurse + 1,
options, current_language); options, current_language);
} }
else else
@ -934,7 +934,7 @@ ada_value_print (struct value *val0, struct ui_file *stream,
const struct value_print_options *options) const struct value_print_options *options)
{ {
const gdb_byte *valaddr = value_contents (val0); 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 = struct type *type =
ada_to_fixed_type (value_type (val0), valaddr, address, NULL, 1); ada_to_fixed_type (value_type (val0), valaddr, address, NULL, 1);
struct value *val = struct value *val =

View File

@ -992,7 +992,7 @@ update_watchpoint (struct breakpoint *b, int reparse)
int len, type; int len, type;
struct bp_location *loc, **tmp; struct bp_location *loc, **tmp;
addr = VALUE_ADDRESS (v) + value_offset (v); addr = value_address (v);
len = TYPE_LENGTH (value_type (v)); len = TYPE_LENGTH (value_type (v));
type = hw_write; type = hw_write;
if (b->type == bp_read_watchpoint) 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_STRUCT
&& TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) && 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)); int len = TYPE_LENGTH (value_type (v));
if (!target_region_ok_for_hw_watchpoint (vaddr, len)) if (!target_region_ok_for_hw_watchpoint (vaddr, len))

View File

@ -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 */ /* Print out object: enclosing type is same as real_type if full */
return val_print (value_enclosing_type (val), return val_print (value_enclosing_type (val),
value_contents_all (val), 0, value_contents_all (val), 0,
VALUE_ADDRESS (val), stream, 0, value_address (val), stream, 0,
&opts, current_language); &opts, current_language);
/* Note: When we look up RTTI entries, we don't get any information on /* Note: When we look up RTTI entries, we don't get any information on
const or volatile attributes */ const or volatile attributes */
@ -680,7 +680,7 @@ c_value_print (struct value *val, struct ui_file *stream,
TYPE_NAME (value_enclosing_type (val))); TYPE_NAME (value_enclosing_type (val)));
return val_print (value_enclosing_type (val), return val_print (value_enclosing_type (val),
value_contents_all (val), 0, value_contents_all (val), 0,
VALUE_ADDRESS (val), stream, 0, value_address (val), stream, 0,
&opts, current_language); &opts, current_language);
} }
/* Otherwise, we end up at the return outside this "if" */ /* 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), return val_print (val_type, value_contents_all (val),
value_embedded_offset (val), value_embedded_offset (val),
VALUE_ADDRESS (val) + value_offset (val), value_address (val),
stream, 0, &opts, current_language); stream, 0, &opts, current_language);
} }

View File

@ -296,7 +296,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format)
if (VALUE_LVAL (val)) if (VALUE_LVAL (val))
{ {
vaddr = VALUE_ADDRESS (val); vaddr = value_address (val);
} }
else else
{ {

View File

@ -461,6 +461,7 @@ cp_print_static_field (struct type *type,
if (TYPE_CODE (type) == TYPE_CODE_STRUCT) if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
{ {
CORE_ADDR *first_dont_print; CORE_ADDR *first_dont_print;
CORE_ADDR addr;
int i; int i;
first_dont_print first_dont_print
@ -470,7 +471,7 @@ cp_print_static_field (struct type *type,
while (--i >= 0) 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" fputs_filtered ("<same as static member of an already"
" seen type>", " 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)); sizeof (CORE_ADDR));
CHECK_TYPEDEF (type); CHECK_TYPEDEF (type);
cp_print_value_fields (type, type, value_contents_all (val), 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); stream, recurse, options, NULL, 1);
return; return;
} }
@ -492,7 +494,7 @@ cp_print_static_field (struct type *type,
opts = *options; opts = *options;
opts.deref_ref = 0; opts.deref_ref = 0;
val_print (type, value_contents_all (val), 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); stream, recurse, &opts, current_language);
} }

View File

@ -684,7 +684,7 @@ info_mach_region_command (char *exp, int from_tty)
if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory) && VALUE_LVAL (val) == lval_memory)
{ {
address = VALUE_ADDRESS (val); address = value_address (val);
} }
else else
{ {

View File

@ -264,7 +264,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
retval = allocate_value (SYMBOL_TYPE (var)); retval = allocate_value (SYMBOL_TYPE (var));
VALUE_LVAL (retval) = lval_memory; VALUE_LVAL (retval) = lval_memory;
set_value_lazy (retval, 1); set_value_lazy (retval, 1);
VALUE_ADDRESS (retval) = address; set_value_address (retval, address);
} }
set_value_initialized (retval, ctx->initialized); set_value_initialized (retval, ctx->initialized);

View File

@ -1211,9 +1211,9 @@ evaluate_subexp_standard (struct type *expect_type,
if (TYPE_CODE (value_type (method)) != TYPE_CODE_FUNC) if (TYPE_CODE (value_type (method)) != TYPE_CODE_FUNC)
error (_("method address has symbol information with non-function type; skipping")); error (_("method address has symbol information with non-function type; skipping"));
if (struct_return) if (struct_return)
VALUE_ADDRESS (method) = value_as_address (msg_send_stret); set_value_address (method, value_as_address (msg_send_stret));
else else
VALUE_ADDRESS (method) = value_as_address (msg_send); set_value_address (method, value_as_address (msg_send));
called_method = method; called_method = method;
} }
else else
@ -1437,7 +1437,7 @@ evaluate_subexp_standard (struct type *expect_type,
of the ``this'' pointer if necessary, so modify argvec[1] to of the ``this'' pointer if necessary, so modify argvec[1] to
reflect any ``this'' changes. */ reflect any ``this'' changes. */
arg2 = value_from_longest (lookup_pointer_type(value_type (temp)), arg2 = value_from_longest (lookup_pointer_type(value_type (temp)),
VALUE_ADDRESS (temp) + value_offset (temp) value_address (temp)
+ value_embedded_offset (temp)); + value_embedded_offset (temp));
argvec[1] = arg2; /* the ``this'' pointer */ argvec[1] = arg2; /* the ``this'' pointer */
} }

View File

@ -275,7 +275,7 @@ value_of_register (int regnum, struct frame_info *frame)
memcpy (value_contents_raw (reg_val), raw_buffer, memcpy (value_contents_raw (reg_val), raw_buffer,
register_size (gdbarch, regnum)); register_size (gdbarch, regnum));
VALUE_LVAL (reg_val) = lval; VALUE_LVAL (reg_val) = lval;
VALUE_ADDRESS (reg_val) = addr; set_value_address (reg_val, addr);
VALUE_REGNUM (reg_val) = regnum; VALUE_REGNUM (reg_val) = regnum;
set_value_optimized_out (reg_val, optim); set_value_optimized_out (reg_val, optim);
VALUE_FRAME_ID (reg_val) = get_frame_id (frame); 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: case LOC_BLOCK:
if (overlay_debugging) if (overlay_debugging)
VALUE_ADDRESS (v) = symbol_overlayed_address set_value_address (v, symbol_overlayed_address
(BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var)); (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var)));
else else
VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (var)); set_value_address (v, BLOCK_START (SYMBOL_BLOCK_VALUE (var)));
return v; return v;
case LOC_REGISTER: case LOC_REGISTER:
@ -551,7 +551,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
break; break;
} }
VALUE_ADDRESS (v) = addr; set_value_address (v, addr);
set_value_lazy (v, 1); set_value_lazy (v, 1);
return v; return v;
} }

View File

@ -602,7 +602,7 @@ frame_register_unwind (struct frame_info *frame, int regnum,
*optimizedp = value_optimized_out (value); *optimizedp = value_optimized_out (value);
*lvalp = VALUE_LVAL (value); *lvalp = VALUE_LVAL (value);
*addrp = VALUE_ADDRESS (value); *addrp = value_address (value);
*realnump = VALUE_REGNUM (value); *realnump = VALUE_REGNUM (value);
if (bufferp) if (bufferp)
@ -688,7 +688,7 @@ frame_unwind_register_value (struct frame_info *frame, int regnum)
VALUE_REGNUM (value)); VALUE_REGNUM (value));
else if (VALUE_LVAL (value) == lval_memory) else if (VALUE_LVAL (value) == lval_memory)
fprintf_unfiltered (gdb_stdlog, " address=0x%s", fprintf_unfiltered (gdb_stdlog, " address=0x%s",
paddr_nz (VALUE_ADDRESS (value))); paddr_nz (value_address (value)));
else else
fprintf_unfiltered (gdb_stdlog, " computed"); fprintf_unfiltered (gdb_stdlog, " computed");

View File

@ -1230,7 +1230,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION) 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; typecode = TYPE_CODE_PTR;
len = 4; len = 4;
val = valbuf; val = valbuf;

View File

@ -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. 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 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; return NULL;
vtbl = value_as_address (value_field (v, known_type_vptr_fieldno)); vtbl = value_as_address (value_field (v, known_type_vptr_fieldno));

View File

@ -269,8 +269,7 @@ gnuv3_rtti_type (struct value *value,
/* Find the linker symbol for this vtable. */ /* Find the linker symbol for this vtable. */
vtable_symbol vtable_symbol
= lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtable) = lookup_minimal_symbol_by_pc (value_address (vtable)
+ value_offset (vtable)
+ value_embedded_offset (vtable)); + value_embedded_offset (vtable));
if (! vtable_symbol) if (! vtable_symbol)
return NULL; return NULL;

View File

@ -217,7 +217,7 @@ find_function_addr (struct value *function, struct type **retval_type)
/* Determine address to call. */ /* Determine address to call. */
if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
{ {
funaddr = VALUE_ADDRESS (function); funaddr = value_address (function);
value_type = TYPE_TARGET_TYPE (ftype); value_type = TYPE_TARGET_TYPE (ftype);
} }
else if (code == TYPE_CODE_PTR) else if (code == TYPE_CODE_PTR)

View File

@ -211,8 +211,7 @@ get_java_utf8_name (struct obstack *obstack, struct value *name)
CORE_ADDR data_addr; CORE_ADDR data_addr;
temp = value_struct_elt (&temp, NULL, "length", NULL, "structure"); temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
name_length = (int) value_as_long (temp); name_length = (int) value_as_long (temp);
data_addr = VALUE_ADDRESS (temp) + value_offset (temp) data_addr = value_address (temp) + TYPE_LENGTH (value_type (temp));
+ TYPE_LENGTH (value_type (temp));
chrs = obstack_alloc (obstack, name_length + 1); chrs = obstack_alloc (obstack, name_length + 1);
chrs[name_length] = '\0'; chrs[name_length] = '\0';
read_memory (data_addr, (gdb_byte *) chrs, name_length); read_memory (data_addr, (gdb_byte *) chrs, name_length);
@ -267,7 +266,7 @@ type_from_class (struct value *clas)
return NULL; return NULL;
clas = value_ind (clas); clas = value_ind (clas);
} }
addr = VALUE_ADDRESS (clas) + value_offset (clas); addr = value_address (clas);
#if 0 #if 0
get_java_class_symtab (); get_java_class_symtab ();
@ -422,8 +421,7 @@ java_link_class_type (struct type *type, struct value *clas)
fields = NULL; fields = NULL;
nfields--; /* First set up dummy "class" field. */ nfields--; /* First set up dummy "class" field. */
SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas));
VALUE_ADDRESS (clas) + value_offset (clas));
TYPE_FIELD_NAME (type, nfields) = "class"; TYPE_FIELD_NAME (type, nfields) = "class";
TYPE_FIELD_TYPE (type, nfields) = value_type (clas); TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
SET_TYPE_FIELD_PRIVATE (type, nfields); SET_TYPE_FIELD_PRIVATE (type, nfields);
@ -440,7 +438,9 @@ java_link_class_type (struct type *type, struct value *clas)
} }
else else
{ /* Re-use field value for next field. */ { /* 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); set_value_lazy (field, 1);
} }
temp = field; temp = field;
@ -510,7 +510,9 @@ java_link_class_type (struct type *type, struct value *clas)
} }
else else
{ /* Re-use method value for next method. */ { /* 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); set_value_lazy (method, 1);
} }

View File

@ -45,7 +45,7 @@ java_value_print (struct value *val, struct ui_file *stream,
struct value_print_options opts; struct value_print_options opts;
type = value_type (val); type = value_type (val);
address = VALUE_ADDRESS (val) + value_offset (val); address = value_address (val);
if (is_object_type (type)) 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 *v = allocate_value (el_type);
struct value *next_v = allocate_value (el_type); struct value *next_v = allocate_value (el_type);
VALUE_ADDRESS (v) = address + JAVA_OBJECT_SIZE + 4; set_value_address (v, address + JAVA_OBJECT_SIZE + 4);
VALUE_ADDRESS (next_v) = VALUE_ADDRESS (v); set_value_address (next_v, value_raw_address (v));
while (i < length && things_printed < options->print_max) while (i < length && things_printed < options->print_max)
{ {

View File

@ -713,7 +713,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (len > 8 if (len > 8
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) && (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; typecode = TYPE_CODE_PTR;
len = 4; len = 4;
val = valbuf; val = valbuf;

View File

@ -788,7 +788,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
get_user_print_options (&opts); get_user_print_options (&opts);
opts.deref_ref = 0; opts.deref_ref = 0;
val_print (value_type (val), value_contents (val), 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); stb->stream, 0, &opts, current_language);
ui_out_field_stream (uiout, "value", stb); ui_out_field_stream (uiout, "value", stb);

View File

@ -2766,7 +2766,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (len > regsize if (len > regsize
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) && (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; typecode = TYPE_CODE_PTR;
len = regsize; len = regsize;
val = valbuf; val = valbuf;

View File

@ -1267,7 +1267,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
/* Change to pointer-to-type. */ /* Change to pointer-to-type. */
arg_len = push_size; arg_len = push_size;
store_unsigned_integer (valbuf, push_size, store_unsigned_integer (valbuf, push_size,
VALUE_ADDRESS (*args)); value_address (*args));
val = &valbuf[0]; val = &valbuf[0];
} }
else else

View File

@ -930,7 +930,7 @@ pascal_object_print_static_field (struct value *val,
if (TYPE_CODE (type) == TYPE_CODE_STRUCT) if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
{ {
CORE_ADDR *first_dont_print; CORE_ADDR *first_dont_print, addr;
int i; int i;
first_dont_print first_dont_print
@ -940,7 +940,7 @@ pascal_object_print_static_field (struct value *val,
while (--i >= 0) 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>", fputs_filtered ("<same as static member of an already seen type>",
stream); 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)); sizeof (CORE_ADDR));
CHECK_TYPEDEF (type); 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); stream, recurse, options, NULL, 1);
return; return;
} }

View File

@ -270,7 +270,7 @@ print_formatted (struct value *val, int size,
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
if (VALUE_LVAL (val) == lval_memory) if (VALUE_LVAL (val) == lval_memory)
next_address = VALUE_ADDRESS (val) + len; next_address = value_address (val) + len;
if (size) if (size)
{ {
@ -279,9 +279,9 @@ print_formatted (struct value *val, int size,
case 's': case 's':
{ {
struct type *elttype = value_type (val); struct type *elttype = value_type (val);
next_address = (VALUE_ADDRESS (val) next_address = (value_address (val)
+ val_print_string (elttype, + val_print_string (elttype,
VALUE_ADDRESS (val), -1, value_address (val), -1,
stream, options)); stream, options));
} }
return; return;
@ -289,8 +289,8 @@ print_formatted (struct value *val, int size,
case 'i': case 'i':
/* We often wrap here if there are long symbolic names. */ /* We often wrap here if there are long symbolic names. */
wrap_here (" "); wrap_here (" ");
next_address = (VALUE_ADDRESS (val) next_address = (value_address (val)
+ gdb_print_insn (VALUE_ADDRESS (val), stream, + gdb_print_insn (value_address (val), stream,
&branch_delay_insns)); &branch_delay_insns));
return; return;
} }
@ -1325,7 +1325,7 @@ x_command (char *exp, int from_tty)
if (/* last_format == 'i' && */ if (/* last_format == 'i' && */
TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory) && VALUE_LVAL (val) == lval_memory)
next_address = VALUE_ADDRESS (val); next_address = value_address (val);
else else
next_address = value_as_address (val); next_address = value_as_address (val);
do_cleanups (old_chain); do_cleanups (old_chain);

View File

@ -1144,7 +1144,7 @@ encode_actions (struct breakpoint *t, char ***tdp_actions,
case UNOP_MEMVAL: case UNOP_MEMVAL:
/* safe because we know it's a simple expression */ /* safe because we know it's a simple expression */
tempval = evaluate_expression (exp); tempval = evaluate_expression (exp);
addr = VALUE_ADDRESS (tempval) + value_offset (tempval); addr = value_address (tempval);
len = TYPE_LENGTH (check_typedef (exp->elts[1].type)); len = TYPE_LENGTH (check_typedef (exp->elts[1].type));
add_memrange (collect, memrange_absolute, addr, len); add_memrange (collect, memrange_absolute, addr, len);
break; break;

View File

@ -705,7 +705,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
if (!v850_type_is_scalar (value_type (*args)) if (!v850_type_is_scalar (value_type (*args))
&& TYPE_LENGTH (value_type (*args)) > E_MAX_RETTYPE_SIZE_IN_REGS) && 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; len = 4;
val = valbuf; val = valbuf;
} }

View File

@ -254,10 +254,8 @@ value_cast_structs (struct type *type, struct value *v2)
if (v) if (v)
{ {
/* Downcasting is possible (t1 is superclass of v2). */ /* Downcasting is possible (t1 is superclass of v2). */
CORE_ADDR addr2 = VALUE_ADDRESS (v2); CORE_ADDR addr2 = value_address (v2);
addr2 -= (VALUE_ADDRESS (v) addr2 -= value_address (v) + value_embedded_offset (v);
+ value_offset (v)
+ value_embedded_offset (v));
return value_at (type, addr2); return value_at (type, addr2);
} }
} }
@ -510,8 +508,7 @@ value_cast (struct type *type, struct value *arg2)
return arg2; return arg2;
} }
else if (VALUE_LVAL (arg2) == lval_memory) else if (VALUE_LVAL (arg2) == lval_memory)
return value_at_lazy (type, return value_at_lazy (type, value_address (arg2));
VALUE_ADDRESS (arg2) + value_offset (arg2));
else if (code1 == TYPE_CODE_VOID) else if (code1 == TYPE_CODE_VOID)
{ {
return value_zero (builtin_type_void, not_lval); 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)); read_memory (addr, value_contents_all_raw (val), TYPE_LENGTH (type));
VALUE_LVAL (val) = lval_memory; VALUE_LVAL (val) = lval_memory;
VALUE_ADDRESS (val) = addr; set_value_address (val, addr);
return val; return val;
} }
@ -611,7 +608,7 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
val = allocate_value_lazy (type); val = allocate_value_lazy (type);
VALUE_LVAL (val) = lval_memory; VALUE_LVAL (val) = lval_memory;
VALUE_ADDRESS (val) = addr; set_value_address (val, addr);
return val; return val;
} }
@ -637,7 +634,7 @@ value_fetch_lazy (struct value *val)
allocate_value_contents (val); allocate_value_contents (val);
if (VALUE_LVAL (val) == lval_memory) 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))); int length = TYPE_LENGTH (check_typedef (value_enclosing_type (val)));
if (length) if (length)
@ -709,7 +706,7 @@ value_fetch_lazy (struct value *val)
VALUE_REGNUM (new_val)); VALUE_REGNUM (new_val));
else if (VALUE_LVAL (new_val) == lval_memory) else if (VALUE_LVAL (new_val) == lval_memory)
fprintf_unfiltered (gdb_stdlog, " address=0x%s", fprintf_unfiltered (gdb_stdlog, " address=0x%s",
paddr_nz (VALUE_ADDRESS (new_val))); paddr_nz (value_address (new_val)));
else else
fprintf_unfiltered (gdb_stdlog, " computed"); 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."), error (_("Can't handle bitfields which don't fit in a %d bit word."),
(int) sizeof (LONGEST) * HOST_CHAR_BIT); (int) sizeof (LONGEST) * HOST_CHAR_BIT);
read_memory (VALUE_ADDRESS (toval) + value_offset (toval), read_memory (value_address (toval), buffer, changed_len);
buffer, changed_len);
modify_field (buffer, value_as_long (fromval), modify_field (buffer, value_as_long (fromval),
value_bitpos (toval), value_bitsize (toval)); value_bitpos (toval), value_bitsize (toval));
changed_addr = VALUE_ADDRESS (toval) + value_offset (toval); changed_addr = value_address (toval);
dest_buffer = buffer; dest_buffer = buffer;
} }
else else
{ {
changed_addr = VALUE_ADDRESS (toval) + value_offset (toval); changed_addr = value_address (toval);
changed_len = TYPE_LENGTH (type); changed_len = TYPE_LENGTH (type);
dest_buffer = value_contents (fromval); 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); 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), value_contents_all_raw (val),
TYPE_LENGTH (value_enclosing_type (val))); TYPE_LENGTH (value_enclosing_type (val)));
VALUE_LVAL (val) = lval_memory; VALUE_LVAL (val) = lval_memory;
VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + value_offset (arg1); set_value_address (val, value_address (arg1));
return val; return val;
} }
@ -1039,7 +1035,7 @@ address_of_variable (struct symbol *var, struct block *b)
if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) if ((VALUE_LVAL (val) == lval_memory && value_lazy (val))
|| TYPE_CODE (type) == TYPE_CODE_FUNC) || 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); 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.")); error (_("Attempt to take address of value not located in memory."));
return value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)), 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 /* 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.")); error (_("Attempt to take address of value not located in memory."));
retval = value_from_pointer (lookup_pointer_type (value_type (arg1)), retval = value_from_pointer (lookup_pointer_type (value_type (arg1)),
(VALUE_ADDRESS (arg1) + value_offset (arg1))); value_address (arg1));
return retval; return retval;
} }
@ -1205,8 +1201,7 @@ value_addr (struct value *arg1)
/* Get target memory address */ /* Get target memory address */
arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)), arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
(VALUE_ADDRESS (arg1) (value_address (arg1)
+ value_offset (arg1)
+ value_embedded_offset (arg1))); + value_embedded_offset (arg1)));
/* This may be a pointer to a base subobject; so remember the /* 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, boffset = baseclass_offset (type, i,
value_contents (arg1) + offset, value_contents (arg1) + offset,
VALUE_ADDRESS (arg1) value_address (arg1) + offset);
+ value_offset (arg1) + offset);
if (boffset == -1) if (boffset == -1)
error (_("virtual baseclass botch")); error (_("virtual baseclass botch"));
@ -1633,14 +1627,13 @@ search_struct_field (char *name, struct value *arg1, int offset,
CORE_ADDR base_addr; CORE_ADDR base_addr;
v2 = allocate_value (basetype); v2 = allocate_value (basetype);
base_addr = base_addr = value_address (arg1) + boffset;
VALUE_ADDRESS (arg1) + value_offset (arg1) + boffset;
if (target_read_memory (base_addr, if (target_read_memory (base_addr,
value_contents_raw (v2), value_contents_raw (v2),
TYPE_LENGTH (basetype)) != 0) TYPE_LENGTH (basetype)) != 0)
error (_("virtual baseclass botch")); error (_("virtual baseclass botch"));
VALUE_LVAL (v2) = lval_memory; VALUE_LVAL (v2) = lval_memory;
VALUE_ADDRESS (v2) = base_addr; set_value_address (v2, base_addr);
} }
else else
{ {
@ -1763,8 +1756,7 @@ search_struct_method (char *name, struct value **arg1p,
if (offset < 0 || offset >= TYPE_LENGTH (type)) if (offset < 0 || offset >= TYPE_LENGTH (type))
{ {
gdb_byte *tmp = alloca (TYPE_LENGTH (baseclass)); gdb_byte *tmp = alloca (TYPE_LENGTH (baseclass));
if (target_read_memory (VALUE_ADDRESS (*arg1p) if (target_read_memory (value_address (*arg1p) + offset,
+ value_offset (*arg1p) + offset,
tmp, TYPE_LENGTH (baseclass)) != 0) tmp, TYPE_LENGTH (baseclass)) != 0)
error (_("virtual baseclass botch")); error (_("virtual baseclass botch"));
base_valaddr = tmp; base_valaddr = tmp;
@ -1773,8 +1765,7 @@ search_struct_method (char *name, struct value **arg1p,
base_valaddr = value_contents (*arg1p) + offset; base_valaddr = value_contents (*arg1p) + offset;
base_offset = baseclass_offset (type, i, base_valaddr, base_offset = baseclass_offset (type, i, base_valaddr,
VALUE_ADDRESS (*arg1p) value_address (*arg1p) + offset);
+ value_offset (*arg1p) + offset);
if (base_offset == -1) if (base_offset == -1)
error (_("virtual baseclass botch")); error (_("virtual baseclass botch"));
} }
@ -1983,7 +1974,7 @@ find_method_list (struct value **argp, char *method,
base_offset = value_offset (*argp) + offset; base_offset = value_offset (*argp) + offset;
base_offset = baseclass_offset (type, i, base_offset = baseclass_offset (type, i,
value_contents (*argp) + base_offset, value_contents (*argp) + base_offset,
VALUE_ADDRESS (*argp) + base_offset); value_address (*argp) + base_offset);
if (base_offset == -1) if (base_offset == -1)
error (_("virtual baseclass botch")); 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))); result = allocate_value (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
cplus_make_method_ptr (value_type (result), cplus_make_method_ptr (value_type (result),
value_contents_writeable (result), value_contents_writeable (result),
VALUE_ADDRESS (v), 0); value_address (v), 0);
} }
} }
return result; return result;
@ -2902,7 +2893,7 @@ value_full_object (struct value *argp,
/* Go back by the computed top_offset from the beginning of the /* Go back by the computed top_offset from the beginning of the
object, adjusting for the embedded offset of argp if that's what object, adjusting for the embedded offset of argp if that's what
value_rtti_type used for its computation. */ 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))); (using_enc ? 0 : value_embedded_offset (argp)));
deprecated_set_value_type (new_val, value_type (argp)); deprecated_set_value_type (new_val, value_type (argp));
set_value_embedded_offset (new_val, (using_enc set_value_embedded_offset (new_val, (using_enc

View File

@ -315,7 +315,7 @@ common_val_print (struct value *val, struct ui_file *stream, int recurse,
return 0; return 0;
return val_print (value_type (val), value_contents_all (val), 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); stream, recurse, options, language);
} }

View File

@ -249,7 +249,7 @@ allocate_value_lazy (struct type *type)
val->type = type; val->type = type;
val->enclosing_type = type; val->enclosing_type = type;
VALUE_LVAL (val) = not_lval; VALUE_LVAL (val) = not_lval;
VALUE_ADDRESS (val) = 0; val->location.address = 0;
VALUE_FRAME_ID (val) = null_frame_id; VALUE_FRAME_ID (val) = null_frame_id;
val->offset = 0; val->offset = 0;
val->bitpos = 0; val->bitpos = 0;
@ -525,10 +525,30 @@ deprecated_value_lval_hack (struct value *value)
return &value->lval; return &value->lval;
} }
CORE_ADDR * CORE_ADDR
deprecated_value_address_hack (struct value *value) value_address (struct value *value)
{ {
return &value->location.address; 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)
{
gdb_assert (value->lval != lval_internalvar
&& value->lval != lval_internalvar_component);
value->location.address = addr;
} }
struct internalvar ** 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' Upon entry to this function, if VAL is a value of type `function'
(that is, TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC), then (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 you'll get if you evaluate an expression like `main'. The call
to COERCE_ARRAY below actually does all the usual unary to COERCE_ARRAY below actually does all the usual unary
conversions, which includes converting values of type `function' conversions, which includes converting values of type `function'
@ -1312,7 +1332,7 @@ value_as_address (struct value *val)
function, just return its address directly. */ function, just return its address directly. */
if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
|| TYPE_CODE (value_type (val)) == TYPE_CODE_METHOD) || TYPE_CODE (value_type (val)) == TYPE_CODE_METHOD)
return VALUE_ADDRESS (val); return value_address (val);
val = coerce_array (val); val = coerce_array (val);
@ -1543,7 +1563,7 @@ value_static_field (struct type *type, int fieldno)
} }
if (retval && VALUE_LVAL (retval) == lval_memory) if (retval && VALUE_LVAL (retval) == lval_memory)
SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno), SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
VALUE_ADDRESS (retval)); value_address (retval));
} }
return 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); v = allocate_value (ftype);
if (sym) if (sym)
{ {
VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); set_value_address (v, BLOCK_START (SYMBOL_BLOCK_VALUE (sym)));
} }
else 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 objfile *objfile = msymbol_objfile (msym);
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
VALUE_ADDRESS (v) set_value_address (v,
= gdbarch_convert_from_func_ptr_addr gdbarch_convert_from_func_ptr_addr
(gdbarch, SYMBOL_VALUE_ADDRESS (msym), &current_target); (gdbarch, SYMBOL_VALUE_ADDRESS (msym), &current_target));
} }
if (arg1p) if (arg1p)
@ -1912,7 +1932,7 @@ value_from_contents_and_address (struct type *type,
set_value_lazy (v, 1); set_value_lazy (v, 1);
else else
memcpy (value_contents_raw (v), valaddr, TYPE_LENGTH (type)); memcpy (value_contents_raw (v), valaddr, TYPE_LENGTH (type));
VALUE_ADDRESS (v) = address; set_value_address (v, address);
VALUE_LVAL (v) = lval_memory; VALUE_LVAL (v) = lval_memory;
return v; return v;
} }

View File

@ -272,11 +272,18 @@ extern void set_value_component_location (struct value *component,
extern enum lval_type *deprecated_value_lval_hack (struct value *); extern enum lval_type *deprecated_value_lval_hack (struct value *);
#define VALUE_LVAL(val) (*deprecated_value_lval_hack (val)) #define VALUE_LVAL(val) (*deprecated_value_lval_hack (val))
/* If lval == lval_memory, this is the address in the inferior. If /* If lval == lval_memory, return the address in the inferior. If
lval == lval_register, this is the byte offset into the registers lval == lval_register, return the byte offset into the registers
structure. */ structure. Otherwise, return 0. The returned address
extern CORE_ADDR *deprecated_value_address_hack (struct value *); includes the offset, if any. */
#define VALUE_ADDRESS(val) (*deprecated_value_address_hack (val)) 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. */ /* Pointer to internal variable. */
extern struct internalvar **deprecated_value_internalvar_hack (struct value *); extern struct internalvar **deprecated_value_internalvar_hack (struct value *);