* 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.
This commit is contained in:
Andrew Cagney 2001-10-16 01:58:07 +00:00
parent dbbd9c57ff
commit 1aa20aa88f
16 changed files with 51 additions and 39 deletions

View File

@ -1,3 +1,10 @@
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

View File

@ -1,3 +1,8 @@
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

View File

@ -2441,7 +2441,7 @@ If @var{type} is not a pointer or reference type, then this function
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.

View File

@ -80,7 +80,7 @@ parse_and_eval_address (char *exp)
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;
}
@ -96,7 +96,7 @@ parse_and_eval_address_1 (char **expptr)
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;
}
@ -1676,7 +1676,7 @@ evaluate_subexp_standard (struct type *expect_type,
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:

View File

@ -484,7 +484,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
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:
@ -507,7 +507,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
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;
}
@ -529,7 +529,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
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;
}
@ -567,7 +567,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
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

View File

@ -251,12 +251,12 @@ gnuv2_value_rtti_type (value_ptr v, int *full, int *top, int *using_enc)
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;
}

View File

@ -209,7 +209,7 @@ gnuv3_rtti_type (struct value *value,
/* 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));
@ -311,7 +311,7 @@ gnuv3_virtual_fn_field (struct value **value_p,
/* 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));

View File

@ -232,7 +232,7 @@ java_class_from_object (value_ptr obj_val)
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");
@ -243,7 +243,7 @@ static int
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;
}
@ -911,7 +911,7 @@ evaluate_subexp_java (struct type *expect_type, register struct expression *exp,
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);

View File

@ -202,7 +202,7 @@ java_value_print (value_ptr val, struct ui_file *stream, int format,
&& 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;
@ -215,13 +215,13 @@ java_value_print (value_ptr val, struct ui_file *stream, int format,
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 */

View File

@ -1348,7 +1348,7 @@ x_command (char *exp, int from_tty)
&& 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);
@ -1586,7 +1586,7 @@ do_one_display (struct display *d)
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);
@ -2244,7 +2244,7 @@ printf_command (char *arg, int from_tty)
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++)

View File

@ -701,7 +701,7 @@ parse_frame_specification (char *frame_exp)
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. */
@ -709,7 +709,7 @@ parse_frame_specification (char *frame_exp)
if (numargs == 0)
level = value_as_long (vp);
args[numargs++] = value_as_pointer (vp);
args[numargs++] = value_as_address (vp);
do_cleanups (tmp_cleanup);
}

View File

@ -1436,7 +1436,7 @@ get_prompt_1 (void *data)
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 &&

View File

@ -80,7 +80,7 @@ value_add (value_ptr arg1, value_ptr arg2)
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;
@ -105,7 +105,7 @@ value_sub (value_ptr arg1, value_ptr arg2)
/* 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
@ -1199,9 +1199,9 @@ value_equal (register value_ptr arg1, register value_ptr 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 == code2
&& ((len = (int) TYPE_LENGTH (type1))
@ -1253,14 +1253,14 @@ value_less (register value_ptr arg1, register value_ptr arg2)
&& (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

View File

@ -970,7 +970,7 @@ value_ind (value_ptr arg1)
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);
@ -1221,7 +1221,7 @@ find_function_addr (value_ptr function, struct type **retval_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)
@ -1237,7 +1237,7 @@ find_function_addr (value_ptr function, struct type **retval_type)
/* 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);

View File

@ -289,7 +289,7 @@ extern LONGEST value_as_long (value_ptr val);
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);

View File

@ -561,7 +561,7 @@ value_as_double (register value_ptr val)
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. */
@ -723,7 +723,7 @@ unpack_double (struct type *type, char *valaddr, int *invp)
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
@ -993,7 +993,7 @@ value_headof (value_ptr in_arg, struct type *btype, struct type *dtype)
/* 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)
{