+2001-10-15 Andrew Cagney <ac131313@redhat.com>
+
+ * value.h (value_as_address): Rename value_as_pointer.
+ * eval.c, findvar.c, gnu-v2-abi.c, gnu-v3-abi.c, jv-lang.c,
+ jv-valprint.c, printcmd.c, stack.c, top.c, valarith.c, valops.c,
+ values.c: Update.
+
202001-10-15 Jim Ingham <jingham@inghji.apple.com>
* valarith.c (value_sub): Don't pass a raw type to
2001-10-15 Andrew Cagney <ac131313@redhat.com>
+ * gdbint.texinfo (Target Architecture Definition): Function
+ value_as_pointer renamed to value_as_address.
+
+2001-10-15 Andrew Cagney <ac131313@redhat.com>
+
* gdbint.texinfo (Target Architecture Definition): Default
POINTER_TO_ADDRESS functions assume unsigned addresses.
(INTEGER_TO_ADDRESS): Document. Derive pragmatics section from a
will signal an internal error.
@end deftypefun
-@deftypefun CORE_ADDR value_as_pointer (value_ptr @var{val})
+@deftypefun CORE_ADDR value_as_address (value_ptr @var{val})
Assuming that @var{val} is a pointer, return the address it represents,
as appropriate for the current architecture.
register struct cleanup *old_chain =
make_cleanup (free_current_contents, &expr);
- addr = value_as_pointer (evaluate_expression (expr));
+ addr = value_as_address (evaluate_expression (expr));
do_cleanups (old_chain);
return addr;
}
register struct cleanup *old_chain =
make_cleanup (free_current_contents, &expr);
- addr = value_as_pointer (evaluate_expression (expr));
+ addr = value_as_address (evaluate_expression (expr));
do_cleanups (old_chain);
return addr;
}
return value_zero (exp->elts[pc + 1].type, lval_memory);
else
return value_at_lazy (exp->elts[pc + 1].type,
- value_as_pointer (arg1),
+ value_as_address (arg1),
NULL);
case UNOP_PREINCREMENT:
locaddr = SYMBOL_VALUE_ADDRESS (var);
loc = value_at (lookup_pointer_type (type), locaddr, NULL);
- addr = value_as_pointer (loc);
+ addr = value_as_address (loc);
}
case LOC_ARG:
return 0;
argref += SYMBOL_VALUE (var);
ref = value_at (lookup_pointer_type (type), argref, NULL);
- addr = value_as_pointer (ref);
+ addr = value_as_address (ref);
break;
}
SYMBOL_BASEREG (var), frame);
if (regval == NULL)
error ("Value of base register not available.");
- addr = value_as_pointer (regval);
+ addr = value_as_address (regval);
addr += SYMBOL_VALUE (var);
break;
}
if (regval == NULL)
error ("Value of register variable not available.");
- addr = value_as_pointer (regval);
+ addr = value_as_address (regval);
VALUE_LVAL (v) = lval_memory;
}
else
TYPE_VPTR_FIELDNO (known_type));
tempval=value_field (v, TYPE_VPTR_FIELDNO(known_type));
VALUE_ADDRESS(tempval) += bitpos / 8;
- vtbl=value_as_pointer (tempval);
+ vtbl=value_as_address (tempval);
using_enclosing=1;
}
else
{
- vtbl=value_as_pointer(value_field(v,TYPE_VPTR_FIELDNO(known_type)));
+ vtbl=value_as_address(value_field(v,TYPE_VPTR_FIELDNO(known_type)));
using_enclosing=0;
}
/* Fetch VALUE's virtual table pointer, and tweak it to point at
an instance of our imaginary gdb_gnu_v3_abi_vtable structure. */
vtable_address
- = value_as_pointer (value_field (value, TYPE_VPTR_FIELDNO (value_type)));
+ = value_as_address (value_field (value, TYPE_VPTR_FIELDNO (value_type)));
vtable = value_at_lazy (vtable_type,
vtable_address - vtable_address_point_offset (),
VALUE_BFD_SECTION (value));
/* Now value is an object of the appropriate base type. Fetch its
virtual table. */
vtable_address
- = value_as_pointer (value_field (value, TYPE_VPTR_FIELDNO (vfn_base)));
+ = value_as_address (value_field (value, TYPE_VPTR_FIELDNO (vfn_base)));
vtable = value_at_lazy (vtable_type,
vtable_address - vtable_address_point_offset (),
VALUE_BFD_SECTION (value));
if (TYPE_CODE (VALUE_TYPE (obj_val)) == TYPE_CODE_PTR
&& TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (obj_val))) == 0)
obj_val = value_at (get_java_object_type (),
- value_as_pointer (obj_val), NULL);
+ value_as_address (obj_val), NULL);
vtable_val = value_struct_elt (&obj_val, NULL, "vtable", NULL, "structure");
return value_struct_elt (&vtable_val, NULL, "class", NULL, "structure");
java_class_is_primitive (value_ptr clas)
{
value_ptr vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
- CORE_ADDR i = value_as_pointer (vtable);
+ CORE_ADDR i = value_as_address (vtable);
return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
}
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (el_type, VALUE_LVAL (arg1));
- address = value_as_pointer (arg1);
+ address = value_as_address (arg1);
address += JAVA_OBJECT_SIZE;
read_memory (address, buf4, 4);
length = (long) extract_signed_integer (buf4, 4);
&& strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "java.lang.String") == 0
&& (format == 0 || format == 's')
&& address != 0
- && value_as_pointer (val) != 0)
+ && value_as_address (val) != 0)
{
value_ptr data_val;
CORE_ADDR data;
mark = value_mark (); /* Remember start of new values */
data_val = value_struct_elt (&val, NULL, "data", NULL, NULL);
- data = value_as_pointer (data_val);
+ data = value_as_address (data_val);
boffset_val = value_struct_elt (&val, NULL, "boffset", NULL, NULL);
- boffset = value_as_pointer (boffset_val);
+ boffset = value_as_address (boffset_val);
count_val = value_struct_elt (&val, NULL, "count", NULL, NULL);
- count = value_as_pointer (count_val);
+ count = value_as_address (count_val);
value_free_to_mark (mark); /* Release unnecessary values */
&& VALUE_LVAL (val) == lval_memory)
next_address = VALUE_ADDRESS (val);
else
- next_address = value_as_pointer (val);
+ next_address = value_as_address (val);
if (VALUE_BFD_SECTION (val))
next_section = VALUE_BFD_SECTION (val);
do_cleanups (old_chain);
printf_filtered (" ");
val = evaluate_expression (d->exp);
- addr = value_as_pointer (val);
+ addr = value_as_address (val);
if (d->format.format == 'i')
addr = ADDR_BITS_REMOVE (addr);
char *str;
CORE_ADDR tem;
int j;
- tem = value_as_pointer (val_args[i]);
+ tem = value_as_address (val_args[i]);
/* This is a %s argument. Find the length of the string. */
for (j = 0;; j++)
tmp_cleanup = make_cleanup (xfree, addr_string);
/* NOTE: we call parse_and_eval and then both
- value_as_long and value_as_pointer rather than calling
+ value_as_long and value_as_address rather than calling
parse_and_eval_long and parse_and_eval_address because
of the issue of potential side effects from evaluating
the expression. */
if (numargs == 0)
level = value_as_long (vp);
- args[numargs++] = value_as_pointer (vp);
+ args[numargs++] = value_as_address (vp);
do_cleanups (tmp_cleanup);
}
break;
case TYPE_CODE_PTR:
elt_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
- addrval = value_as_pointer (arg_val);
+ addrval = value_as_address (arg_val);
if (TYPE_LENGTH (elt_type) == 1 &&
TYPE_CODE (elt_type) == TYPE_CODE_INT &&
if (len == 0)
len = 1; /* For (void *) */
retval = value_from_pointer (valptrtype,
- value_as_pointer (valptr)
+ value_as_address (valptr)
+ (len * value_as_long (valint)));
VALUE_BFD_SECTION (retval) = VALUE_BFD_SECTION (valptr);
return retval;
/* pointer - integer. */
LONGEST sz = TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1)));
return value_from_pointer (type1,
- (value_as_pointer (arg1)
+ (value_as_address (arg1)
- (sz * value_as_long (arg2))));
}
else if (TYPE_CODE (type2) == TYPE_CODE_PTR
/* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
is bigger. */
else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
- return value_as_pointer (arg1) == (CORE_ADDR) value_as_long (arg2);
+ return value_as_address (arg1) == (CORE_ADDR) value_as_long (arg2);
else if (code2 == TYPE_CODE_PTR && (code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL))
- return (CORE_ADDR) value_as_long (arg1) == value_as_pointer (arg2);
+ return (CORE_ADDR) value_as_long (arg1) == value_as_address (arg2);
else if (code1 == code2
&& ((len = (int) TYPE_LENGTH (type1))
&& (code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
return value_as_double (arg1) < value_as_double (arg2);
else if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
- return value_as_pointer (arg1) < value_as_pointer (arg2);
+ return value_as_address (arg1) < value_as_address (arg2);
/* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
is bigger. */
else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
- return value_as_pointer (arg1) < (CORE_ADDR) value_as_long (arg2);
+ return value_as_address (arg1) < (CORE_ADDR) value_as_long (arg2);
else if (code2 == TYPE_CODE_PTR && (code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL))
- return (CORE_ADDR) value_as_long (arg1) < value_as_pointer (arg2);
+ return (CORE_ADDR) value_as_long (arg1) < value_as_address (arg2);
else if (code1 == TYPE_CODE_STRING && code2 == TYPE_CODE_STRING)
return value_strcmp (arg1, arg2) < 0;
else
enc_type = TYPE_TARGET_TYPE (enc_type);
/* Retrieve the enclosing object pointed to */
arg2 = value_at_lazy (enc_type,
- value_as_pointer (arg1) - VALUE_POINTED_TO_OFFSET (arg1),
+ value_as_address (arg1) - VALUE_POINTED_TO_OFFSET (arg1),
VALUE_BFD_SECTION (arg1));
/* Re-adjust type */
VALUE_TYPE (arg2) = TYPE_TARGET_TYPE (base_type);
}
else if (code == TYPE_CODE_PTR)
{
- funaddr = value_as_pointer (function);
+ funaddr = value_as_address (function);
ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
/* Handle the case of functions lacking debugging info.
Their values are characters since their addresses are char */
if (TYPE_LENGTH (ftype) == 1)
- funaddr = value_as_pointer (value_addr (function));
+ funaddr = value_as_address (value_addr (function));
else
/* Handle integer used as address of a function. */
funaddr = (CORE_ADDR) value_as_long (function);
extern DOUBLEST value_as_double (value_ptr val);
-extern CORE_ADDR value_as_pointer (value_ptr val);
+extern CORE_ADDR value_as_address (value_ptr val);
extern LONGEST unpack_long (struct type *type, char *valaddr);
Note that val's type may not actually be a pointer; value_as_long
handles all the cases. */
CORE_ADDR
-value_as_pointer (value_ptr val)
+value_as_address (value_ptr val)
{
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */
host byte order.
If you want functions and arrays to be coerced to pointers, and
- references to be dereferenced, call value_as_pointer() instead.
+ references to be dereferenced, call value_as_address() instead.
C++: It is assumed that the front-end has taken care of
all matters concerning pointers to members. A pointer
/* Turn vtable into typeinfo function */
VALUE_OFFSET(vtbl)+=4;
- msymbol = lookup_minimal_symbol_by_pc ( value_as_pointer(value_ind(vtbl)) );
+ msymbol = lookup_minimal_symbol_by_pc ( value_as_address(value_ind(vtbl)) );
if (msymbol == NULL
|| (demangled_name = SYMBOL_NAME (msymbol)) == NULL)
{