From 1aa20aa88f25187a6947acc8d8ccaeb97daaa4d0 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 16 Oct 2001 01:58:07 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 7 +++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdbint.texinfo | 2 +- gdb/eval.c | 6 +++--- gdb/findvar.c | 8 ++++---- gdb/gnu-v2-abi.c | 4 ++-- gdb/gnu-v3-abi.c | 4 ++-- gdb/jv-lang.c | 6 +++--- gdb/jv-valprint.c | 8 ++++---- gdb/printcmd.c | 6 +++--- gdb/stack.c | 4 ++-- gdb/top.c | 2 +- gdb/valarith.c | 14 +++++++------- gdb/valops.c | 6 +++--- gdb/value.h | 2 +- gdb/values.c | 6 +++--- 16 files changed, 51 insertions(+), 39 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9eff17cf17..643a2a403e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2001-10-15 Andrew Cagney + + * 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 * valarith.c (value_sub): Don't pass a raw type to diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 9466bd210b..86ea9664fa 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2001-10-15 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Function + value_as_pointer renamed to value_as_address. + 2001-10-15 Andrew Cagney * gdbint.texinfo (Target Architecture Definition): Default diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 3c867fef76..46b9e95bb1 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -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. diff --git a/gdb/eval.c b/gdb/eval.c index fad995ee35..5638d2c15d 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -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: diff --git a/gdb/findvar.c b/gdb/findvar.c index 04456207c7..43e4b60a79 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -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 diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index 8c46219971..3b7715230f 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -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; } diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index d9da17c8b9..bffdca56b9 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -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)); diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index abd0470b7d..a0d78d7d07 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -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); diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c index 9ba953ee66..ad059bec26 100644 --- a/gdb/jv-valprint.c +++ b/gdb/jv-valprint.c @@ -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 */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index c601d88a74..c798767c85 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -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++) diff --git a/gdb/stack.c b/gdb/stack.c index f2536aa319..4c7e5fa38f 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -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); } diff --git a/gdb/top.c b/gdb/top.c index d57f0b5731..7cdc4bdf0b 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -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 && diff --git a/gdb/valarith.c b/gdb/valarith.c index a9ba5c76e0..0696b322a4 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -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 diff --git a/gdb/valops.c b/gdb/valops.c index e1a4bc53d0..22c6948b0e 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -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); diff --git a/gdb/value.h b/gdb/value.h index 5db5f1156e..041933117a 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -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); diff --git a/gdb/values.c b/gdb/values.c index bf032af358..eedeaf9605 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -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) { -- 2.34.1