From 4478b372e973afcd2253fe4c1ec3f2d083ac3943 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Fri, 14 Apr 2000 18:43:41 +0000 Subject: * gdbarch.sh (POINTER_TO_ADDRESS, ADDRESS_TO_POINTER): Two new functions which architectures can redefine, defaulting to generic_pointer_to_address and generic_address_to_pointer. * findvar.c (extract_typed_address, store_typed_address, generic_pointer_to_address, generic_address_to_pointer): New functions. (POINTER_TO_ADDRESS, ADDRESS_TO_POINTER): Provide default definitions. (extract_address, store_address): Doc fixes. * values.c (value_as_pointer): Doc fix. (value_from_pointer): New function. * defs.h (extract_typed_address, store_typed_address): New declarations. * inferior.h (generic_address_to_pointer, generic_pointer_to_address): New declarations. * value.h (value_from_pointer): New declaration. * ax-gdb.c (const_var_ref): Use value_from_pointer, not value_from_longest. * blockframe.c (generic_push_dummy_frame): Use read_pc and read_sp, not read_register. * c-valprint.c (c_val_print): Use extract_typed_address instead of extract_address to extract vtable entries and references. * cp-valprint.c (cp_print_value_fields): Use value_from_pointer instead of value_from_longest to extract the vtable's address. * eval.c (evaluate_subexp_standard): Use value_from_pointer instead of value_from_longest to compute `this', and for doing pointer-to-member dereferencing. * findvar.c (read_register): Use extract_unsigned_integer, not extract_address. (read_var_value): Use store_typed_address instead of store_address for building label values. (locate_var_value): Use value_from_pointer instead of value_from_longest. * hppa-tdep.c (find_stub_with_shl_get): Use value_from_pointer, instead of value_from_longest, to build arguments to __d_shl_get. * printcmd.c (set_next_address): Use value_from_pointer, not value_from_longest. (x_command): Use value_from_pointer, not value_from_longest. * tracepoint.c (set_traceframe_context): Use value_from_pointer, not value_from_longest. * valarith.c (value_add, value_sub): Use value_from_pointer, not value_from_longest. * valops.c (find_function_in_inferior, value_coerce_array, value_coerce_function, value_addr, hand_function_call): Same. * value.h (COERCE_REF): Use unpack_pointer, not unpack_long. * values.c (unpack_long): Use extract_typed_address to produce addresses from pointers and references, not extract_address. (value_from_longest): Use store_typed_address instead of store_address to produce pointer and reference values. --- gdb/valops.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'gdb/valops.c') diff --git a/gdb/valops.c b/gdb/valops.c index a99ad1c..e734877 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -108,12 +108,12 @@ find_function_in_inferior (name) if (msymbol != NULL) { struct type *type; - LONGEST maddr; + CORE_ADDR maddr; type = lookup_pointer_type (builtin_type_char); type = lookup_function_type (type); type = lookup_pointer_type (type); - maddr = (LONGEST) SYMBOL_VALUE_ADDRESS (msymbol); - return value_from_longest (type, maddr); + maddr = SYMBOL_VALUE_ADDRESS (msymbol); + return value_from_pointer (type, maddr); } else { @@ -901,8 +901,8 @@ value_coerce_array (arg1) if (VALUE_LVAL (arg1) != lval_memory) error ("Attempt to take address of value not located in memory."); - return value_from_longest (lookup_pointer_type (TYPE_TARGET_TYPE (type)), - (LONGEST) (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1))); + return value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)), + (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1))); } /* Given a value which is a function, return a value which is a pointer @@ -917,8 +917,8 @@ value_coerce_function (arg1) if (VALUE_LVAL (arg1) != lval_memory) error ("Attempt to take address of value not located in memory."); - retval = value_from_longest (lookup_pointer_type (VALUE_TYPE (arg1)), - (LONGEST) (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1))); + retval = value_from_pointer (lookup_pointer_type (VALUE_TYPE (arg1)), + (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1))); VALUE_BFD_SECTION (retval) = VALUE_BFD_SECTION (arg1); return retval; } @@ -948,10 +948,10 @@ value_addr (arg1) error ("Attempt to take address of value not located in memory."); /* Get target memory address */ - arg2 = value_from_longest (lookup_pointer_type (VALUE_TYPE (arg1)), - (LONGEST) (VALUE_ADDRESS (arg1) - + VALUE_OFFSET (arg1) - + VALUE_EMBEDDED_OFFSET (arg1))); + arg2 = value_from_pointer (lookup_pointer_type (VALUE_TYPE (arg1)), + (VALUE_ADDRESS (arg1) + + VALUE_OFFSET (arg1) + + VALUE_EMBEDDED_OFFSET (arg1))); /* This may be a pointer to a base subobject; so remember the full derived object's type ... */ @@ -1582,8 +1582,8 @@ You must use a pointer to function type variable. Command ignored.", arg_name); we just pushed. */ /*args[i] = value_from_longest (lookup_pointer_type (value_type), (LONGEST) addr); */ - args[i] = value_from_longest (lookup_pointer_type (arg_type), - (LONGEST) addr); + args[i] = value_from_pointer (lookup_pointer_type (arg_type), + addr); } } } -- cgit v1.1