+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>
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);
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. */
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),
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
{
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);
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);
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;
/* 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)
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
{
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;
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));
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);
}
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));
}
}
/* 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';
}
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;
}
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
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 =
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)
|| (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))
/* 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 */
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" */
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);
}
if (VALUE_LVAL (val))
{
- vaddr = VALUE_ADDRESS (val);
+ vaddr = value_address (val);
}
else
{
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
CORE_ADDR *first_dont_print;
+ CORE_ADDR addr;
int i;
first_dont_print
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>",
}
}
- 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;
}
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);
}
if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory)
{
- address = VALUE_ADDRESS (val);
+ address = value_address (val);
}
else
{
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);
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
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 */
}
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);
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:
break;
}
- VALUE_ADDRESS (v) = addr;
+ set_value_address (v, addr);
set_value_lazy (v, 1);
return v;
}
*optimizedp = value_optimized_out (value);
*lvalp = VALUE_LVAL (value);
- *addrp = VALUE_ADDRESS (value);
+ *addrp = value_address (value);
*realnump = VALUE_REGNUM (value);
if (bufferp)
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");
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;
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));
/* 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;
/* 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)
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);
return NULL;
clas = value_ind (clas);
}
- addr = VALUE_ADDRESS (clas) + value_offset (clas);
+ addr = value_address (clas);
#if 0
get_java_class_symtab ();
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);
}
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;
}
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);
}
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))
{
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)
{
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;
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);
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;
/* 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
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
- CORE_ADDR *first_dont_print;
+ CORE_ADDR *first_dont_print, addr;
int i;
first_dont_print
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);
}
}
- 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;
}
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)
{
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;
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;
}
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);
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;
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;
}
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);
}
}
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);
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;
}
val = allocate_value_lazy (type);
VALUE_LVAL (val) = lval_memory;
- VALUE_ADDRESS (val) = addr;
+ set_value_address (val, addr);
return 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)
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");
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);
}
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;
}
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);
}
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
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;
}
/* 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
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"));
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
{
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;
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"));
}
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"));
}
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;
/* 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
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);
}
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;
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 **
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'
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);
}
if (retval && VALUE_LVAL (retval) == lval_memory)
SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
- VALUE_ADDRESS (retval));
+ value_address (retval));
}
return retval;
}
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
{
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), ¤t_target);
+ set_value_address (v,
+ gdbarch_convert_from_func_ptr_addr
+ (gdbarch, SYMBOL_VALUE_ADDRESS (msym), ¤t_target));
}
if (arg1p)
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;
}
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 *);