diff options
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/ada-lang.c | 302 | ||||
-rw-r--r-- | gdb/ada-valprint.c | 8 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 2 | ||||
-rw-r--r-- | gdb/ax-gdb.c | 2 | ||||
-rw-r--r-- | gdb/breakpoint.c | 26 | ||||
-rw-r--r-- | gdb/c-valprint.c | 12 | ||||
-rw-r--r-- | gdb/cli/cli-dump.c | 4 | ||||
-rw-r--r-- | gdb/cp-valprint.c | 6 | ||||
-rw-r--r-- | gdb/eval.c | 124 | ||||
-rw-r--r-- | gdb/f-valprint.c | 2 | ||||
-rw-r--r-- | gdb/findvar.c | 6 | ||||
-rw-r--r-- | gdb/gnu-v2-abi.c | 16 | ||||
-rw-r--r-- | gdb/gnu-v3-abi.c | 26 | ||||
-rw-r--r-- | gdb/hpacc-abi.c | 8 | ||||
-rw-r--r-- | gdb/infcall.c | 38 | ||||
-rw-r--r-- | gdb/jv-lang.c | 30 | ||||
-rw-r--r-- | gdb/jv-valprint.c | 16 | ||||
-rw-r--r-- | gdb/linespec.c | 4 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 2 | ||||
-rw-r--r-- | gdb/objc-lang.c | 2 | ||||
-rw-r--r-- | gdb/p-valprint.c | 8 | ||||
-rw-r--r-- | gdb/ppc-sysv-tdep.c | 4 | ||||
-rw-r--r-- | gdb/printcmd.c | 24 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 6 | ||||
-rw-r--r-- | gdb/scm-exp.c | 4 | ||||
-rw-r--r-- | gdb/scm-valprint.c | 2 | ||||
-rw-r--r-- | gdb/stack.c | 6 | ||||
-rw-r--r-- | gdb/std-regs.c | 6 | ||||
-rw-r--r-- | gdb/tracepoint.c | 6 | ||||
-rw-r--r-- | gdb/typeprint.c | 4 | ||||
-rw-r--r-- | gdb/valarith.c | 76 | ||||
-rw-r--r-- | gdb/valops.c | 142 | ||||
-rw-r--r-- | gdb/value.c | 102 | ||||
-rw-r--r-- | gdb/value.h | 11 | ||||
-rw-r--r-- | gdb/varobj.c | 12 |
36 files changed, 555 insertions, 511 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 65adbf9..b089bca 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,22 @@ 2004-11-12 Andrew Cagney <cagney@gnu.org> + * value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE) + (VALUE_BITPOS): Delete. + (value_type, value_offset, value_bitsize, value_bitpos): Declare. + * value.c (value_type, value_offset, value_bitpos) + (value_bitsize): New functions. Update references. + * arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update. + * f-valprint.c, cp-valprint.c, c-valprint.c: Update. + * ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update. + * p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update. + * objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update. + * infcall.c, linespec.c, printcmd.c, valarith.c: Update. + * valops.c, eval.c, findvar.c, breakpoint.c: Update. + * tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c: + * rs6000-tdep.c, ppc-sysv-tdep.c: Update. + +2004-11-12 Andrew Cagney <cagney@gnu.org> + * cris-tdep.c (cris_register_offset): Delete, never called. (cris_spec_reg_applicable): Delete cris_ver_sim. * MAINTAINERS: List d10v as OBSOLETE. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index d72f16c..f65e52b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -432,7 +432,7 @@ static struct value * coerce_unspec_val_to_type (struct value *val, struct type *type) { type = ada_check_typedef (type); - if (VALUE_TYPE (val) == type) + if (value_type (val) == type) return val; else { @@ -444,11 +444,11 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) result = allocate_value (type); VALUE_LVAL (result) = VALUE_LVAL (val); - VALUE_BITSIZE (result) = VALUE_BITSIZE (val); - VALUE_BITPOS (result) = VALUE_BITPOS (val); - VALUE_ADDRESS (result) = VALUE_ADDRESS (val) + VALUE_OFFSET (val); + result->bitsize = value_bitsize (val); + result->bitpos = value_bitpos (val); + VALUE_ADDRESS (result) = VALUE_ADDRESS (val) + value_offset (val); if (VALUE_LAZY (val) - || TYPE_LENGTH (type) > TYPE_LENGTH (VALUE_TYPE (val))) + || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) VALUE_LAZY (result) = 1; else memcpy (VALUE_CONTENTS_RAW (result), VALUE_CONTENTS (val), @@ -1145,13 +1145,13 @@ thin_descriptor_type (struct type *type) static struct value * thin_data_pntr (struct value *val) { - struct type *type = VALUE_TYPE (val); + struct type *type = value_type (val); if (TYPE_CODE (type) == TYPE_CODE_PTR) return value_cast (desc_data_type (thin_descriptor_type (type)), value_copy (val)); else return value_from_longest (desc_data_type (thin_descriptor_type (type)), - VALUE_ADDRESS (val) + VALUE_OFFSET (val)); + VALUE_ADDRESS (val) + value_offset (val)); } /* True iff TYPE indicates a "thick" array pointer type. */ @@ -1200,7 +1200,7 @@ desc_bounds_type (struct type *type) static struct value * desc_bounds (struct value *arr) { - struct type *type = ada_check_typedef (VALUE_TYPE (arr)); + struct type *type = ada_check_typedef (value_type (arr)); if (is_thin_pntr (type)) { struct type *bounds_type = @@ -1216,7 +1216,7 @@ desc_bounds (struct value *arr) if (TYPE_CODE (type) == TYPE_CODE_PTR) addr = value_as_long (arr); else - addr = VALUE_ADDRESS (arr) + VALUE_OFFSET (arr); + addr = VALUE_ADDRESS (arr) + value_offset (arr); return value_from_longest (lookup_pointer_type (bounds_type), @@ -1279,7 +1279,7 @@ desc_data_type (struct type *type) static struct value * desc_data (struct value *arr) { - struct type *type = VALUE_TYPE (arr); + struct type *type = value_type (arr); if (is_thin_pntr (type)) return thin_data_pntr (arr); else if (is_thick_pntr (type)) @@ -1449,27 +1449,27 @@ ada_is_bogus_array_descriptor (struct type *type) struct type * ada_type_of_array (struct value *arr, int bounds) { - if (ada_is_packed_array_type (VALUE_TYPE (arr))) - return decode_packed_array_type (VALUE_TYPE (arr)); + if (ada_is_packed_array_type (value_type (arr))) + return decode_packed_array_type (value_type (arr)); - if (!ada_is_array_descriptor_type (VALUE_TYPE (arr))) - return VALUE_TYPE (arr); + if (!ada_is_array_descriptor_type (value_type (arr))) + return value_type (arr); if (!bounds) return - ada_check_typedef (TYPE_TARGET_TYPE (desc_data_type (VALUE_TYPE (arr)))); + ada_check_typedef (TYPE_TARGET_TYPE (desc_data_type (value_type (arr)))); else { struct type *elt_type; int arity; struct value *descriptor; - struct objfile *objf = TYPE_OBJFILE (VALUE_TYPE (arr)); + struct objfile *objf = TYPE_OBJFILE (value_type (arr)); - elt_type = ada_array_element_type (VALUE_TYPE (arr), -1); - arity = ada_array_arity (VALUE_TYPE (arr)); + elt_type = ada_array_element_type (value_type (arr), -1); + arity = ada_array_arity (value_type (arr)); if (elt_type == NULL || arity == 0) - return ada_check_typedef (VALUE_TYPE (arr)); + return ada_check_typedef (value_type (arr)); descriptor = desc_bounds (arr); if (value_as_long (descriptor) == 0) @@ -1482,7 +1482,7 @@ ada_type_of_array (struct value *arr, int bounds) struct value *high = desc_one_bound (descriptor, arity, 1); arity -= 1; - create_range_type (range_type, VALUE_TYPE (low), + create_range_type (range_type, value_type (low), (int) value_as_long (low), (int) value_as_long (high)); elt_type = create_array_type (array_type, elt_type, range_type); @@ -1500,14 +1500,14 @@ ada_type_of_array (struct value *arr, int bounds) struct value * ada_coerce_to_simple_array_ptr (struct value *arr) { - if (ada_is_array_descriptor_type (VALUE_TYPE (arr))) + if (ada_is_array_descriptor_type (value_type (arr))) { struct type *arrType = ada_type_of_array (arr, 1); if (arrType == NULL) return NULL; return value_cast (arrType, value_copy (desc_data (arr))); } - else if (ada_is_packed_array_type (VALUE_TYPE (arr))) + else if (ada_is_packed_array_type (value_type (arr))) return decode_packed_array (arr); else return arr; @@ -1520,14 +1520,14 @@ ada_coerce_to_simple_array_ptr (struct value *arr) static struct value * ada_coerce_to_simple_array (struct value *arr) { - if (ada_is_array_descriptor_type (VALUE_TYPE (arr))) + if (ada_is_array_descriptor_type (value_type (arr))) { struct value *arrVal = ada_coerce_to_simple_array_ptr (arr); if (arrVal == NULL) error ("Bounds unavailable for null array pointer."); return value_ind (arrVal); } - else if (ada_is_packed_array_type (VALUE_TYPE (arr))) + else if (ada_is_packed_array_type (value_type (arr))) return decode_packed_array (arr); else return arr; @@ -1543,7 +1543,7 @@ ada_coerce_to_simple_array_type (struct type *type) struct value *mark = value_mark (); struct value *dummy = value_from_longest (builtin_type_long, 0); struct type *result; - VALUE_TYPE (dummy) = type; + dummy->type = type; result = ada_type_of_array (dummy, 0); value_free_to_mark (mark); return result; @@ -1661,17 +1661,17 @@ decode_packed_array (struct value *arr) struct type *type; arr = ada_coerce_ref (arr); - if (TYPE_CODE (VALUE_TYPE (arr)) == TYPE_CODE_PTR) + if (TYPE_CODE (value_type (arr)) == TYPE_CODE_PTR) arr = ada_value_ind (arr); - type = decode_packed_array_type (VALUE_TYPE (arr)); + type = decode_packed_array_type (value_type (arr)); if (type == NULL) { error ("can't unpack array"); return NULL; } - if (BITS_BIG_ENDIAN && ada_is_modular_type (VALUE_TYPE (arr))) + if (BITS_BIG_ENDIAN && ada_is_modular_type (value_type (arr))) { /* This is a (right-justified) modular type representing a packed array with no wrapper. In order to interpret the value through @@ -1680,14 +1680,14 @@ decode_packed_array (struct value *arr) int bit_size, bit_pos; ULONGEST mod; - mod = ada_modulus (VALUE_TYPE (arr)) - 1; + mod = ada_modulus (value_type (arr)) - 1; bit_size = 0; while (mod > 0) { bit_size += 1; mod >>= 1; } - bit_pos = HOST_CHAR_BIT * TYPE_LENGTH (VALUE_TYPE (arr)) - bit_size; + bit_pos = HOST_CHAR_BIT * TYPE_LENGTH (value_type (arr)) - bit_size; arr = ada_value_primitive_packed_val (arr, NULL, bit_pos / HOST_CHAR_BIT, bit_pos % HOST_CHAR_BIT, @@ -1713,7 +1713,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind) bits = 0; elt_total_bit_offset = 0; - elt_type = ada_check_typedef (VALUE_TYPE (arr)); + elt_type = ada_check_typedef (value_type (arr)); for (i = 0; i < arity; i += 1) { if (TYPE_CODE (elt_type) != TYPE_CODE_ARRAY @@ -1810,7 +1810,7 @@ ada_value_primitive_packed_val (struct value *obj, char *valaddr, long offset, else if (VALUE_LAZY (obj)) { v = value_at (type, - VALUE_ADDRESS (obj) + VALUE_OFFSET (obj) + offset); + VALUE_ADDRESS (obj) + value_offset (obj) + offset); bytes = (unsigned char *) alloca (len); read_memory (VALUE_ADDRESS (v), bytes, len); } @@ -1825,17 +1825,17 @@ ada_value_primitive_packed_val (struct value *obj, char *valaddr, long offset, VALUE_LVAL (v) = VALUE_LVAL (obj); if (VALUE_LVAL (obj) == lval_internalvar) VALUE_LVAL (v) = lval_internalvar_component; - VALUE_ADDRESS (v) = VALUE_ADDRESS (obj) + VALUE_OFFSET (obj) + offset; - VALUE_BITPOS (v) = bit_offset + VALUE_BITPOS (obj); - VALUE_BITSIZE (v) = bit_size; - if (VALUE_BITPOS (v) >= HOST_CHAR_BIT) + VALUE_ADDRESS (v) = VALUE_ADDRESS (obj) + value_offset (obj) + offset; + v->bitpos = bit_offset + value_bitpos (obj); + v->bitsize = bit_size; + if (value_bitpos (v) >= HOST_CHAR_BIT) { VALUE_ADDRESS (v) += 1; - VALUE_BITPOS (v) -= HOST_CHAR_BIT; + v->bitpos -= HOST_CHAR_BIT; } } else - VALUE_BITSIZE (v) = bit_size; + v->bitsize = bit_size; unpacked = (unsigned char *) VALUE_CONTENTS (v); srcBitsLeft = bit_size; @@ -2000,8 +2000,8 @@ move_bits (char *target, int targ_offset, char *source, int src_offset, int n) static struct value * ada_value_assign (struct value *toval, struct value *fromval) { - struct type *type = VALUE_TYPE (toval); - int bits = VALUE_BITSIZE (toval); + struct type *type = value_type (toval); + int bits = value_bitsize (toval); if (!toval->modifiable) error ("Left operand of assignment is not a modifiable lvalue."); @@ -2013,30 +2013,30 @@ ada_value_assign (struct value *toval, struct value *fromval) && (TYPE_CODE (type) == TYPE_CODE_FLT || TYPE_CODE (type) == TYPE_CODE_STRUCT)) { - int len = - (VALUE_BITPOS (toval) + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; + int len = (value_bitpos (toval) + + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; char *buffer = (char *) alloca (len); struct value *val; if (TYPE_CODE (type) == TYPE_CODE_FLT) fromval = value_cast (type, fromval); - read_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval), buffer, len); + read_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer, len); if (BITS_BIG_ENDIAN) - move_bits (buffer, VALUE_BITPOS (toval), + move_bits (buffer, value_bitpos (toval), VALUE_CONTENTS (fromval), - TYPE_LENGTH (VALUE_TYPE (fromval)) * TARGET_CHAR_BIT - + TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT - bits, bits); else - move_bits (buffer, VALUE_BITPOS (toval), VALUE_CONTENTS (fromval), + move_bits (buffer, value_bitpos (toval), VALUE_CONTENTS (fromval), 0, bits); - write_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval), buffer, + write_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer, len); val = value_copy (toval); memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval), TYPE_LENGTH (type)); - VALUE_TYPE (val) = type; + val->type = type; return val; } @@ -2058,7 +2058,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind) elt = ada_coerce_to_simple_array (arr); - elt_type = ada_check_typedef (VALUE_TYPE (elt)); + elt_type = ada_check_typedef (value_type (elt)); if (TYPE_CODE (elt_type) == TYPE_CODE_ARRAY && TYPE_FIELD_BITSIZE (elt_type, 0) > 0) return value_subscript_packed (elt, arity, ind); @@ -2125,7 +2125,7 @@ ada_value_slice_ptr (struct value *array_ptr, struct type *type, static struct value * ada_value_slice (struct value *array, int low, int high) { - struct type *type = VALUE_TYPE (array); + struct type *type = value_type (array); struct type *index_type = create_range_type (NULL, TYPE_INDEX_TYPE (type), low, high); struct type *slice_type = @@ -2312,7 +2312,7 @@ ada_array_bound_from_type (struct type * arr_type, int n, int which, struct value * ada_array_bound (struct value *arr, int n, int which) { - struct type *arr_type = VALUE_TYPE (arr); + struct type *arr_type = value_type (arr); if (ada_is_packed_array_type (arr_type)) return ada_array_bound (decode_packed_array (arr), n, which); @@ -2335,7 +2335,7 @@ ada_array_bound (struct value *arr, int n, int which) struct value * ada_array_length (struct value *arr, int n) { - struct type *arr_type = ada_check_typedef (VALUE_TYPE (arr)); + struct type *arr_type = ada_check_typedef (value_type (arr)); if (ada_is_packed_array_type (arr_type)) return ada_array_length (decode_packed_array (arr), n); @@ -2490,7 +2490,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, if (arg1 == NULL) resolve_subexp (expp, pos, 1, NULL); else - resolve_subexp (expp, pos, 1, VALUE_TYPE (arg1)); + resolve_subexp (expp, pos, 1, value_type (arg1)); break; } @@ -2864,7 +2864,7 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals) else { struct type *ftype = ada_check_typedef (TYPE_FIELD_TYPE (func_type, i)); - struct type *atype = ada_check_typedef (VALUE_TYPE (actuals[i])); + struct type *atype = ada_check_typedef (value_type (actuals[i])); if (!ada_type_match (ftype, atype, 1)) return 0; @@ -3336,9 +3336,9 @@ static int possible_user_operator_p (enum exp_opcode op, struct value *args[]) { struct type *type0 = - (args[0] == NULL) ? NULL : ada_check_typedef (VALUE_TYPE (args[0])); + (args[0] == NULL) ? NULL : ada_check_typedef (value_type (args[0])); struct type *type1 = - (args[1] == NULL) ? NULL : ada_check_typedef (VALUE_TYPE (args[1])); + (args[1] == NULL) ? NULL : ada_check_typedef (value_type (args[1])); if (type0 == NULL) return 0; @@ -3469,7 +3469,7 @@ ensure_lval (struct value *val, CORE_ADDR *sp) { if (! VALUE_LVAL (val)) { - int len = TYPE_LENGTH (ada_check_typedef (VALUE_TYPE (val))); + int len = TYPE_LENGTH (ada_check_typedef (value_type (val))); /* The following is taken from the structure-return code in call_function_by_hand. FIXME: Therefore, some refactoring seems @@ -3510,7 +3510,7 @@ static struct value * convert_actual (struct value *actual, struct type *formal_type0, CORE_ADDR *sp) { - struct type *actual_type = ada_check_typedef (VALUE_TYPE (actual)); + struct type *actual_type = ada_check_typedef (value_type (actual)); struct type *formal_type = ada_check_typedef (formal_type0); struct type *formal_target = TYPE_CODE (formal_type) == TYPE_CODE_PTR @@ -3532,7 +3532,7 @@ convert_actual (struct value *actual, struct type *formal_type0, if (VALUE_LVAL (actual) != lval_memory) { struct value *val; - actual_type = ada_check_typedef (VALUE_TYPE (actual)); + actual_type = ada_check_typedef (value_type (actual)); val = allocate_value (actual_type); memcpy ((char *) VALUE_CONTENTS_RAW (val), (char *) VALUE_CONTENTS (actual), @@ -3564,7 +3564,7 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp) struct value *bounds = allocate_value (bounds_type); int i; - for (i = ada_array_arity (ada_check_typedef (VALUE_TYPE (arr))); i > 0; i -= 1) + for (i = ada_array_arity (ada_check_typedef (value_type (arr))); i > 0; i -= 1) { modify_general_field (VALUE_CONTENTS (bounds), value_as_long (ada_array_bound (arr, i, 0)), @@ -3611,13 +3611,13 @@ ada_convert_actuals (struct value *func, int nargs, struct value *args[], { int i; - if (TYPE_NFIELDS (VALUE_TYPE (func)) == 0 - || nargs != TYPE_NFIELDS (VALUE_TYPE (func))) + if (TYPE_NFIELDS (value_type (func)) == 0 + || nargs != TYPE_NFIELDS (value_type (func))) return; for (i = 0; i < nargs; i += 1) args[i] = - convert_actual (args[i], TYPE_FIELD_TYPE (VALUE_TYPE (func), i), sp); + convert_actual (args[i], TYPE_FIELD_TYPE (value_type (func), i), sp); } /* Dummy definitions for an experimental caching module that is not @@ -4974,7 +4974,7 @@ ada_is_tag_type (struct type *type) struct type * ada_tag_type (struct value *val) { - return ada_lookup_struct_elt_type (VALUE_TYPE (val), "_tag", 1, 0, NULL); + return ada_lookup_struct_elt_type (value_type (val), "_tag", 1, 0, NULL); } /* The value of the tag on VAL. */ @@ -5055,7 +5055,7 @@ const char * ada_tag_name (struct value *tag) { struct tag_args args; - if (!ada_is_tag_type (VALUE_TYPE (tag))) + if (!ada_is_tag_type (value_type (tag))) return NULL; args.tag = tag; args.name = NULL; @@ -5465,7 +5465,7 @@ ada_value_struct_elt (struct value *arg, char *name, char *err) struct value *v; v = NULL; - t1 = t = ada_check_typedef (VALUE_TYPE (arg)); + t1 = t = ada_check_typedef (value_type (arg)); if (TYPE_CODE (t) == TYPE_CODE_REF) { t1 = TYPE_TARGET_TYPE (t); @@ -5763,7 +5763,7 @@ ada_value_ind (struct value *val0) static struct value * ada_coerce_ref (struct value *val0) { - if (TYPE_CODE (VALUE_TYPE (val0)) == TYPE_CODE_REF) + if (TYPE_CODE (value_type (val0)) == TYPE_CODE_REF) { struct value *val = val0; val = coerce_ref (val); @@ -6017,7 +6017,7 @@ empty_record (struct objfile *objfile) the value of type TYPE at VALADDR or ADDRESS (see comments at the beginning of this section) VAL according to GNAT conventions. DVAL0 should describe the (portion of a) record that contains any - necessary discriminants. It should be NULL if VALUE_TYPE (VAL) is + necessary discriminants. It should be NULL if value_type (VAL) is an outer-level type (i.e., as opposed to a branch of a variant.) A variant field (unless unchecked) is replaced by a particular branch of the variant. @@ -6387,7 +6387,7 @@ to_fixed_variant_branch_type (struct type *var_type0, char *valaddr, which = ada_which_variant_applies (var_type, - VALUE_TYPE (dval), VALUE_CONTENTS (dval)); + value_type (dval), VALUE_CONTENTS (dval)); if (which < 0) return empty_record (TYPE_OBJFILE (var_type)); @@ -6618,8 +6618,8 @@ ada_to_fixed_value_create (struct type *type0, CORE_ADDR address, static struct value * ada_to_fixed_value (struct value *val) { - return ada_to_fixed_value_create (VALUE_TYPE (val), - VALUE_ADDRESS (val) + VALUE_OFFSET (val), + return ada_to_fixed_value_create (value_type (val), + VALUE_ADDRESS (val) + value_offset (val), val); } @@ -6632,8 +6632,8 @@ struct value * ada_to_static_fixed_value (struct value *val) { struct type *type = - to_static_fixed_type (static_unwrap_type (VALUE_TYPE (val))); - if (type == VALUE_TYPE (val)) + to_static_fixed_type (static_unwrap_type (value_type (val))); + if (type == value_type (val)) return val; else return coerce_unspec_val_to_type (val, type); @@ -6676,7 +6676,7 @@ ada_attribute_name (enum exp_opcode n) static LONGEST pos_atr (struct value *arg) { - struct type *type = VALUE_TYPE (arg); + struct type *type = value_type (arg); if (!discrete_type_p (type)) error ("'POS only defined on discrete types"); @@ -6710,7 +6710,7 @@ value_val_atr (struct type *type, struct value *arg) { if (!discrete_type_p (type)) error ("'VAL only defined on discrete types"); - if (!integer_type_p (VALUE_TYPE (arg))) + if (!integer_type_p (value_type (arg))) error ("'VAL requires integral argument"); if (TYPE_CODE (type) == TYPE_CODE_ENUM) @@ -6935,12 +6935,12 @@ evaluate_subexp_type (struct expression *exp, int *pos) static struct value * unwrap_value (struct value *val) { - struct type *type = ada_check_typedef (VALUE_TYPE (val)); + struct type *type = ada_check_typedef (value_type (val)); if (ada_is_aligner_type (type)) { struct value *v = value_struct_elt (&val, NULL, "F", NULL, "internal structure"); - struct type *val_type = ada_check_typedef (VALUE_TYPE (v)); + struct type *val_type = ada_check_typedef (value_type (v)); if (ada_type_name (val_type) == NULL) TYPE_NAME (val_type) = ada_type_name (type); @@ -6957,7 +6957,7 @@ unwrap_value (struct value *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) + value_offset (val), NULL)); } } @@ -6967,11 +6967,11 @@ cast_to_fixed (struct type *type, struct value *arg) { LONGEST val; - if (type == VALUE_TYPE (arg)) + if (type == value_type (arg)) return arg; - else if (ada_is_fixed_point_type (VALUE_TYPE (arg))) + else if (ada_is_fixed_point_type (value_type (arg))) val = ada_float_to_fixed (type, - ada_fixed_to_float (VALUE_TYPE (arg), + ada_fixed_to_float (value_type (arg), value_as_long (arg))); else { @@ -6986,7 +6986,7 @@ cast_to_fixed (struct type *type, struct value *arg) static struct value * cast_from_fixed_to_double (struct value *arg) { - DOUBLEST val = ada_fixed_to_float (VALUE_TYPE (arg), + DOUBLEST val = ada_fixed_to_float (value_type (arg), value_as_long (arg)); return value_from_double (builtin_type_double, val); } @@ -6997,7 +6997,7 @@ cast_from_fixed_to_double (struct value *arg) static struct value * coerce_for_assign (struct type *type, struct value *val) { - struct type *type2 = VALUE_TYPE (val); + struct type *type2 = value_type (val); if (type == type2) return val; @@ -7008,7 +7008,7 @@ coerce_for_assign (struct type *type, struct value *val) && TYPE_CODE (type) == TYPE_CODE_ARRAY) { val = ada_value_ind (val); - type2 = VALUE_TYPE (val); + type2 = value_type (val); } if (TYPE_CODE (type2) == TYPE_CODE_ARRAY @@ -7018,7 +7018,7 @@ coerce_for_assign (struct type *type, struct value *val) || TYPE_LENGTH (TYPE_TARGET_TYPE (type2)) != TYPE_LENGTH (TYPE_TARGET_TYPE (type2))) error ("Incompatible types in assignment"); - VALUE_TYPE (val) = type; + val->type = type; } return val; } @@ -7032,8 +7032,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) arg1 = coerce_ref (arg1); arg2 = coerce_ref (arg2); - type1 = base_type (ada_check_typedef (VALUE_TYPE (arg1))); - type2 = base_type (ada_check_typedef (VALUE_TYPE (arg2))); + type1 = base_type (ada_check_typedef (value_type (arg1))); + type2 = base_type (ada_check_typedef (value_type (arg2))); if (TYPE_CODE (type1) != TYPE_CODE_INT || TYPE_CODE (type2) != TYPE_CODE_INT) @@ -7076,28 +7076,28 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) val = allocate_value (type1); store_unsigned_integer (VALUE_CONTENTS_RAW (val), - TYPE_LENGTH (VALUE_TYPE (val)), v); + TYPE_LENGTH (value_type (val)), v); return val; } static int ada_value_equal (struct value *arg1, struct value *arg2) { - if (ada_is_direct_array_type (VALUE_TYPE (arg1)) - || ada_is_direct_array_type (VALUE_TYPE (arg2))) + if (ada_is_direct_array_type (value_type (arg1)) + || ada_is_direct_array_type (value_type (arg2))) { arg1 = ada_coerce_to_simple_array (arg1); arg2 = ada_coerce_to_simple_array (arg2); - if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_ARRAY - || TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_ARRAY) + if (TYPE_CODE (value_type (arg1)) != TYPE_CODE_ARRAY + || TYPE_CODE (value_type (arg2)) != TYPE_CODE_ARRAY) error ("Attempt to compare array with non-array"); /* FIXME: The following works only for types whose representations use all bits (no padding or undefined bits) and do not have user-defined equality. */ return - TYPE_LENGTH (VALUE_TYPE (arg1)) == TYPE_LENGTH (VALUE_TYPE (arg2)) + TYPE_LENGTH (value_type (arg1)) == TYPE_LENGTH (value_type (arg2)) && memcmp (VALUE_CONTENTS (arg1), VALUE_CONTENTS (arg2), - TYPE_LENGTH (VALUE_TYPE (arg1))) == 0; + TYPE_LENGTH (value_type (arg1))) == 0; } return value_equal (arg1, arg2); } @@ -7133,8 +7133,8 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, result = evaluate_subexp_standard (expect_type, exp, pos, noside); /* The result type will have code OP_STRING, bashed there from OP_ARRAY. Bash it back. */ - if (TYPE_CODE (VALUE_TYPE (result)) == TYPE_CODE_STRING) - TYPE_CODE (VALUE_TYPE (result)) = TYPE_CODE_ARRAY; + if (TYPE_CODE (value_type (result)) == TYPE_CODE_STRING) + TYPE_CODE (value_type (result)) = TYPE_CODE_ARRAY; return result; } @@ -7144,11 +7144,11 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = evaluate_subexp (type, exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - if (type != ada_check_typedef (VALUE_TYPE (arg1))) + if (type != ada_check_typedef (value_type (arg1))) { if (ada_is_fixed_point_type (type)) arg1 = cast_to_fixed (type, arg1); - else if (ada_is_fixed_point_type (VALUE_TYPE (arg1))) + else if (ada_is_fixed_point_type (value_type (arg1))) arg1 = value_cast (type, cast_from_fixed_to_double (arg1)); else if (VALUE_LVAL (arg1) == lval_memory) { @@ -7161,7 +7161,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, return value_zero (to_static_fixed_type (type), not_lval); arg1 = ada_to_fixed_value_create - (type, VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1), 0); + (type, VALUE_ADDRESS (arg1) + value_offset (arg1), 0); } else arg1 = value_cast (type, arg1); @@ -7175,16 +7175,16 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, case BINOP_ASSIGN: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) return arg1; - if (ada_is_fixed_point_type (VALUE_TYPE (arg1))) - arg2 = cast_to_fixed (VALUE_TYPE (arg1), arg2); - else if (ada_is_fixed_point_type (VALUE_TYPE (arg2))) + if (ada_is_fixed_point_type (value_type (arg1))) + arg2 = cast_to_fixed (value_type (arg1), arg2); + else if (ada_is_fixed_point_type (value_type (arg2))) error ("Fixed-point values must be assigned to fixed-point variables"); else - arg2 = coerce_for_assign (VALUE_TYPE (arg1), arg2); + arg2 = coerce_for_assign (value_type (arg1), arg2); return ada_value_assign (arg1, arg2); case BINOP_ADD: @@ -7192,22 +7192,22 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg2 = evaluate_subexp_with_coercion (exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - if ((ada_is_fixed_point_type (VALUE_TYPE (arg1)) - || ada_is_fixed_point_type (VALUE_TYPE (arg2))) - && VALUE_TYPE (arg1) != VALUE_TYPE (arg2)) + if ((ada_is_fixed_point_type (value_type (arg1)) + || ada_is_fixed_point_type (value_type (arg2))) + && value_type (arg1) != value_type (arg2)) error ("Operands of fixed-point addition must have the same type"); - return value_cast (VALUE_TYPE (arg1), value_add (arg1, arg2)); + return value_cast (value_type (arg1), value_add (arg1, arg2)); case BINOP_SUB: arg1 = evaluate_subexp_with_coercion (exp, pos, noside); arg2 = evaluate_subexp_with_coercion (exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - if ((ada_is_fixed_point_type (VALUE_TYPE (arg1)) - || ada_is_fixed_point_type (VALUE_TYPE (arg2))) - && VALUE_TYPE (arg1) != VALUE_TYPE (arg2)) + if ((ada_is_fixed_point_type (value_type (arg1)) + || ada_is_fixed_point_type (value_type (arg2))) + && value_type (arg1) != value_type (arg2)) error ("Operands of fixed-point subtraction must have the same type"); - return value_cast (VALUE_TYPE (arg1), value_sub (arg1, arg2)); + return value_cast (value_type (arg1), value_sub (arg1, arg2)); case BINOP_MUL: case BINOP_DIV: @@ -7217,12 +7217,12 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD)) - return value_zero (VALUE_TYPE (arg1), not_lval); + return value_zero (value_type (arg1), not_lval); else { - if (ada_is_fixed_point_type (VALUE_TYPE (arg1))) + if (ada_is_fixed_point_type (value_type (arg1))) arg1 = cast_from_fixed_to_double (arg1); - if (ada_is_fixed_point_type (VALUE_TYPE (arg2))) + if (ada_is_fixed_point_type (value_type (arg2))) arg2 = cast_from_fixed_to_double (arg2); return ada_value_binop (arg1, arg2, op); } @@ -7235,14 +7235,14 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD)) - return value_zero (VALUE_TYPE (arg1), not_lval); + return value_zero (value_type (arg1), not_lval); else return ada_value_binop (arg1, arg2, op); case BINOP_EQUAL: case BINOP_NOTEQUAL: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; if (noside == EVAL_AVOID_SIDE_EFFECTS) @@ -7257,8 +7257,8 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - else if (ada_is_fixed_point_type (VALUE_TYPE (arg1))) - return value_cast (VALUE_TYPE (arg1), value_neg (arg1)); + else if (ada_is_fixed_point_type (value_type (arg1))) + return value_cast (value_type (arg1), value_neg (arg1)); else return value_neg (arg1); @@ -7314,14 +7314,14 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, goto nosideret; } - if (ada_is_packed_array_type (desc_base_type (VALUE_TYPE (argvec[0])))) + if (ada_is_packed_array_type (desc_base_type (value_type (argvec[0])))) argvec[0] = ada_coerce_to_simple_array (argvec[0]); - else if (TYPE_CODE (VALUE_TYPE (argvec[0])) == TYPE_CODE_REF - || (TYPE_CODE (VALUE_TYPE (argvec[0])) == TYPE_CODE_ARRAY + else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_REF + || (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY && VALUE_LVAL (argvec[0]) == lval_memory)) argvec[0] = value_addr (argvec[0]); - type = ada_check_typedef (VALUE_TYPE (argvec[0])); + type = ada_check_typedef (value_type (argvec[0])); if (TYPE_CODE (type) == TYPE_CODE_PTR) { switch (TYPE_CODE (ada_check_typedef (TYPE_TARGET_TYPE (type)))) @@ -7338,7 +7338,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, break; default: error ("cannot subscript or call something of type `%s'", - ada_type_name (VALUE_TYPE (argvec[0]))); + ada_type_name (value_type (argvec[0]))); break; } } @@ -7416,32 +7416,32 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, /* If this is a reference to an aligner type, then remove all the aligners. */ - if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_REF - && ada_is_aligner_type (TYPE_TARGET_TYPE (VALUE_TYPE (array)))) - TYPE_TARGET_TYPE (VALUE_TYPE (array)) = - ada_aligned_type (TYPE_TARGET_TYPE (VALUE_TYPE (array))); + if (TYPE_CODE (value_type (array)) == TYPE_CODE_REF + && ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array)))) + TYPE_TARGET_TYPE (value_type (array)) = + ada_aligned_type (TYPE_TARGET_TYPE (value_type (array))); - if (ada_is_packed_array_type (VALUE_TYPE (array))) + if (ada_is_packed_array_type (value_type (array))) error ("cannot slice a packed array"); /* If this is a reference to an array or an array lvalue, convert to a pointer. */ - if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_REF - || (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_ARRAY + if (TYPE_CODE (value_type (array)) == TYPE_CODE_REF + || (TYPE_CODE (value_type (array)) == TYPE_CODE_ARRAY && VALUE_LVAL (array) == lval_memory)) array = value_addr (array); if (noside == EVAL_AVOID_SIDE_EFFECTS && ada_is_array_descriptor_type (ada_check_typedef - (VALUE_TYPE (array)))) + (value_type (array)))) return empty_array (ada_type_of_array (array, 0), low_bound); array = ada_coerce_to_simple_array_ptr (array); /* If we have more than one level of pointer indirection, dereference the value until we get only one level. */ - while (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR - && (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (array))) + while (TYPE_CODE (value_type (array)) == TYPE_CODE_PTR + && (TYPE_CODE (TYPE_TARGET_TYPE (value_type (array))) == TYPE_CODE_PTR)) array = value_ind (array); @@ -7449,18 +7449,18 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, to avoid a SEGV when trying to get the index type or the target type later down the road if the debug info generated by the compiler is incorrect or incomplete. */ - if (!ada_is_simple_array_type (VALUE_TYPE (array))) + if (!ada_is_simple_array_type (value_type (array))) error ("cannot take slice of non-array"); - if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR) + if (TYPE_CODE (value_type (array)) == TYPE_CODE_PTR) { if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS) - return empty_array (TYPE_TARGET_TYPE (VALUE_TYPE (array)), + return empty_array (TYPE_TARGET_TYPE (value_type (array)), low_bound); else { struct type *arr_type0 = - to_fixed_array_type (TYPE_TARGET_TYPE (VALUE_TYPE (array)), + to_fixed_array_type (TYPE_TARGET_TYPE (value_type (array)), NULL, 1); return ada_value_slice_ptr (array, arr_type0, (int) low_bound, @@ -7470,7 +7470,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, else if (noside == EVAL_AVOID_SIDE_EFFECTS) return array; else if (high_bound < low_bound) - return empty_array (VALUE_TYPE (array), low_bound); + return empty_array (value_type (array), low_bound); else return ada_value_slice (array, (int) low_bound, (int) high_bound); } @@ -7515,7 +7515,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, tem = longest_to_int (exp->elts[pc + 1].longconst); - if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg2))) + if (tem < 1 || tem > ada_array_arity (value_type (arg2))) error ("invalid dimension number to '%s", "range"); arg3 = ada_array_bound (arg2, tem, 1); @@ -7572,16 +7572,16 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, { arg1 = ada_coerce_ref (arg1); - if (ada_is_packed_array_type (VALUE_TYPE (arg1))) + if (ada_is_packed_array_type (value_type (arg1))) arg1 = ada_coerce_to_simple_array (arg1); - if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg1))) + if (tem < 1 || tem > ada_array_arity (value_type (arg1))) error ("invalid dimension number to '%s", ada_attribute_name (op)); if (noside == EVAL_AVOID_SIDE_EFFECTS) { - type = ada_index_type (VALUE_TYPE (arg1), tem); + type = ada_index_type (value_type (arg1), tem); if (type == NULL) error ("attempt to take bound of something that is not an array"); @@ -7678,7 +7678,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, if (noside == EVAL_SKIP) goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (VALUE_TYPE (arg1), not_lval); + return value_zero (value_type (arg1), not_lval); else return value_binop (arg1, arg2, op == OP_ATR_MIN ? BINOP_MIN : BINOP_MAX); @@ -7718,7 +7718,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, else return value_from_longest (builtin_type_int, TARGET_CHAR_BIT - * TYPE_LENGTH (VALUE_TYPE (arg1))); + * TYPE_LENGTH (value_type (arg1))); case OP_ATR_VAL: evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP); @@ -7737,7 +7737,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, if (noside == EVAL_SKIP) goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (VALUE_TYPE (arg1), not_lval); + return value_zero (value_type (arg1), not_lval); else return value_binop (arg1, arg2, op); @@ -7752,7 +7752,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - if (value_less (arg1, value_zero (VALUE_TYPE (arg1), not_lval))) + if (value_less (arg1, value_zero (value_type (arg1), not_lval))) return value_neg (arg1); else return arg1; @@ -7763,7 +7763,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = evaluate_subexp (expect_type, exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - type = ada_check_typedef (VALUE_TYPE (arg1)); + type = ada_check_typedef (value_type (arg1)); if (noside == EVAL_AVOID_SIDE_EFFECTS) { if (ada_is_array_descriptor_type (type)) @@ -7792,7 +7792,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, error ("Attempt to take contents of a non-pointer value."); } arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */ - type = ada_check_typedef (VALUE_TYPE (arg1)); + type = ada_check_typedef (value_type (arg1)); if (ada_is_array_descriptor_type (type)) /* GDB allows dereferencing GNAT array descriptors. */ @@ -7808,7 +7808,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, goto nosideret; if (noside == EVAL_AVOID_SIDE_EFFECTS) { - struct type *type1 = VALUE_TYPE (arg1); + struct type *type1 = value_type (arg1); if (ada_is_tagged_type (type1, 1)) { type = ada_lookup_struct_elt_type (type1, @@ -8032,7 +8032,7 @@ scan_discrim_bound (char *str, int k, struct value *dval, LONGEST * px, k = pend - str; } - bound_val = ada_search_struct_field (bound, dval, 0, VALUE_TYPE (dval)); + bound_val = ada_search_struct_field (bound, dval, 0, value_type (dval)); if (bound_val == NULL) return 0; diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 82e6825..ca0481c 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -614,7 +614,7 @@ ada_val_print_1 (struct type *type, char *valaddr0, int embedded_offset, retn = 0; } else - retn = ada_val_print_1 (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, + retn = ada_val_print_1 (value_type (val), VALUE_CONTENTS (val), 0, VALUE_ADDRESS (val), stream, format, deref_ref, recurse, pretty); value_free_to_mark (mark); @@ -860,7 +860,7 @@ ada_val_print_1 (struct type *type, char *valaddr0, int embedded_offset, ada_value_ind (value_from_longest (lookup_pointer_type (elttype), deref_val_int)); - val_print (VALUE_TYPE (deref_val), + val_print (value_type (deref_val), VALUE_CONTENTS (deref_val), 0, VALUE_ADDRESS (deref_val), stream, format, deref_ref, recurse + 1, pretty); @@ -902,9 +902,9 @@ ada_value_print (struct value *val0, struct ui_file *stream, int format, enum val_prettyprint pretty) { char *valaddr = VALUE_CONTENTS (val0); - CORE_ADDR address = VALUE_ADDRESS (val0) + VALUE_OFFSET (val0); + CORE_ADDR address = VALUE_ADDRESS (val0) + value_offset (val0); struct type *type = - ada_to_fixed_type (VALUE_TYPE (val0), valaddr, address, NULL); + ada_to_fixed_type (value_type (val0), valaddr, address, NULL); struct value *val = value_from_contents_and_address (type, valaddr, address); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 43de3b1..e3a479ec 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1224,7 +1224,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, enum type_code typecode; char *val; - arg_type = check_typedef (VALUE_TYPE (args[argnum])); + arg_type = check_typedef (value_type (args[argnum])); len = TYPE_LENGTH (arg_type); target_type = TYPE_TARGET_TYPE (arg_type); typecode = TYPE_CODE (arg_type); diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index dadad8e..c425676 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -1490,7 +1490,7 @@ gen_expr (union exp_element **pc, struct agent_expr *ax, { ax_const_l (ax, value_as_long (v)); value->kind = axs_rvalue; - value->type = check_typedef (VALUE_TYPE (v)); + value->type = check_typedef (value_type (v)); return; } } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 5537673..0c0dd1e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -401,7 +401,7 @@ get_number_trailer (char **pp, int trailer) strncpy (varname, start, p - start); varname[p - start] = '\0'; val = value_of_internalvar (lookup_internalvar (varname)); - if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT) + if (TYPE_CODE (value_type (val)) == TYPE_CODE_INT) retval = (int) value_as_long (val); else { @@ -962,7 +962,7 @@ insert_bp_location (struct bp_location *bpt, if (VALUE_LVAL (v) == lval_memory && ! VALUE_LAZY (v)) { - struct type *vtype = check_typedef (VALUE_TYPE (v)); + struct type *vtype = check_typedef (value_type (v)); /* We only watch structs and arrays if user asked for it explicitly, never if they just happen to @@ -974,8 +974,8 @@ insert_bp_location (struct bp_location *bpt, CORE_ADDR addr; int len, type; - addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); - len = TYPE_LENGTH (VALUE_TYPE (v)); + addr = VALUE_ADDRESS (v) + value_offset (v); + len = TYPE_LENGTH (value_type (v)); type = hw_write; if (bpt->owner->type == bp_read_watchpoint) type = hw_read; @@ -1495,7 +1495,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) if (VALUE_LVAL (v) == lval_memory && ! VALUE_LAZY (v)) { - struct type *vtype = check_typedef (VALUE_TYPE (v)); + struct type *vtype = check_typedef (value_type (v)); if (v == b->owner->val_chain || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT @@ -1504,8 +1504,8 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) CORE_ADDR addr; int len, type; - addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); - len = TYPE_LENGTH (VALUE_TYPE (v)); + addr = VALUE_ADDRESS (v) + value_offset (v); + len = TYPE_LENGTH (value_type (v)); type = hw_write; if (b->owner->type == bp_read_watchpoint) type = hw_read; @@ -2748,7 +2748,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint) if (VALUE_LVAL (v) == lval_memory && ! VALUE_LAZY (v)) { - struct type *vtype = check_typedef (VALUE_TYPE (v)); + struct type *vtype = check_typedef (value_type (v)); if (v == b->val_chain || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT @@ -2756,11 +2756,11 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint) { CORE_ADDR vaddr; - vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); + vaddr = VALUE_ADDRESS (v) + value_offset (v); /* Exact match not required. Within range is sufficient. */ if (addr >= vaddr && - addr < vaddr + TYPE_LENGTH (VALUE_TYPE (v))) + addr < vaddr + TYPE_LENGTH (value_type (v))) found = 1; } } @@ -5994,7 +5994,7 @@ can_use_hardware_watchpoint (struct value *v) { /* Ahh, memory we actually used! Check if we can cover it with hardware watchpoints. */ - struct type *vtype = check_typedef (VALUE_TYPE (v)); + struct type *vtype = check_typedef (value_type (v)); /* We only watch structs and arrays if user asked for it explicitly, never if they just happen to appear in a @@ -6003,8 +6003,8 @@ can_use_hardware_watchpoint (struct value *v) || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) { - CORE_ADDR vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); - int len = TYPE_LENGTH (VALUE_TYPE (v)); + CORE_ADDR vaddr = VALUE_ADDRESS (v) + value_offset (v); + int len = TYPE_LENGTH (value_type (v)); if (!TARGET_REGION_OK_FOR_HW_WATCHPOINT (vaddr, len)) return 0; diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 5a25498..f0f1663 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -232,7 +232,7 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset, wtype = TYPE_TARGET_TYPE (type); } vt_val = value_at (wtype, vt_address); - val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val), 0, + val_print (value_type (vt_val), VALUE_CONTENTS (vt_val), 0, VALUE_ADDRESS (vt_val), stream, format, deref_ref, recurse + 1, pretty); if (pretty) @@ -282,7 +282,7 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset, (TYPE_TARGET_TYPE (type), unpack_pointer (lookup_pointer_type (builtin_type_void), valaddr + embedded_offset)); - val_print (VALUE_TYPE (deref_val), + val_print (value_type (deref_val), VALUE_CONTENTS (deref_val), 0, VALUE_ADDRESS (deref_val), @@ -498,7 +498,7 @@ int c_value_print (struct value *val, struct ui_file *stream, int format, enum val_prettyprint pretty) { - struct type *type = VALUE_TYPE (val); + struct type *type = value_type (val); struct type *real_type; int full, top, using_enc; @@ -530,7 +530,7 @@ c_value_print (struct value *val, struct ui_file *stream, int format, */ struct value *temparg; temparg=value_copy(val); - VALUE_TYPE (temparg) = lookup_pointer_type(TYPE_TARGET_TYPE(type)); + temparg->type = lookup_pointer_type (TYPE_TARGET_TYPE(type)); val=temparg; } /* Pointer to class, check real type of object */ @@ -566,7 +566,7 @@ c_value_print (struct value *val, struct ui_file *stream, int format, fprintf_filtered (stream, ") "); } } - if (objectprint && (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_CLASS)) + if (objectprint && (TYPE_CODE (value_type (val)) == TYPE_CODE_CLASS)) { /* Attempt to determine real type of object */ real_type = value_rtti_type (val, &full, &top, &using_enc); @@ -596,6 +596,6 @@ c_value_print (struct value *val, struct ui_file *stream, int format, return val_print (type, VALUE_CONTENTS_ALL (val), VALUE_EMBEDDED_OFFSET (val), - VALUE_ADDRESS (val) + VALUE_OFFSET (val), + VALUE_ADDRESS (val) + value_offset (val), stream, format, 1, 0, pretty); } diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 84b4a6d..09bbf12 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -300,7 +300,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format) if (file_format == NULL || strcmp (file_format, "binary") == 0) { dump_binary_file (filename, mode, VALUE_CONTENTS (val), - TYPE_LENGTH (VALUE_TYPE (val))); + TYPE_LENGTH (value_type (val))); } else { @@ -318,7 +318,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format) dump_bfd_file (filename, mode, file_format, vaddr, VALUE_CONTENTS (val), - TYPE_LENGTH (VALUE_TYPE (val))); + TYPE_LENGTH (value_type (val))); } do_cleanups (old_cleanups); diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 6f9bb35..882fac2 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -422,7 +422,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, char *valaddr, v = value_from_pointer (lookup_pointer_type (builtin_type_unsigned_long), *(unsigned long *) (valaddr + offset)); - val_print (VALUE_TYPE (v), VALUE_CONTENTS (v), 0, 0, + val_print (value_type (v), VALUE_CONTENTS (v), 0, 0, stream, format, 0, recurse + 1, pretty); fields_seen = 1; @@ -784,10 +784,10 @@ cp_print_hpacc_virtual_table_entries (struct type *type, int *vfuncs, /* adjust by offset */ vf->aligner.contents[0] += 4 * (HP_ACC_VFUNC_START + vx); vf = value_ind (vf); /* get the entry */ - VALUE_TYPE (vf) = VALUE_TYPE (v); /* make it a pointer */ + vf->type = value_type (v); /* make it a pointer */ /* print out the entry */ - val_print (VALUE_TYPE (vf), VALUE_CONTENTS (vf), 0, 0, + val_print (value_type (vf), VALUE_CONTENTS (vf), 0, 0, stream, format, 0, recurse + 1, pretty); field_physname = TYPE_FN_FIELD_PHYSNAME (TYPE_FN_FIELDLIST1 (type, fn), oi); @@ -197,7 +197,7 @@ evaluate_struct_tuple (struct value *struct_val, struct expression *exp, int *pos, enum noside noside, int nargs) { - struct type *struct_type = check_typedef (VALUE_TYPE (struct_val)); + struct type *struct_type = check_typedef (value_type (struct_val)); struct type *substruct_type = struct_type; struct type *field_type; int fieldno = -1; @@ -308,7 +308,7 @@ evaluate_struct_tuple (struct value *struct_val, /* Now actually set the field in struct_val. */ /* Assign val to field fieldno. */ - if (VALUE_TYPE (val) != field_type) + if (value_type (val) != field_type) val = value_cast (field_type, val); bitsize = TYPE_FIELD_BITSIZE (substruct_type, subfieldno); @@ -321,7 +321,7 @@ evaluate_struct_tuple (struct value *struct_val, bitpos % 8, bitsize); else memcpy (addr, VALUE_CONTENTS (val), - TYPE_LENGTH (VALUE_TYPE (val))); + TYPE_LENGTH (value_type (val))); } while (--nlabels > 0); } @@ -341,7 +341,7 @@ init_array_element (struct value *array, struct value *element, enum noside noside, LONGEST low_bound, LONGEST high_bound) { LONGEST index; - int element_size = TYPE_LENGTH (VALUE_TYPE (element)); + int element_size = TYPE_LENGTH (value_type (element)); if (exp->elts[*pos].opcode == BINOP_COMMA) { (*pos)++; @@ -529,7 +529,7 @@ evaluate_subexp_standard (struct type *expect_type, evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP); } element = evaluate_subexp (element_type, exp, pos, noside); - if (VALUE_TYPE (element) != element_type) + if (value_type (element) != element_type) element = value_cast (element_type, element); if (index_pc) { @@ -580,16 +580,16 @@ evaluate_subexp_standard (struct type *expect_type, { (*pos)++; elem_val = evaluate_subexp (element_type, exp, pos, noside); - range_low_type = VALUE_TYPE (elem_val); + range_low_type = value_type (elem_val); range_low = value_as_long (elem_val); elem_val = evaluate_subexp (element_type, exp, pos, noside); - range_high_type = VALUE_TYPE (elem_val); + range_high_type = value_type (elem_val); range_high = value_as_long (elem_val); } else { elem_val = evaluate_subexp (element_type, exp, pos, noside); - range_low_type = range_high_type = VALUE_TYPE (elem_val); + range_low_type = range_high_type = value_type (elem_val); range_low = range_high = value_as_long (elem_val); } /* check types of elements to avoid mixture of elements from @@ -885,7 +885,7 @@ evaluate_subexp_standard (struct type *expect_type, if (method) { - if (TYPE_CODE (VALUE_TYPE (method)) != TYPE_CODE_FUNC) + 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); @@ -914,7 +914,7 @@ evaluate_subexp_standard (struct type *expect_type, it's opinion (ie. through "whatis"), it won't offer it. */ - struct type *type = VALUE_TYPE (called_method); + struct type *type = value_type (called_method); if (type && TYPE_CODE (type) == TYPE_CODE_PTR) type = TYPE_TARGET_TYPE (type); type = TYPE_TARGET_TYPE (type); @@ -945,8 +945,8 @@ evaluate_subexp_standard (struct type *expect_type, if (gnu_runtime && (method != NULL)) { /* Function objc_msg_lookup returns a pointer. */ - VALUE_TYPE (argvec[0]) = lookup_function_type - (lookup_pointer_type (VALUE_TYPE (argvec[0]))); + argvec[0]->type + = lookup_function_type (lookup_pointer_type (value_type (argvec[0]))); argvec[0] = call_function_by_hand (argvec[0], nargs + 2, argvec + 1); } @@ -1005,9 +1005,9 @@ evaluate_subexp_standard (struct type *expect_type, int fnoffset = METHOD_PTR_TO_VOFFSET (fnptr); struct type *basetype; struct type *domain_type = - TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))); + TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (value_type (arg1))); int i, j; - basetype = TYPE_TARGET_TYPE (VALUE_TYPE (arg2)); + basetype = TYPE_TARGET_TYPE (value_type (arg2)); if (domain_type != basetype) arg2 = value_cast (lookup_pointer_type (domain_type), arg2); basetype = TYPE_VPTR_BASETYPE (domain_type); @@ -1030,7 +1030,7 @@ evaluate_subexp_standard (struct type *expect_type, } else { - VALUE_TYPE (arg1) = lookup_pointer_type (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))); + arg1->type = lookup_pointer_type (TYPE_TARGET_TYPE (value_type (arg1))); } got_it: @@ -1081,7 +1081,7 @@ evaluate_subexp_standard (struct type *expect_type, save_pos1 = *pos; argvec[0] = evaluate_subexp_with_coercion (exp, pos, noside); tem = 1; - type = VALUE_TYPE (argvec[0]); + type = value_type (argvec[0]); if (type && TYPE_CODE (type) == TYPE_CODE_PTR) type = TYPE_TARGET_TYPE (type); if (type && TYPE_CODE (type) == TYPE_CODE_FUNC) @@ -1124,7 +1124,7 @@ evaluate_subexp_standard (struct type *expect_type, /* Prepare list of argument types for overload resolution */ arg_types = (struct type **) alloca (nargs * (sizeof (struct type *))); for (ix = 1; ix <= nargs; ix++) - arg_types[ix - 1] = VALUE_TYPE (argvec[ix]); + arg_types[ix - 1] = value_type (argvec[ix]); (void) find_overload_match (arg_types, nargs, tstr, 1 /* method */ , 0 /* strict match */ , @@ -1146,9 +1146,9 @@ evaluate_subexp_standard (struct type *expect_type, /* value_struct_elt updates temp with the correct value 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_EMBEDDED_OFFSET (temp)); + arg2 = value_from_longest (lookup_pointer_type(value_type (temp)), + VALUE_ADDRESS (temp) + value_offset (temp) + + VALUE_EMBEDDED_OFFSET (temp)); argvec[1] = arg2; /* the ``this'' pointer */ } @@ -1179,7 +1179,7 @@ evaluate_subexp_standard (struct type *expect_type, /* Prepare list of argument types for overload resolution */ arg_types = (struct type **) alloca (nargs * (sizeof (struct type *))); for (ix = 1; ix <= nargs; ix++) - arg_types[ix - 1] = VALUE_TYPE (argvec[ix]); + arg_types[ix - 1] = value_type (argvec[ix]); (void) find_overload_match (arg_types, nargs, NULL /* no need for name */ , 0 /* not method */ , 0 /* strict match */ , @@ -1218,10 +1218,10 @@ evaluate_subexp_standard (struct type *expect_type, it won't offer it. */ struct type *ftype = - TYPE_TARGET_TYPE (VALUE_TYPE (argvec[0])); + TYPE_TARGET_TYPE (value_type (argvec[0])); if (ftype) - return allocate_value (TYPE_TARGET_TYPE (VALUE_TYPE (argvec[0]))); + return allocate_value (TYPE_TARGET_TYPE (value_type (argvec[0]))); else error ("Expression of type other than \"Function returning ...\" used as function"); } @@ -1242,7 +1242,7 @@ evaluate_subexp_standard (struct type *expect_type, /* First determine the type code we are dealing with. */ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - type = check_typedef (VALUE_TYPE (arg1)); + type = check_typedef (value_type (arg1)); code = TYPE_CODE (type); switch (code) @@ -1306,7 +1306,7 @@ evaluate_subexp_standard (struct type *expect_type, if (noside == EVAL_SKIP) goto nosideret; if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (lookup_struct_elt_type (VALUE_TYPE (arg1), + return value_zero (lookup_struct_elt_type (value_type (arg1), &exp->elts[pc + 2].string, 0), lval_memory); @@ -1328,7 +1328,7 @@ evaluate_subexp_standard (struct type *expect_type, with rtti type in order to continue on with successful lookup of member / method only available in the rtti type. */ { - struct type *type = VALUE_TYPE (arg1); + struct type *type = value_type (arg1); struct type *real_type; int full, top, using_enc; @@ -1349,7 +1349,7 @@ evaluate_subexp_standard (struct type *expect_type, } if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (lookup_struct_elt_type (VALUE_TYPE (arg1), + return value_zero (lookup_struct_elt_type (value_type (arg1), &exp->elts[pc + 2].string, 0), lval_memory); @@ -1366,8 +1366,8 @@ evaluate_subexp_standard (struct type *expect_type, /* With HP aCC, pointers to methods do not point to the function code */ if (deprecated_hp_som_som_object_present && - (TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_PTR) && - (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))) == TYPE_CODE_METHOD)) + (TYPE_CODE (value_type (arg2)) == TYPE_CODE_PTR) && + (TYPE_CODE (TYPE_TARGET_TYPE (value_type (arg2))) == TYPE_CODE_METHOD)) error ("Pointers to methods not supported with HP aCC"); /* 1997-08-19 */ mem_offset = value_as_long (arg2); @@ -1379,8 +1379,8 @@ evaluate_subexp_standard (struct type *expect_type, /* With HP aCC, pointers to methods do not point to the function code */ if (deprecated_hp_som_som_object_present && - (TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_PTR) && - (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))) == TYPE_CODE_METHOD)) + (TYPE_CODE (value_type (arg2)) == TYPE_CODE_PTR) && + (TYPE_CODE (TYPE_TARGET_TYPE (value_type (arg2))) == TYPE_CODE_METHOD)) error ("Pointers to methods not supported with HP aCC"); /* 1997-08-19 */ mem_offset = value_as_long (arg2); @@ -1396,7 +1396,7 @@ evaluate_subexp_standard (struct type *expect_type, } if (noside == EVAL_SKIP) goto nosideret; - type = check_typedef (VALUE_TYPE (arg2)); + type = check_typedef (value_type (arg2)); if (TYPE_CODE (type) != TYPE_CODE_PTR) goto bad_pointer_to_member; type = check_typedef (TYPE_TARGET_TYPE (type)); @@ -1425,7 +1425,7 @@ evaluate_subexp_standard (struct type *expect_type, case BINOP_ASSIGN: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); /* Do special stuff for HP aCC pointers to members */ if (deprecated_hp_som_som_object_present) @@ -1434,13 +1434,13 @@ evaluate_subexp_standard (struct type *expect_type, the implementation yet; but the pointer appears to point to a code sequence (thunk) in memory -- in any case it is *not* the address of the function as it would be in a naive implementation. */ - if ((TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR) && - (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_METHOD)) + if ((TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR) && + (TYPE_CODE (TYPE_TARGET_TYPE (value_type (arg1))) == TYPE_CODE_METHOD)) error ("Assignment to pointers to methods not implemented with HP aCC"); /* HP aCC pointers to data members require a constant bias */ - if ((TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR) && - (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_MEMBER)) + if ((TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR) && + (TYPE_CODE (TYPE_TARGET_TYPE (value_type (arg1))) == TYPE_CODE_MEMBER)) { unsigned int *ptr = (unsigned int *) VALUE_CONTENTS (arg2); /* forces evaluation */ *ptr |= 0x20000000; /* set 29th bit */ @@ -1457,7 +1457,7 @@ evaluate_subexp_standard (struct type *expect_type, case BINOP_ASSIGN_MODIFY: (*pos) += 2; arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) return arg1; op = exp->elts[pc + 1].opcode; @@ -1508,7 +1508,7 @@ evaluate_subexp_standard (struct type *expect_type, return value_x_binop (arg1, arg2, op, OP_NULL, noside); else if (noside == EVAL_AVOID_SIDE_EFFECTS && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD)) - return value_zero (VALUE_TYPE (arg1), not_lval); + return value_zero (value_type (arg1), not_lval); else return value_binop (arg1, arg2, op); @@ -1533,7 +1533,7 @@ evaluate_subexp_standard (struct type *expect_type, then report this as an error. */ arg1 = coerce_ref (arg1); - type = check_typedef (VALUE_TYPE (arg1)); + type = check_typedef (value_type (arg1)); if (TYPE_CODE (type) != TYPE_CODE_ARRAY && TYPE_CODE (type) != TYPE_CODE_PTR) { @@ -1583,7 +1583,7 @@ evaluate_subexp_standard (struct type *expect_type, type (like a plain int variable for example), then report this as an error. */ - type = TYPE_TARGET_TYPE (check_typedef (VALUE_TYPE (arg1))); + type = TYPE_TARGET_TYPE (check_typedef (value_type (arg1))); if (type != NULL) { arg1 = value_zero (type, VALUE_LVAL (arg1)); @@ -1593,7 +1593,7 @@ evaluate_subexp_standard (struct type *expect_type, else { error ("cannot subscript something of type `%s'", - TYPE_NAME (VALUE_TYPE (arg1))); + TYPE_NAME (value_type (arg1))); } } @@ -1619,7 +1619,7 @@ evaluate_subexp_standard (struct type *expect_type, if (nargs > MAX_FORTRAN_DIMS) error ("Too many subscripts for F77 (%d Max)", MAX_FORTRAN_DIMS); - tmp_type = check_typedef (VALUE_TYPE (arg1)); + tmp_type = check_typedef (value_type (arg1)); ndimensions = calc_f77_array_dims (type); if (nargs != ndimensions) @@ -1688,7 +1688,7 @@ evaluate_subexp_standard (struct type *expect_type, type, this will ensure that value_subscript() returns the correct type value */ - VALUE_TYPE (arg1) = tmp_type; + arg1->type = tmp_type; return value_ind (value_add (value_coerce_array (arg1), arg2)); } @@ -1746,7 +1746,7 @@ evaluate_subexp_standard (struct type *expect_type, case BINOP_EQUAL: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; if (binop_user_defined_p (op, arg1, arg2)) @@ -1761,7 +1761,7 @@ evaluate_subexp_standard (struct type *expect_type, case BINOP_NOTEQUAL: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; if (binop_user_defined_p (op, arg1, arg2)) @@ -1776,7 +1776,7 @@ evaluate_subexp_standard (struct type *expect_type, case BINOP_LESS: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; if (binop_user_defined_p (op, arg1, arg2)) @@ -1791,7 +1791,7 @@ evaluate_subexp_standard (struct type *expect_type, case BINOP_GTR: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; if (binop_user_defined_p (op, arg1, arg2)) @@ -1806,7 +1806,7 @@ evaluate_subexp_standard (struct type *expect_type, case BINOP_GEQ: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; if (binop_user_defined_p (op, arg1, arg2)) @@ -1821,7 +1821,7 @@ evaluate_subexp_standard (struct type *expect_type, case BINOP_LEQ: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; if (binop_user_defined_p (op, arg1, arg2)) @@ -1839,12 +1839,12 @@ evaluate_subexp_standard (struct type *expect_type, arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - type = check_typedef (VALUE_TYPE (arg2)); + type = check_typedef (value_type (arg2)); if (TYPE_CODE (type) != TYPE_CODE_INT) error ("Non-integral right operand for \"@\" operator."); if (noside == EVAL_AVOID_SIDE_EFFECTS) { - return allocate_repeat_value (VALUE_TYPE (arg1), + return allocate_repeat_value (value_type (arg1), longest_to_int (value_as_long (arg2))); } else @@ -1889,9 +1889,9 @@ evaluate_subexp_standard (struct type *expect_type, if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR) expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); arg1 = evaluate_subexp (expect_type, exp, pos, noside); - if ((TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) && - ((TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_METHOD) || - (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_MEMBER))) + if ((TYPE_TARGET_TYPE (value_type (arg1))) && + ((TYPE_CODE (TYPE_TARGET_TYPE (value_type (arg1))) == TYPE_CODE_METHOD) || + (TYPE_CODE (TYPE_TARGET_TYPE (value_type (arg1))) == TYPE_CODE_MEMBER))) error ("Attempt to dereference pointer to member without an object"); if (noside == EVAL_SKIP) goto nosideret; @@ -1899,7 +1899,7 @@ evaluate_subexp_standard (struct type *expect_type, return value_x_unop (arg1, op, noside); else if (noside == EVAL_AVOID_SIDE_EFFECTS) { - type = check_typedef (VALUE_TYPE (arg1)); + type = check_typedef (value_type (arg1)); if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF /* In C you can dereference an array to get the 1st elt. */ @@ -1936,8 +1936,8 @@ evaluate_subexp_standard (struct type *expect_type, struct value *retvalp = evaluate_subexp_for_address (exp, pos, noside); /* If HP aCC object, use bias for pointers to members */ if (deprecated_hp_som_som_object_present && - (TYPE_CODE (VALUE_TYPE (retvalp)) == TYPE_CODE_PTR) && - (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (retvalp))) == TYPE_CODE_MEMBER)) + (TYPE_CODE (value_type (retvalp)) == TYPE_CODE_PTR) && + (TYPE_CODE (TYPE_TARGET_TYPE (value_type (retvalp))) == TYPE_CODE_MEMBER)) { unsigned int *ptr = (unsigned int *) VALUE_CONTENTS (retvalp); /* forces evaluation */ *ptr |= 0x20000000; /* set 29th bit */ @@ -1959,7 +1959,7 @@ evaluate_subexp_standard (struct type *expect_type, arg1 = evaluate_subexp (type, exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - if (type != VALUE_TYPE (arg1)) + if (type != value_type (arg1)) arg1 = value_cast (type, arg1); return arg1; @@ -2130,7 +2130,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos, { struct value *x = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (VALUE_LVAL (x) == lval_memory) - return value_zero (lookup_pointer_type (VALUE_TYPE (x)), + return value_zero (lookup_pointer_type (value_type (x)), not_lval); else error ("Attempt to take address of non-lval"); @@ -2209,7 +2209,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) case UNOP_IND: (*pos)++; val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); - type = check_typedef (VALUE_TYPE (val)); + type = check_typedef (value_type (val)); if (TYPE_CODE (type) != TYPE_CODE_PTR && TYPE_CODE (type) != TYPE_CODE_REF && TYPE_CODE (type) != TYPE_CODE_ARRAY) @@ -2233,7 +2233,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) default: val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); return value_from_longest (builtin_type_int, - (LONGEST) TYPE_LENGTH (VALUE_TYPE (val))); + (LONGEST) TYPE_LENGTH (value_type (val))); } } diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index bffb710..24f7b3d 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -443,7 +443,7 @@ f_val_print (struct type *type, char *valaddr, int embedded_offset, (TYPE_TARGET_TYPE (type), unpack_pointer (lookup_pointer_type (builtin_type_void), valaddr + embedded_offset)); - val_print (VALUE_TYPE (deref_val), + val_print (value_type (deref_val), VALUE_CONTENTS (deref_val), 0, VALUE_ADDRESS (deref_val), diff --git a/gdb/findvar.c b/gdb/findvar.c index 0e8da56..5ebc6e5 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -722,10 +722,10 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG && len < register_size (current_gdbarch, regnum)) /* Big-endian, and we want less than full size. */ - VALUE_OFFSET (v) = register_size (current_gdbarch, regnum) - len; + v->offset = register_size (current_gdbarch, regnum) - len; else - VALUE_OFFSET (v) = 0; - memcpy (VALUE_CONTENTS_RAW (v), value_bytes + VALUE_OFFSET (v), len); + v->offset = 0; + memcpy (VALUE_CONTENTS_RAW (v), value_bytes + value_offset (v), len); } return v; } diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index 8cb2a7e..b89bdb9 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -92,7 +92,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, struct type * type, int offset) { struct value *arg1 = *arg1p; - struct type *type1 = check_typedef (VALUE_TYPE (arg1)); + struct type *type1 = check_typedef (value_type (arg1)); struct type *entry_type; @@ -119,7 +119,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, { struct value *tmp = value_cast (context, value_addr (arg1)); arg1 = value_ind (tmp); - type1 = check_typedef (VALUE_TYPE (arg1)); + type1 = check_typedef (value_type (arg1)); } context = type1; @@ -138,8 +138,8 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, /* With older versions of g++, the vtbl field pointed to an array of structures. Nowadays it points directly to the structure. */ - if (TYPE_CODE (VALUE_TYPE (vtbl)) == TYPE_CODE_PTR - && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (vtbl))) == TYPE_CODE_ARRAY) + if (TYPE_CODE (value_type (vtbl)) == TYPE_CODE_PTR + && TYPE_CODE (TYPE_TARGET_TYPE (value_type (vtbl))) == TYPE_CODE_ARRAY) { /* Handle the case where the vtbl field points to an array of structures. */ @@ -158,12 +158,12 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, entry = value_ind (vtbl); } - entry_type = check_typedef (VALUE_TYPE (entry)); + entry_type = check_typedef (value_type (entry)); if (TYPE_CODE (entry_type) == TYPE_CODE_STRUCT) { /* Move the `this' pointer according to the virtual function table. */ - VALUE_OFFSET (arg1) += value_as_long (value_field (entry, 0)); + arg1->offset += value_as_long (value_field (entry, 0)); if (!VALUE_LAZY (arg1)) { @@ -178,7 +178,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, else error ("I'm confused: virtual function table has bad type"); /* Reinstantiate the function pointer with the correct type. */ - VALUE_TYPE (vfn) = lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j)); + vfn->type = lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j)); *arg1p = arg1; return vfn; @@ -208,7 +208,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) *using_enc = 0; /* Get declared type */ - known_type = VALUE_TYPE (v); + known_type = value_type (v); CHECK_TYPEDEF (known_type); /* RTTI works only or class objects */ if (TYPE_CODE (known_type) != TYPE_CODE_CLASS) diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index bf5218b..3fead2a 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -191,7 +191,7 @@ gnuv3_rtti_type (struct value *value, { struct type *vtable_type = gdbarch_data (current_gdbarch, vtable_type_gdbarch_data); - struct type *value_type = check_typedef (VALUE_TYPE (value)); + struct type *values_type = check_typedef (value_type (value)); CORE_ADDR vtable_address; struct value *vtable; struct minimal_symbol *vtable_symbol; @@ -202,13 +202,13 @@ gnuv3_rtti_type (struct value *value, LONGEST offset_to_top; /* We only have RTTI for class objects. */ - if (TYPE_CODE (value_type) != TYPE_CODE_CLASS) + if (TYPE_CODE (values_type) != TYPE_CODE_CLASS) return NULL; - /* If we can't find the virtual table pointer for value_type, we + /* If we can't find the virtual table pointer for values_type, we can't find the RTTI. */ - fill_in_vptr_fieldno (value_type); - if (TYPE_VPTR_FIELDNO (value_type) == -1) + fill_in_vptr_fieldno (values_type); + if (TYPE_VPTR_FIELDNO (values_type) == -1) return NULL; if (using_enc_p) @@ -216,22 +216,22 @@ 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. */ - base_type = check_typedef (TYPE_VPTR_BASETYPE (value_type)); - if (value_type != base_type) + base_type = check_typedef (TYPE_VPTR_BASETYPE (values_type)); + if (values_type != base_type) { value = value_cast (base_type, value); if (using_enc_p) *using_enc_p = 1; } vtable_address - = value_as_address (value_field (value, TYPE_VPTR_FIELDNO (value_type))); + = value_as_address (value_field (value, TYPE_VPTR_FIELDNO (values_type))); vtable = value_at_lazy (vtable_type, vtable_address - vtable_address_point_offset ()); /* Find the linker symbol for this vtable. */ vtable_symbol = lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtable) - + VALUE_OFFSET (vtable) + + value_offset (vtable) + VALUE_EMBEDDED_OFFSET (vtable)); if (! vtable_symbol) return NULL; @@ -246,7 +246,7 @@ gnuv3_rtti_type (struct value *value, || strncmp (vtable_symbol_name, "vtable for ", 11)) { warning ("can't find linker symbol for virtual table for `%s' value", - TYPE_NAME (value_type)); + TYPE_NAME (values_type)); if (vtable_symbol_name) warning (" found `%s' instead", vtable_symbol_name); return NULL; @@ -283,14 +283,14 @@ gnuv3_virtual_fn_field (struct value **value_p, struct type *vtable_type = gdbarch_data (current_gdbarch, vtable_type_gdbarch_data); struct value *value = *value_p; - struct type *value_type = check_typedef (VALUE_TYPE (value)); + struct type *values_type = check_typedef (value_type (value)); struct type *vfn_base; CORE_ADDR vtable_address; struct value *vtable; struct value *vfn; /* Some simple sanity checks. */ - if (TYPE_CODE (value_type) != TYPE_CODE_CLASS) + if (TYPE_CODE (values_type) != TYPE_CODE_CLASS) error ("Only classes can have virtual functions."); /* Find the base class that defines this virtual function. */ @@ -314,7 +314,7 @@ gnuv3_virtual_fn_field (struct value **value_p, /* Now that we know which base class is defining our virtual function, cast our value to that baseclass. This takes care of any necessary `this' adjustments. */ - if (vfn_base != value_type) + if (vfn_base != values_type) value = value_cast (vfn_base, value); /* Now value is an object of the appropriate base type. Fetch its diff --git a/gdb/hpacc-abi.c b/gdb/hpacc-abi.c index 27cc94b..a9dcdbf 100644 --- a/gdb/hpacc-abi.c +++ b/gdb/hpacc-abi.c @@ -85,7 +85,7 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, struct type * type, int offset) { struct value *arg1 = *arg1p; - struct type *type1 = check_typedef (VALUE_TYPE (arg1)); + struct type *type1 = check_typedef (value_type (arg1)); /* Deal with HP/Taligent runtime model for virtual functions */ struct value *vp; @@ -166,7 +166,7 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, /* Wrap this addr in a value and return pointer */ vp = allocate_value (ftype); - VALUE_TYPE (vp) = ftype; + vp->type = ftype; VALUE_ADDRESS (vp) = coreptr; /* pai: (temp) do we need the value_ind stuff in value_fn_field? */ @@ -193,7 +193,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) *using_enc = 0; /* Get declared type */ - known_type = VALUE_TYPE (v); + known_type = value_type (v); CHECK_TYPEDEF (known_type); /* RTTI works only or class objects */ if (TYPE_CODE (known_type) != TYPE_CODE_CLASS) @@ -218,7 +218,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) /* First get the virtual table address */ coreptr = *(CORE_ADDR *) ((VALUE_CONTENTS_ALL (v)) - + VALUE_OFFSET (v) + + value_offset (v) + (using_enclosing ? 0 : VALUE_EMBEDDED_OFFSET (v))); diff --git a/gdb/infcall.c b/gdb/infcall.c index ef36935..0f677cc 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -85,7 +85,7 @@ static struct value * value_arg_coerce (struct value *arg, struct type *param_type, int is_prototyped) { - struct type *arg_type = check_typedef (VALUE_TYPE (arg)); + struct type *arg_type = check_typedef (value_type (arg)); struct type *type = param_type ? check_typedef (param_type) : arg_type; @@ -96,7 +96,7 @@ value_arg_coerce (struct value *arg, struct type *param_type, && TYPE_CODE (arg_type) != TYPE_CODE_PTR) { arg = value_addr (arg); - VALUE_TYPE (arg) = param_type; + arg->type = param_type; return arg; } break; @@ -162,7 +162,7 @@ value_arg_coerce (struct value *arg, struct type *param_type, CORE_ADDR find_function_addr (struct value *function, struct type **retval_type) { - struct type *ftype = check_typedef (VALUE_TYPE (function)); + struct type *ftype = check_typedef (value_type (function)); enum type_code code = TYPE_CODE (ftype); struct type *value_type; CORE_ADDR funaddr; @@ -297,7 +297,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) { CORE_ADDR sp; CORE_ADDR dummy_addr; - struct type *value_type; + struct type *values_type; unsigned char struct_return; CORE_ADDR struct_addr = 0; struct regcache *retbuf; @@ -307,7 +307,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) CORE_ADDR funaddr; int using_gcc; /* Set to version of gcc in use, or zero if not gcc */ CORE_ADDR real_pc; - struct type *ftype = check_typedef (VALUE_TYPE (function)); + struct type *ftype = check_typedef (value_type (function)); CORE_ADDR bp_addr; struct regcache *caller_regcache; struct cleanup *caller_regcache_cleanup; @@ -401,8 +401,8 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) sp = old_sp; } - funaddr = find_function_addr (function, &value_type); - CHECK_TYPEDEF (value_type); + funaddr = find_function_addr (function, &values_type); + CHECK_TYPEDEF (values_type); { struct block *b = block_for_pc (funaddr); @@ -413,7 +413,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) /* Are we returning a value using a structure return or a normal value return? */ - struct_return = using_struct_return (value_type, using_gcc); + struct_return = using_struct_return (values_type, using_gcc); /* Determine the location of the breakpoint (and possibly other stuff) that the called function will return to. The SPARC, for a @@ -432,7 +432,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) if (INNER_THAN (1, 2)) { sp = push_dummy_code (current_gdbarch, sp, funaddr, - using_gcc, args, nargs, value_type, + using_gcc, args, nargs, values_type, &real_pc, &bp_addr); dummy_addr = sp; } @@ -440,7 +440,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) { dummy_addr = sp; sp = push_dummy_code (current_gdbarch, sp, funaddr, - using_gcc, args, nargs, value_type, + using_gcc, args, nargs, values_type, &real_pc, &bp_addr); } break; @@ -556,7 +556,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name); pointer to the structure, not the structure itself. */ for (i = nargs - 1; i >= 0; i--) { - struct type *arg_type = check_typedef (VALUE_TYPE (args[i])); + struct type *arg_type = check_typedef (value_type (args[i])); if ((TYPE_CODE (arg_type) == TYPE_CODE_STRUCT || TYPE_CODE (arg_type) == TYPE_CODE_UNION || TYPE_CODE (arg_type) == TYPE_CODE_ARRAY @@ -594,7 +594,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name); write_memory (addr, VALUE_CONTENTS_ALL (args[i]), len); /* The value we're going to pass is the address of the thing we just pushed. */ - /*args[i] = value_from_longest (lookup_pointer_type (value_type), + /*args[i] = value_from_longest (lookup_pointer_type (values_type), (LONGEST) addr); */ args[i] = value_from_pointer (lookup_pointer_type (arg_type), addr); @@ -609,7 +609,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name); if (struct_return) { - int len = TYPE_LENGTH (value_type); + int len = TYPE_LENGTH (values_type); if (INNER_THAN (1, 2)) { /* Stack grows downward. Align STRUCT_ADDR and SP after @@ -839,10 +839,10 @@ the function call).", name); /* Figure out the value returned by the function, return that. */ { struct value *retval; - if (TYPE_CODE (value_type) == TYPE_CODE_VOID) + if (TYPE_CODE (values_type) == TYPE_CODE_VOID) /* If the function returns void, don't bother fetching the return value. */ - retval = allocate_value (value_type); + retval = allocate_value (values_type); else if (struct_return) /* NOTE: cagney/2003-09-27: This assumes that PUSH_DUMMY_CALL has correctly stored STRUCT_ADDR in the target. In the past @@ -852,15 +852,15 @@ the function call).", name); you're seeing problems with values being returned using the "struct return convention", check that PUSH_DUMMY_CALL isn't playing tricks. */ - retval = value_at (value_type, struct_addr); + retval = value_at (values_type, struct_addr); else { /* This code only handles "register convention". */ - retval = allocate_value (value_type); - gdb_assert (gdbarch_return_value (current_gdbarch, value_type, + retval = allocate_value (values_type); + gdb_assert (gdbarch_return_value (current_gdbarch, values_type, NULL, NULL, NULL) == RETURN_VALUE_REGISTER_CONVENTION); - gdbarch_return_value (current_gdbarch, value_type, retbuf, + gdbarch_return_value (current_gdbarch, values_type, retbuf, VALUE_CONTENTS_RAW (retval) /*read*/, NULL /*write*/); } diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index bf15d53..cd7c326 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -210,8 +210,8 @@ get_java_utf8_name (struct obstack *obstack, struct value *name) 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) + value_offset (temp) + + TYPE_LENGTH (value_type (temp)); chrs = obstack_alloc (obstack, name_length + 1); chrs[name_length] = '\0'; read_memory (data_addr, chrs, name_length); @@ -225,8 +225,8 @@ java_class_from_object (struct value *obj_val) class are fixed. FIXME */ struct value *vtable_val; - if (TYPE_CODE (VALUE_TYPE (obj_val)) == TYPE_CODE_PTR - && TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (obj_val))) == 0) + 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_address (obj_val)); @@ -259,14 +259,14 @@ type_from_class (struct value *clas) struct dict_iterator iter; int is_array = 0; - type = check_typedef (VALUE_TYPE (clas)); + type = check_typedef (value_type (clas)); if (TYPE_CODE (type) == TYPE_CODE_PTR) { if (value_logical_not (clas)) return NULL; clas = value_ind (clas); } - addr = VALUE_ADDRESS (clas) + VALUE_OFFSET (clas); + addr = VALUE_ADDRESS (clas) + value_offset (clas); #if 0 get_java_class_symtab (); @@ -318,7 +318,7 @@ type_from_class (struct value *clas) temp = clas; /* Set array element type. */ temp = value_struct_elt (&temp, NULL, "methods", NULL, "structure"); - VALUE_TYPE (temp) = lookup_pointer_type (VALUE_TYPE (clas)); + temp->type = lookup_pointer_type (value_type (clas)); TYPE_TARGET_TYPE (type) = type_from_class (temp); } @@ -421,9 +421,9 @@ java_link_class_type (struct type *type, struct value *clas) fields = NULL; nfields--; /* First set up dummy "class" field. */ SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), - VALUE_ADDRESS (clas) + VALUE_OFFSET (clas)); + VALUE_ADDRESS (clas) + value_offset (clas)); TYPE_FIELD_NAME (type, nfields) = "class"; - TYPE_FIELD_TYPE (type, nfields) = VALUE_TYPE (clas); + TYPE_FIELD_TYPE (type, nfields) = value_type (clas); SET_TYPE_FIELD_PRIVATE (type, nfields); for (i = TYPE_N_BASECLASSES (type); i < nfields; i++) @@ -438,7 +438,7 @@ java_link_class_type (struct type *type, struct value *clas) } else { /* Re-use field value for next field. */ - VALUE_ADDRESS (field) += TYPE_LENGTH (VALUE_TYPE (field)); + VALUE_ADDRESS (field) += TYPE_LENGTH (value_type (field)); VALUE_LAZY (field) = 1; } temp = field; @@ -508,7 +508,7 @@ java_link_class_type (struct type *type, struct value *clas) } else { /* Re-use method value for next method. */ - VALUE_ADDRESS (method) += TYPE_LENGTH (VALUE_TYPE (method)); + VALUE_ADDRESS (method) += TYPE_LENGTH (value_type (method)); VALUE_LAZY (method) = 1; } @@ -846,7 +846,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp, goto standard; (*pos)++; arg1 = evaluate_subexp_java (NULL_TYPE, exp, pos, EVAL_NORMAL); - if (is_object_type (VALUE_TYPE (arg1))) + if (is_object_type (value_type (arg1))) { struct type *type; @@ -868,7 +868,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp, then report this as an error. */ arg1 = coerce_ref (arg1); - type = check_typedef (VALUE_TYPE (arg1)); + type = check_typedef (value_type (arg1)); if (TYPE_CODE (type) == TYPE_CODE_PTR) type = check_typedef (TYPE_TARGET_TYPE (type)); name = TYPE_NAME (type); @@ -888,7 +888,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp, /* Get CLASS_ELEMENT_TYPE of the array type. */ temp = value_struct_elt (&temp, NULL, "methods", NULL, "structure"); - VALUE_TYPE (temp) = VALUE_TYPE (clas); + temp->type = value_type (clas); el_type = type_from_class (temp); if (TYPE_CODE (el_type) == TYPE_CODE_STRUCT) el_type = lookup_pointer_type (el_type); @@ -929,7 +929,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp, case STRUCTOP_STRUCT: arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside); /* Convert object field (such as TYPE.class) to reference. */ - if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_STRUCT) + if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_STRUCT) arg1 = value_addr (arg1); return arg1; default: diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c index 03e5cdd..3de15ec 100644 --- a/gdb/jv-valprint.c +++ b/gdb/jv-valprint.c @@ -52,8 +52,8 @@ java_value_print (struct value *val, struct ui_file *stream, int format, int i; char *name; - type = VALUE_TYPE (val); - address = VALUE_ADDRESS (val) + VALUE_OFFSET (val); + type = value_type (val); + address = VALUE_ADDRESS (val) + value_offset (val); if (is_object_type (type)) { @@ -170,15 +170,15 @@ java_value_print (struct value *val, struct ui_file *stream, int format, else { VALUE_LAZY (v) = 1; - VALUE_OFFSET (v) = 0; + v->offset = 0; } - VALUE_OFFSET (next_v) = VALUE_OFFSET (v); + next_v->offset = value_offset (v); for (reps = 1; i + reps < length; reps++) { VALUE_LAZY (next_v) = 1; - VALUE_OFFSET (next_v) += TYPE_LENGTH (el_type); + next_v->offset += TYPE_LENGTH (el_type); if (memcmp (VALUE_CONTENTS (v), VALUE_CONTENTS (next_v), TYPE_LENGTH (el_type)) != 0) break; @@ -189,7 +189,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format, else fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1); - val_print (VALUE_TYPE (v), VALUE_CONTENTS (v), 0, 0, + val_print (value_type (v), VALUE_CONTENTS (v), 0, 0, stream, format, 2, 1, pretty); things_printed++; @@ -408,10 +408,10 @@ java_print_value_fields (struct type *type, char *valaddr, CORE_ADDR address, fputs_filtered ("<optimized out>", stream); else { - struct type *t = check_typedef (VALUE_TYPE (v)); + struct type *t = check_typedef (value_type (v)); if (TYPE_CODE (t) == TYPE_CODE_STRUCT) v = value_addr (v); - val_print (VALUE_TYPE (v), + val_print (value_type (v), VALUE_CONTENTS (v), 0, VALUE_ADDRESS (v), stream, format, 0, recurse + 1, pretty); } diff --git a/gdb/linespec.c b/gdb/linespec.c index 1371f02..b1f82a7 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1663,7 +1663,7 @@ decode_dollar (char *copy, int funfirstline, struct symtab *default_symtab, /* We have a value history reference. */ sscanf ((copy[1] == '$') ? copy + 2 : copy + 1, "%d", &index); valx = access_value_history ((copy[1] == '$') ? -index : index); - if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT) + if (TYPE_CODE (value_type (valx)) != TYPE_CODE_INT) error ("History values used in line specs must have integer values."); } else @@ -1689,7 +1689,7 @@ decode_dollar (char *copy, int funfirstline, struct symtab *default_symtab, /* Not a user variable or function -- must be convenience variable. */ need_canonical = (file_symtab == 0) ? 1 : 0; valx = value_of_internalvar (lookup_internalvar (copy + 1)); - if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT) + if (TYPE_CODE (value_type (valx)) != TYPE_CODE_INT) error ("Convenience variables used in line specs must have integer values."); } diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 74336ab..e7c5701 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -679,7 +679,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc) val = evaluate_expression (expr); /* Print the result of the expression evaluation. */ - val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), + val_print (value_type (val), VALUE_CONTENTS (val), VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val), stb->stream, 0, 0, 0, 0); diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 14c71bc..9252312 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -203,7 +203,7 @@ value_nsstring (char *ptr, int len) else error ("NSString: internal error -- no way to create new NSString"); - VALUE_TYPE(nsstringValue) = type; + nsstringValue->type = type; return nsstringValue; } diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 8b0c950..e320c19 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -238,7 +238,7 @@ pascal_val_print (struct type *type, char *valaddr, int embedded_offset, wtype = TYPE_TARGET_TYPE (type); } vt_val = value_at (wtype, vt_address); - val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val), 0, + val_print (value_type (vt_val), VALUE_CONTENTS (vt_val), 0, VALUE_ADDRESS (vt_val), stream, format, deref_ref, recurse + 1, pretty); if (pretty) @@ -290,7 +290,7 @@ pascal_val_print (struct type *type, char *valaddr, int embedded_offset, (TYPE_TARGET_TYPE (type), unpack_pointer (lookup_pointer_type (builtin_type_void), valaddr + embedded_offset)); - val_print (VALUE_TYPE (deref_val), + val_print (value_type (deref_val), VALUE_CONTENTS (deref_val), 0, VALUE_ADDRESS (deref_val), stream, format, deref_ref, recurse + 1, pretty); @@ -537,7 +537,7 @@ int pascal_value_print (struct value *val, struct ui_file *stream, int format, enum val_prettyprint pretty) { - struct type *type = VALUE_TYPE (val); + struct type *type = value_type (val); /* If it is a pointer, indicate what it points to. @@ -565,7 +565,7 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format, } } return val_print (type, VALUE_CONTENTS (val), VALUE_EMBEDDED_OFFSET (val), - VALUE_ADDRESS (val) + VALUE_OFFSET (val), + VALUE_ADDRESS (val) + value_offset (val), stream, format, 1, 0, pretty); } diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index cdf2855..7913c2c 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -97,7 +97,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (argno = 0; argno < nargs; argno++) { struct value *arg = args[argno]; - struct type *type = check_typedef (VALUE_TYPE (arg)); + struct type *type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (type); char *val = VALUE_CONTENTS (arg); @@ -634,7 +634,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (argno = 0; argno < nargs; argno++) { struct value *arg = args[argno]; - struct type *type = check_typedef (VALUE_TYPE (arg)); + struct type *type = check_typedef (value_type (arg)); char *val = VALUE_CONTENTS (arg); if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) <= 8) { diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 7f683d5..6ca1f6b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -275,7 +275,7 @@ static void print_formatted (struct value *val, int format, int size, struct ui_file *stream) { - struct type *type = check_typedef (VALUE_TYPE (val)); + struct type *type = check_typedef (value_type (val)); int len = TYPE_LENGTH (type); if (VALUE_LVAL (val) == lval_memory) @@ -888,15 +888,15 @@ print_command_1 (char *exp, int inspect, int voidprint) else val = access_value_history (0); - if (voidprint || (val && VALUE_TYPE (val) && - TYPE_CODE (VALUE_TYPE (val)) != TYPE_CODE_VOID)) + if (voidprint || (val && value_type (val) && + TYPE_CODE (value_type (val)) != TYPE_CODE_VOID)) { int histindex = record_latest_value (val); if (histindex >= 0) - annotate_value_history_begin (histindex, VALUE_TYPE (val)); + annotate_value_history_begin (histindex, value_type (val)); else - annotate_value_begin (VALUE_TYPE (val)); + annotate_value_begin (value_type (val)); if (inspect) printf_unfiltered ("\031(gdb-makebuffer \"%s\" %d '(\"", exp, histindex); @@ -967,7 +967,7 @@ output_command (char *exp, int from_tty) val = evaluate_expression (expr); - annotate_value_begin (VALUE_TYPE (val)); + annotate_value_begin (value_type (val)); print_formatted (val, format, fmt.size, gdb_stdout); @@ -1283,12 +1283,12 @@ x_command (char *exp, int from_tty) *exp = 0; old_chain = make_cleanup (free_current_contents, &expr); val = evaluate_expression (expr); - if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF) + if (TYPE_CODE (value_type (val)) == TYPE_CODE_REF) val = value_ind (val); /* In rvalue contexts, such as this, functions are coerced into pointers to functions. This makes "x/i main" work. */ if (/* last_format == 'i' && */ - TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC + TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC && VALUE_LVAL (val) == lval_memory) next_address = VALUE_ADDRESS (val); else @@ -1308,7 +1308,7 @@ x_command (char *exp, int from_tty) /* Make last address examined available to the user as $_. Use the correct pointer type. */ struct type *pointer_type - = lookup_pointer_type (VALUE_TYPE (last_examine_value)); + = lookup_pointer_type (value_type (last_examine_value)); set_internalvar (lookup_internalvar ("_"), value_from_pointer (pointer_type, last_examine_address)); @@ -1902,11 +1902,11 @@ printf_command (char *arg, int from_tty) if (argclass[nargs] == double_arg) { - struct type *type = VALUE_TYPE (val_args[nargs]); + struct type *type = value_type (val_args[nargs]); if (TYPE_LENGTH (type) == sizeof (float)) - VALUE_TYPE (val_args[nargs]) = builtin_type_float; + val_args[nargs]->type = builtin_type_float; if (TYPE_LENGTH (type) == sizeof (double)) - VALUE_TYPE (val_args[nargs]) = builtin_type_double; + val_args[nargs]->type = builtin_type_double; } nargs++; s = s1; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index b5bb110..54842cd 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1472,7 +1472,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int reg_size = register_size (current_gdbarch, ii + 3); arg = args[argno]; - type = check_typedef (VALUE_TYPE (arg)); + type = check_typedef (value_type (arg)); len = TYPE_LENGTH (type); if (TYPE_CODE (type) == TYPE_CODE_FLT) @@ -1557,7 +1557,7 @@ ran_out_of_registers_for_arguments: for (; jj < nargs; ++jj) { struct value *val = args[jj]; - space += ((TYPE_LENGTH (VALUE_TYPE (val))) + 3) & -4; + space += ((TYPE_LENGTH (value_type (val))) + 3) & -4; } /* Add location required for the rest of the parameters. */ @@ -1589,7 +1589,7 @@ ran_out_of_registers_for_arguments: { arg = args[argno]; - type = check_typedef (VALUE_TYPE (arg)); + type = check_typedef (value_type (arg)); len = TYPE_LENGTH (type); diff --git a/gdb/scm-exp.c b/gdb/scm-exp.c index 41d78af..0de7428 100644 --- a/gdb/scm-exp.c +++ b/gdb/scm-exp.c @@ -310,10 +310,10 @@ tryagain: if (!skipping) { struct value *val = scm_evaluate_string (str.ptr, lexptr - str.ptr); - if (!is_scmvalue_type (VALUE_TYPE (val))) + if (!is_scmvalue_type (value_type (val))) error ("quoted scm form yields non-SCM value"); svalue = extract_signed_integer (VALUE_CONTENTS (val), - TYPE_LENGTH (VALUE_TYPE (val))); + TYPE_LENGTH (value_type (val))); goto handle_immediate; } return; diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c index 737bafa..1975409 100644 --- a/gdb/scm-valprint.c +++ b/gdb/scm-valprint.c @@ -390,6 +390,6 @@ int scm_value_print (struct value *val, struct ui_file *stream, int format, enum val_prettyprint pretty) { - return (val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, + return (val_print (value_type (val), VALUE_CONTENTS (val), 0, VALUE_ADDRESS (val), stream, format, 1, 0, pretty)); } diff --git a/gdb/stack.c b/gdb/stack.c index c7cded0..06a59cb 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -349,11 +349,11 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num, 2 for each recurse. */ val = read_var_value (sym, fi); - annotate_arg_value (val == NULL ? NULL : VALUE_TYPE (val)); + annotate_arg_value (val == NULL ? NULL : value_type (val)); if (val) { - val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, + val_print (value_type (val), VALUE_CONTENTS (val), 0, VALUE_ADDRESS (val), stb->stream, 0, 0, 2, Val_no_prettyprint); ui_out_field_stream (uiout, "value", stb); @@ -1897,7 +1897,7 @@ If you continue, the return value that you specified will be ignored.\n"; /* Store RETURN_VAUE in the just-returned register set. */ if (return_value != NULL) { - struct type *return_type = VALUE_TYPE (return_value); + struct type *return_type = value_type (return_value); gdb_assert (gdbarch_return_value (current_gdbarch, return_type, NULL, NULL, NULL) == RETURN_VALUE_REGISTER_CONVENTION); diff --git a/gdb/std-regs.c b/gdb/std-regs.c index 368720d..f11bb57 100644 --- a/gdb/std-regs.c +++ b/gdb/std-regs.c @@ -61,7 +61,7 @@ value_of_builtin_frame_reg (struct frame_info *frame) val = allocate_value (builtin_type_frame_reg); VALUE_LVAL (val) = not_lval; buf = VALUE_CONTENTS_RAW (val); - memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); + memset (buf, TYPE_LENGTH (value_type (val)), 0); /* frame.base. */ if (frame != NULL) ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, @@ -87,7 +87,7 @@ value_of_builtin_frame_fp_reg (struct frame_info *frame) struct value *val = allocate_value (builtin_type_void_data_ptr); char *buf = VALUE_CONTENTS_RAW (val); if (frame == NULL) - memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); + memset (buf, TYPE_LENGTH (value_type (val)), 0); else ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, get_frame_base_address (frame)); @@ -105,7 +105,7 @@ value_of_builtin_frame_pc_reg (struct frame_info *frame) struct value *val = allocate_value (builtin_type_void_data_ptr); char *buf = VALUE_CONTENTS_RAW (val); if (frame == NULL) - memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); + memset (buf, TYPE_LENGTH (value_type (val)), 0); else ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, get_frame_pc (frame)); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index cf064a7..5eceba7 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -292,7 +292,7 @@ set_traceframe_context (CORE_ADDR trace_pc) func_string = create_array_type (func_string, builtin_type_char, func_range); func_val = allocate_value (func_string); - VALUE_TYPE (func_val) = func_string; + func_val->type = func_string; memcpy (VALUE_CONTENTS_RAW (func_val), DEPRECATED_SYMBOL_NAME (traceframe_fun), len); @@ -313,7 +313,7 @@ set_traceframe_context (CORE_ADDR trace_pc) file_string = create_array_type (file_string, builtin_type_char, file_range); file_val = allocate_value (file_string); - VALUE_TYPE (file_val) = file_string; + file_val->type = file_string; memcpy (VALUE_CONTENTS_RAW (file_val), traceframe_sal.symtab->filename, len); @@ -1566,7 +1566,7 @@ encode_actions (struct tracepoint *t, char ***tdp_actions, 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) + value_offset (tempval); len = TYPE_LENGTH (check_typedef (exp->elts[1].type)); add_memrange (collect, -1, addr, len); break; diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 82ca5f1..9fc5855 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -133,7 +133,7 @@ whatis_exp (char *exp, int show) else val = access_value_history (0); - type = VALUE_TYPE (val); + type = value_type (val); if (objectprint) { @@ -341,7 +341,7 @@ maintenance_print_type (char *typename, int from_tty) /* The user expression may name a type indirectly by naming an object of that type. Find that indirectly named type. */ val = evaluate_type (expr); - type = VALUE_TYPE (val); + type = value_type (val); } if (type != NULL) { diff --git a/gdb/valarith.c b/gdb/valarith.c index 6fa5a9b..4fd0e74 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -93,8 +93,8 @@ value_add (struct value *arg1, struct value *arg2) arg1 = coerce_array (arg1); arg2 = coerce_array (arg2); - type1 = check_typedef (VALUE_TYPE (arg1)); - type2 = check_typedef (VALUE_TYPE (arg2)); + type1 = check_typedef (value_type (arg1)); + type2 = check_typedef (value_type (arg2)); if ((TYPE_CODE (type1) == TYPE_CODE_PTR || TYPE_CODE (type2) == TYPE_CODE_PTR) @@ -134,8 +134,8 @@ value_sub (struct value *arg1, struct value *arg2) struct type *type1, *type2; arg1 = coerce_array (arg1); arg2 = coerce_array (arg2); - type1 = check_typedef (VALUE_TYPE (arg1)); - type2 = check_typedef (VALUE_TYPE (arg2)); + type1 = check_typedef (value_type (arg1)); + type2 = check_typedef (value_type (arg2)); if (TYPE_CODE (type1) == TYPE_CODE_PTR) { @@ -183,7 +183,7 @@ value_subscript (struct value *array, struct value *idx) struct type *tarray; array = coerce_ref (array); - tarray = check_typedef (VALUE_TYPE (array)); + tarray = check_typedef (value_type (array)); if (TYPE_CODE (tarray) == TYPE_CODE_ARRAY || TYPE_CODE (tarray) == TYPE_CODE_STRING) @@ -233,13 +233,13 @@ value_subscript (struct value *array, struct value *idx) bit_index = index % TARGET_CHAR_BIT; byte >>= (BITS_BIG_ENDIAN ? TARGET_CHAR_BIT - 1 - bit_index : bit_index); v = value_from_longest (LA_BOOL_TYPE, byte & 1); - VALUE_BITPOS (v) = bit_index; - VALUE_BITSIZE (v) = 1; + v->bitpos = bit_index; + v->bitsize = 1; VALUE_LVAL (v) = VALUE_LVAL (array); if (VALUE_LVAL (array) == lval_internalvar) VALUE_LVAL (v) = lval_internalvar_component; VALUE_ADDRESS (v) = VALUE_ADDRESS (array); - VALUE_OFFSET (v) = offset + VALUE_OFFSET (array); + v->offset = offset + value_offset (array); return v; } @@ -256,7 +256,7 @@ value_subscript (struct value *array, struct value *idx) static struct value * value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound) { - struct type *array_type = check_typedef (VALUE_TYPE (array)); + struct type *array_type = check_typedef (value_type (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); unsigned int elt_size = TYPE_LENGTH (elt_type); LONGEST index = value_as_long (idx); @@ -278,7 +278,7 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound VALUE_LVAL (v) = VALUE_LVAL (array); VALUE_ADDRESS (v) = VALUE_ADDRESS (array); VALUE_REGNO (v) = VALUE_REGNO (array); - VALUE_OFFSET (v) = VALUE_OFFSET (array) + elt_offs; + v->offset = value_offset (array) + elt_offs; return v; } @@ -294,8 +294,8 @@ binop_user_defined_p (enum exp_opcode op, struct value *arg1, struct value *arg2 struct type *type1, *type2; if (op == BINOP_ASSIGN || op == BINOP_CONCAT) return 0; - type1 = check_typedef (VALUE_TYPE (arg1)); - type2 = check_typedef (VALUE_TYPE (arg2)); + type1 = check_typedef (value_type (arg1)); + type2 = check_typedef (value_type (arg2)); return (TYPE_CODE (type1) == TYPE_CODE_STRUCT || TYPE_CODE (type2) == TYPE_CODE_STRUCT || (TYPE_CODE (type1) == TYPE_CODE_REF @@ -316,7 +316,7 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1) struct type *type1; if (op == UNOP_ADDR) return 0; - type1 = check_typedef (VALUE_TYPE (arg1)); + type1 = check_typedef (value_type (arg1)); for (;;) { if (TYPE_CODE (type1) == TYPE_CODE_STRUCT) @@ -354,7 +354,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op, /* now we know that what we have to do is construct our arg vector and find the right function to call it with. */ - if (TYPE_CODE (check_typedef (VALUE_TYPE (arg1))) != TYPE_CODE_STRUCT) + if (TYPE_CODE (check_typedef (value_type (arg1))) != TYPE_CODE_STRUCT) error ("Can't do that binary op on that type"); /* FIXME be explicit */ argvec = (struct value **) alloca (sizeof (struct value *) * 4); @@ -483,7 +483,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op, { struct type *return_type; return_type - = TYPE_TARGET_TYPE (check_typedef (VALUE_TYPE (argvec[0]))); + = TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0]))); return value_zero (return_type, VALUE_LVAL (arg1)); } return call_function_by_hand (argvec[0], 2 - static_memfuncp, argvec + 1); @@ -514,7 +514,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) /* now we know that what we have to do is construct our arg vector and find the right function to call it with. */ - if (TYPE_CODE (check_typedef (VALUE_TYPE (arg1))) != TYPE_CODE_STRUCT) + if (TYPE_CODE (check_typedef (value_type (arg1))) != TYPE_CODE_STRUCT) error ("Can't do that unary op on that type"); /* FIXME be explicit */ argvec = (struct value **) alloca (sizeof (struct value *) * 4); @@ -578,7 +578,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) { struct type *return_type; return_type - = TYPE_TARGET_TYPE (check_typedef (VALUE_TYPE (argvec[0]))); + = TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0]))); return value_zero (return_type, VALUE_LVAL (arg1)); } return call_function_by_hand (argvec[0], nargs, argvec + 1); @@ -619,8 +619,8 @@ value_concat (struct value *arg1, struct value *arg2) int count, idx; char *ptr; char inchar; - struct type *type1 = check_typedef (VALUE_TYPE (arg1)); - struct type *type2 = check_typedef (VALUE_TYPE (arg2)); + struct type *type1 = check_typedef (value_type (arg1)); + struct type *type2 = check_typedef (value_type (arg2)); /* First figure out if we are dealing with two values to be concatenated or a repeat count and a value to be repeated. INVAL1 is set to the @@ -749,8 +749,8 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) arg1 = coerce_ref (arg1); arg2 = coerce_ref (arg2); - type1 = check_typedef (VALUE_TYPE (arg1)); - type2 = check_typedef (VALUE_TYPE (arg2)); + type1 = check_typedef (value_type (arg1)); + type2 = check_typedef (value_type (arg2)); if ((TYPE_CODE (type1) != TYPE_CODE_FLT && !is_integral_type (type1)) || @@ -804,7 +804,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) else val = allocate_value (builtin_type_double); - store_typed_floating (VALUE_CONTENTS_RAW (val), VALUE_TYPE (val), v); + store_typed_floating (VALUE_CONTENTS_RAW (val), value_type (val), v); } else if (TYPE_CODE (type1) == TYPE_CODE_BOOL && @@ -1014,7 +1014,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) ? builtin_type_unsigned_long_long : builtin_type_unsigned_long); store_unsigned_integer (VALUE_CONTENTS_RAW (val), - TYPE_LENGTH (VALUE_TYPE (val)), + TYPE_LENGTH (value_type (val)), v); } else @@ -1138,7 +1138,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) ? builtin_type_long_long : builtin_type_long); store_signed_integer (VALUE_CONTENTS_RAW (val), - TYPE_LENGTH (VALUE_TYPE (val)), + TYPE_LENGTH (value_type (val)), v); } } @@ -1156,7 +1156,7 @@ value_logical_not (struct value *arg1) struct type *type1; arg1 = coerce_number (arg1); - type1 = check_typedef (VALUE_TYPE (arg1)); + type1 = check_typedef (value_type (arg1)); if (TYPE_CODE (type1) == TYPE_CODE_FLT) return 0 == value_as_double (arg1); @@ -1179,8 +1179,8 @@ value_logical_not (struct value *arg1) static int value_strcmp (struct value *arg1, struct value *arg2) { - int len1 = TYPE_LENGTH (VALUE_TYPE (arg1)); - int len2 = TYPE_LENGTH (VALUE_TYPE (arg2)); + int len1 = TYPE_LENGTH (value_type (arg1)); + int len2 = TYPE_LENGTH (value_type (arg2)); char *s1 = VALUE_CONTENTS (arg1); char *s2 = VALUE_CONTENTS (arg2); int i, len = len1 < len2 ? len1 : len2; @@ -1219,8 +1219,8 @@ value_equal (struct value *arg1, struct value *arg2) arg1 = coerce_array (arg1); arg2 = coerce_array (arg2); - type1 = check_typedef (VALUE_TYPE (arg1)); - type2 = check_typedef (VALUE_TYPE (arg2)); + type1 = check_typedef (value_type (arg1)); + type2 = check_typedef (value_type (arg2)); code1 = TYPE_CODE (type1); code2 = TYPE_CODE (type2); is_int1 = is_integral_type (type1); @@ -1278,8 +1278,8 @@ value_less (struct value *arg1, struct value *arg2) arg1 = coerce_array (arg1); arg2 = coerce_array (arg2); - type1 = check_typedef (VALUE_TYPE (arg1)); - type2 = check_typedef (VALUE_TYPE (arg2)); + type1 = check_typedef (value_type (arg1)); + type2 = check_typedef (value_type (arg2)); code1 = TYPE_CODE (type1); code2 = TYPE_CODE (type2); is_int1 = is_integral_type (type1); @@ -1315,11 +1315,11 @@ struct value * value_neg (struct value *arg1) { struct type *type; - struct type *result_type = VALUE_TYPE (arg1); + struct type *result_type = value_type (arg1); arg1 = coerce_ref (arg1); - type = check_typedef (VALUE_TYPE (arg1)); + type = check_typedef (value_type (arg1)); if (TYPE_CODE (type) == TYPE_CODE_FLT) return value_from_double (result_type, -value_as_double (arg1)); @@ -1343,11 +1343,11 @@ struct value * value_complement (struct value *arg1) { struct type *type; - struct type *result_type = VALUE_TYPE (arg1); + struct type *result_type = value_type (arg1); arg1 = coerce_ref (arg1); - type = check_typedef (VALUE_TYPE (arg1)); + type = check_typedef (value_type (arg1)); if (!is_integral_type (type)) error ("Argument to complement operation not an integer or boolean."); @@ -1360,7 +1360,7 @@ value_complement (struct value *arg1) return value_from_longest (result_type, ~value_as_long (arg1)); } -/* The INDEX'th bit of SET value whose VALUE_TYPE is TYPE, +/* The INDEX'th bit of SET value whose value_type is TYPE, and whose VALUE_CONTENTS is valaddr. Return -1 if out of range, -2 other error. */ @@ -1388,8 +1388,8 @@ struct value * value_in (struct value *element, struct value *set) { int member; - struct type *settype = check_typedef (VALUE_TYPE (set)); - struct type *eltype = check_typedef (VALUE_TYPE (element)); + struct type *settype = check_typedef (value_type (set)); + struct type *eltype = check_typedef (value_type (element)); if (TYPE_CODE (eltype) == TYPE_CODE_RANGE) eltype = TYPE_TARGET_TYPE (eltype); if (TYPE_CODE (settype) != TYPE_CODE_SET) diff --git a/gdb/valops.c b/gdb/valops.c index 3e40a6d..a6a54e1 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -207,13 +207,13 @@ value_cast (struct type *type, struct value *arg2) int convert_to_boolean = 0; - if (VALUE_TYPE (arg2) == type) + if (value_type (arg2) == type) return arg2; CHECK_TYPEDEF (type); code1 = TYPE_CODE (type); arg2 = coerce_ref (arg2); - type2 = check_typedef (VALUE_TYPE (arg2)); + type2 = check_typedef (value_type (arg2)); /* A cast to an undetermined-length array_type, such as (TYPE [])OBJECT, is treated like a cast to (TYPE [N])OBJECT, @@ -239,8 +239,8 @@ value_cast (struct type *type, struct value *arg2) TYPE_TARGET_TYPE (range_type), low_bound, new_length + low_bound - 1); - VALUE_TYPE (arg2) = create_array_type ((struct type *) NULL, - element_type, range_type); + arg2->type = create_array_type ((struct type *) NULL, + element_type, range_type); return arg2; } } @@ -252,7 +252,7 @@ value_cast (struct type *type, struct value *arg2) if (TYPE_CODE (type2) == TYPE_CODE_FUNC) arg2 = value_coerce_function (arg2); - type2 = check_typedef (VALUE_TYPE (arg2)); + type2 = check_typedef (value_type (arg2)); code2 = TYPE_CODE (type2); if (code1 == TYPE_CODE_COMPLEX) @@ -281,7 +281,7 @@ value_cast (struct type *type, struct value *arg2) arg2, 0, type2, 1); if (v) { - VALUE_TYPE (v) = type; + v->type = type; return v; } } @@ -379,7 +379,7 @@ value_cast (struct type *type, struct value *arg2) if (v) { v = value_addr (v); - VALUE_TYPE (v) = type; + v->type = type; return v; } } @@ -396,7 +396,7 @@ value_cast (struct type *type, struct value *arg2) { CORE_ADDR addr2 = value_as_address (arg2); addr2 -= (VALUE_ADDRESS (v) - + VALUE_OFFSET (v) + + value_offset (v) + VALUE_EMBEDDED_OFFSET (v)); return value_from_pointer (type, addr2); } @@ -404,13 +404,13 @@ value_cast (struct type *type, struct value *arg2) } /* No superclass found, just fall through to change ptr type. */ } - VALUE_TYPE (arg2) = type; + arg2->type = type; arg2 = value_change_enclosing_type (arg2, type); VALUE_POINTED_TO_OFFSET (arg2) = 0; /* pai: chk_val */ 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) + value_offset (arg2)); else if (code1 == TYPE_CODE_VOID) { return value_zero (builtin_type_void, not_lval); @@ -499,10 +499,10 @@ value_at_lazy (struct type *type, CORE_ADDR addr) int value_fetch_lazy (struct value *val) { - CORE_ADDR addr = VALUE_ADDRESS (val) + VALUE_OFFSET (val); + CORE_ADDR addr = VALUE_ADDRESS (val) + value_offset (val); int length = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val)); - struct type *type = VALUE_TYPE (val); + struct type *type = value_type (val); if (length) read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), length); @@ -526,7 +526,7 @@ value_assign (struct value *toval, struct value *fromval) toval = coerce_ref (toval); - type = VALUE_TYPE (toval); + type = value_type (toval); if (VALUE_LVAL (toval) != lval_internalvar) fromval = value_cast (type, fromval); else @@ -550,9 +550,9 @@ value_assign (struct value *toval, struct value *fromval) case lval_internalvar_component: set_internalvar_component (VALUE_INTERNALVAR (toval), - VALUE_OFFSET (toval), - VALUE_BITPOS (toval), - VALUE_BITSIZE (toval), + value_offset (toval), + value_bitpos (toval), + value_bitsize (toval), fromval); break; @@ -563,12 +563,12 @@ value_assign (struct value *toval, struct value *fromval) int changed_len; char buffer[sizeof (LONGEST)]; - if (VALUE_BITSIZE (toval)) + if (value_bitsize (toval)) { /* We assume that the argument to read_memory is in units of host chars. FIXME: Is that correct? */ - changed_len = (VALUE_BITPOS (toval) - + VALUE_BITSIZE (toval) + changed_len = (value_bitpos (toval) + + value_bitsize (toval) + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; @@ -576,16 +576,16 @@ value_assign (struct value *toval, struct value *fromval) 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), + read_memory (VALUE_ADDRESS (toval) + value_offset (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); + value_bitpos (toval), value_bitsize (toval)); + changed_addr = VALUE_ADDRESS (toval) + value_offset (toval); dest_buffer = buffer; } else { - changed_addr = VALUE_ADDRESS (toval) + VALUE_OFFSET (toval); + changed_addr = VALUE_ADDRESS (toval) + value_offset (toval); changed_len = TYPE_LENGTH (type); dest_buffer = VALUE_CONTENTS (fromval); } @@ -643,14 +643,14 @@ value_assign (struct value *toval, struct value *fromval) { int offset; for (reg_offset = value_reg, offset = 0; - offset + register_size (current_gdbarch, reg_offset) <= VALUE_OFFSET (toval); + offset + register_size (current_gdbarch, reg_offset) <= value_offset (toval); reg_offset++); - byte_offset = VALUE_OFFSET (toval) - offset; + byte_offset = value_offset (toval) - offset; } /* Compute the number of register aligned values that need to be copied. */ - if (VALUE_BITSIZE (toval)) + if (value_bitsize (toval)) amount_to_copy = byte_offset + 1; else amount_to_copy = byte_offset + TYPE_LENGTH (type); @@ -665,10 +665,10 @@ value_assign (struct value *toval, struct value *fromval) frame_register_read (frame, regno, buffer + amount_copied); /* Modify what needs to be modified. */ - if (VALUE_BITSIZE (toval)) + if (value_bitsize (toval)) modify_field (buffer + byte_offset, value_as_long (fromval), - VALUE_BITPOS (toval), VALUE_BITSIZE (toval)); + value_bitpos (toval), value_bitsize (toval)); else memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval), TYPE_LENGTH (type)); @@ -724,11 +724,11 @@ value_assign (struct value *toval, struct value *fromval) /* If the field does not entirely fill a LONGEST, then zero the sign bits. If the field is signed, and is negative, then sign extend. */ - if ((VALUE_BITSIZE (toval) > 0) - && (VALUE_BITSIZE (toval) < 8 * (int) sizeof (LONGEST))) + if ((value_bitsize (toval) > 0) + && (value_bitsize (toval) < 8 * (int) sizeof (LONGEST))) { LONGEST fieldval = value_as_long (fromval); - LONGEST valmask = (((ULONGEST) 1) << VALUE_BITSIZE (toval)) - 1; + LONGEST valmask = (((ULONGEST) 1) << value_bitsize (toval)) - 1; fieldval &= valmask; if (!TYPE_UNSIGNED (type) && (fieldval & (valmask ^ (valmask >> 1)))) @@ -740,7 +740,7 @@ value_assign (struct value *toval, struct value *fromval) val = value_copy (toval); memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval), TYPE_LENGTH (type)); - VALUE_TYPE (val) = type; + val->type = type; val = value_change_enclosing_type (val, VALUE_ENCLOSING_TYPE (fromval)); VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval); VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval); @@ -762,11 +762,11 @@ value_repeat (struct value *arg1, int count) val = allocate_repeat_value (VALUE_ENCLOSING_TYPE (arg1), count); - read_memory (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1), + read_memory (VALUE_ADDRESS (arg1) + value_offset (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); + VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + value_offset (arg1); return val; } @@ -826,13 +826,13 @@ value_of_variable (struct symbol *var, struct block *b) struct value * value_coerce_array (struct value *arg1) { - struct type *type = check_typedef (VALUE_TYPE (arg1)); + struct type *type = check_typedef (value_type (arg1)); if (VALUE_LVAL (arg1) != lval_memory) 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) + value_offset (arg1))); } /* Given a value which is a function, return a value which is a pointer @@ -846,8 +846,8 @@ value_coerce_function (struct value *arg1) if (VALUE_LVAL (arg1) != lval_memory) 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))); + retval = value_from_pointer (lookup_pointer_type (value_type (arg1)), + (VALUE_ADDRESS (arg1) + value_offset (arg1))); return retval; } @@ -858,14 +858,14 @@ value_addr (struct value *arg1) { struct value *arg2; - struct type *type = check_typedef (VALUE_TYPE (arg1)); + struct type *type = check_typedef (value_type (arg1)); if (TYPE_CODE (type) == TYPE_CODE_REF) { /* Copy the value, but change the type from (T&) to (T*). We keep the same location information, which is efficient, and allows &(&X) to get the location containing the reference. */ arg2 = value_copy (arg1); - VALUE_TYPE (arg2) = lookup_pointer_type (TYPE_TARGET_TYPE (type)); + arg2->type = lookup_pointer_type (TYPE_TARGET_TYPE (type)); return arg2; } if (TYPE_CODE (type) == TYPE_CODE_FUNC) @@ -875,9 +875,9 @@ value_addr (struct value *arg1) error ("Attempt to take address of value not located in memory."); /* Get target memory address */ - arg2 = value_from_pointer (lookup_pointer_type (VALUE_TYPE (arg1)), + arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)), (VALUE_ADDRESS (arg1) - + VALUE_OFFSET (arg1) + + value_offset (arg1) + VALUE_EMBEDDED_OFFSET (arg1))); /* This may be a pointer to a base subobject; so remember the @@ -898,7 +898,7 @@ value_ind (struct value *arg1) arg1 = coerce_array (arg1); - base_type = check_typedef (VALUE_TYPE (arg1)); + base_type = check_typedef (value_type (arg1)); if (TYPE_CODE (base_type) == TYPE_CODE_MEMBER) error ("not implemented: member types in value_ind"); @@ -921,7 +921,7 @@ value_ind (struct value *arg1) arg2 = value_at_lazy (enc_type, (value_as_address (arg1) - VALUE_POINTED_TO_OFFSET (arg1))); /* Re-adjust type */ - VALUE_TYPE (arg2) = TYPE_TARGET_TYPE (base_type); + arg2->type = TYPE_TARGET_TYPE (base_type); /* Add embedding info */ arg2 = value_change_enclosing_type (arg2, enc_type); VALUE_EMBEDDED_OFFSET (arg2) = VALUE_POINTED_TO_OFFSET (arg1); @@ -1146,7 +1146,7 @@ typecmp (int staticp, int varargs, int nargs, return i + 1; tt1 = check_typedef (t1[i].type); - tt2 = check_typedef (VALUE_TYPE (t2[i])); + tt2 = check_typedef (value_type (t2[i])); if (TYPE_CODE (tt1) == TYPE_CODE_REF /* We should be doing hairy argument matching, as below. */ @@ -1183,7 +1183,7 @@ typecmp (int staticp, int varargs, int nargs, /* We should be doing much hairier argument matching (see section 13.2 of the ARM), but as a quick kludge, just check for the same type code. */ - if (TYPE_CODE (t1[i].type) != TYPE_CODE (VALUE_TYPE (t2[i]))) + if (TYPE_CODE (t1[i].type) != TYPE_CODE (value_type (t2[i]))) return i + 1; } if (varargs || t2[i] == NULL) @@ -1293,7 +1293,7 @@ search_struct_field (char *name, struct value *arg1, int offset, boffset = baseclass_offset (type, i, VALUE_CONTENTS (arg1) + offset, VALUE_ADDRESS (arg1) - + VALUE_OFFSET (arg1) + offset); + + value_offset (arg1) + offset); if (boffset == -1) error ("virtual baseclass botch"); @@ -1306,7 +1306,7 @@ search_struct_field (char *name, struct value *arg1, int offset, { CORE_ADDR base_addr; - base_addr = VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1) + boffset; + base_addr = VALUE_ADDRESS (arg1) + value_offset (arg1) + boffset; if (target_read_memory (base_addr, VALUE_CONTENTS_RAW (v2), TYPE_LENGTH (basetype)) != 0) error ("virtual baseclass botch"); @@ -1317,7 +1317,7 @@ search_struct_field (char *name, struct value *arg1, int offset, { VALUE_LVAL (v2) = VALUE_LVAL (arg1); VALUE_ADDRESS (v2) = VALUE_ADDRESS (arg1); - VALUE_OFFSET (v2) = VALUE_OFFSET (arg1) + boffset; + v2->offset = value_offset (arg1) + boffset; if (VALUE_LAZY (arg1)) VALUE_LAZY (v2) = 1; else @@ -1529,7 +1529,7 @@ search_struct_method (char *name, struct value **arg1p, { base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass)); if (target_read_memory (VALUE_ADDRESS (*arg1p) - + VALUE_OFFSET (*arg1p) + offset, + + value_offset (*arg1p) + offset, base_valaddr, TYPE_LENGTH (baseclass)) != 0) error ("virtual baseclass botch"); @@ -1540,7 +1540,7 @@ search_struct_method (char *name, struct value **arg1p, base_offset = baseclass_offset (type, i, base_valaddr, VALUE_ADDRESS (*arg1p) - + VALUE_OFFSET (*arg1p) + offset); + + value_offset (*arg1p) + offset); if (base_offset == -1) error ("virtual baseclass botch"); } @@ -1591,7 +1591,7 @@ value_struct_elt (struct value **argp, struct value **args, *argp = coerce_array (*argp); - t = check_typedef (VALUE_TYPE (*argp)); + t = check_typedef (value_type (*argp)); /* Follow pointers until we get to a non-pointer. */ @@ -1599,9 +1599,9 @@ value_struct_elt (struct value **argp, struct value **args, { *argp = value_ind (*argp); /* Don't coerce fn pointer to fn and then back again! */ - if (TYPE_CODE (VALUE_TYPE (*argp)) != TYPE_CODE_FUNC) + if (TYPE_CODE (value_type (*argp)) != TYPE_CODE_FUNC) *argp = coerce_array (*argp); - t = check_typedef (VALUE_TYPE (*argp)); + t = check_typedef (value_type (*argp)); } if (TYPE_CODE (t) == TYPE_CODE_MEMBER) @@ -1753,7 +1753,7 @@ find_method_list (struct value **argp, char *method, int offset, else { /* probably g++ runtime model */ - base_offset = VALUE_OFFSET (*argp) + offset; + base_offset = value_offset (*argp) + offset; base_offset = baseclass_offset (type, i, VALUE_CONTENTS (*argp) + base_offset, @@ -1791,16 +1791,16 @@ value_find_oload_method_list (struct value **argp, char *method, int offset, { struct type *t; - t = check_typedef (VALUE_TYPE (*argp)); + t = check_typedef (value_type (*argp)); /* code snarfed from value_struct_elt */ while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF) { *argp = value_ind (*argp); /* Don't coerce fn pointer to fn and then back again! */ - if (TYPE_CODE (VALUE_TYPE (*argp)) != TYPE_CODE_FUNC) + if (TYPE_CODE (value_type (*argp)) != TYPE_CODE_FUNC) *argp = coerce_array (*argp); - t = check_typedef (VALUE_TYPE (*argp)); + t = check_typedef (value_type (*argp)); } if (TYPE_CODE (t) == TYPE_CODE_MEMBER) @@ -1869,12 +1869,12 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, /* Get the list of overloaded methods or functions */ if (method) { - obj_type_name = TYPE_NAME (VALUE_TYPE (obj)); + obj_type_name = TYPE_NAME (value_type (obj)); /* Hack: evaluate_subexp_standard often passes in a pointer value rather than the object itself, so try again */ if ((!obj_type_name || !*obj_type_name) && - (TYPE_CODE (VALUE_TYPE (obj)) == TYPE_CODE_PTR)) - obj_type_name = TYPE_NAME (TYPE_TARGET_TYPE (VALUE_TYPE (obj))); + (TYPE_CODE (value_type (obj)) == TYPE_CODE_PTR)) + obj_type_name = TYPE_NAME (TYPE_TARGET_TYPE (value_type (obj))); fns_ptr = value_find_oload_method_list (&temp, name, 0, &num_fns, @@ -1961,8 +1961,8 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, if (objp) { - if (TYPE_CODE (VALUE_TYPE (temp)) != TYPE_CODE_PTR - && TYPE_CODE (VALUE_TYPE (*objp)) == TYPE_CODE_PTR) + if (TYPE_CODE (value_type (temp)) != TYPE_CODE_PTR + && TYPE_CODE (value_type (*objp)) == TYPE_CODE_PTR) { temp = value_addr (temp); } @@ -2322,7 +2322,7 @@ check_field (struct value *arg1, const char *name) arg1 = coerce_array (arg1); - t = VALUE_TYPE (arg1); + t = value_type (arg1); /* Follow pointers until we get to a non-pointer. */ @@ -2632,7 +2632,7 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop, used for its computation. */ new_val = value_at_lazy (real_type, VALUE_ADDRESS (argp) - top + (using_enc ? 0 : VALUE_EMBEDDED_OFFSET (argp))); - VALUE_TYPE (new_val) = VALUE_TYPE (argp); + new_val->type = value_type (argp); VALUE_EMBEDDED_OFFSET (new_val) = using_enc ? top + VALUE_EMBEDDED_OFFSET (argp) : top; return new_val; } @@ -2718,7 +2718,7 @@ value_slice (struct value *array, int lowbound, int length) LONGEST lowerbound, upperbound; struct value *slice; struct type *array_type; - array_type = check_typedef (VALUE_TYPE (array)); + array_type = check_typedef (value_type (array)); if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY && TYPE_CODE (array_type) != TYPE_CODE_STRING && TYPE_CODE (array_type) != TYPE_CODE_BITSTRING) @@ -2778,7 +2778,7 @@ value_slice (struct value *array, int lowbound, int length) else VALUE_LVAL (slice) = VALUE_LVAL (array); VALUE_ADDRESS (slice) = VALUE_ADDRESS (array); - VALUE_OFFSET (slice) = VALUE_OFFSET (array) + offset; + slice->offset = value_offset (array) + offset; } return slice; } @@ -2812,9 +2812,9 @@ static struct value * cast_into_complex (struct type *type, struct value *val) { struct type *real_type = TYPE_TARGET_TYPE (type); - if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_COMPLEX) + if (TYPE_CODE (value_type (val)) == TYPE_CODE_COMPLEX) { - struct type *val_real_type = TYPE_TARGET_TYPE (VALUE_TYPE (val)); + struct type *val_real_type = TYPE_TARGET_TYPE (value_type (val)); struct value *re_val = allocate_value (val_real_type); struct value *im_val = allocate_value (val_real_type); @@ -2826,8 +2826,8 @@ cast_into_complex (struct type *type, struct value *val) return value_literal_complex (re_val, im_val, type); } - else if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FLT - || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT) + else if (TYPE_CODE (value_type (val)) == TYPE_CODE_FLT + || TYPE_CODE (value_type (val)) == TYPE_CODE_INT) return value_literal_complex (val, value_zero (real_type, not_lval), type); else error ("cannot cast non-number to complex"); diff --git a/gdb/value.c b/gdb/value.c index e53f930..f8300b1 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -84,16 +84,16 @@ allocate_value (struct type *type) struct type *atype = check_typedef (type); val = (struct value *) xmalloc (sizeof (struct value) + TYPE_LENGTH (atype)); - VALUE_NEXT (val) = all_values; + val->next = all_values; all_values = val; - VALUE_TYPE (val) = type; + val->type = type; VALUE_ENCLOSING_TYPE (val) = type; VALUE_LVAL (val) = not_lval; VALUE_ADDRESS (val) = 0; VALUE_FRAME_ID (val) = null_frame_id; - VALUE_OFFSET (val) = 0; - VALUE_BITPOS (val) = 0; - VALUE_BITSIZE (val) = 0; + val->offset = 0; + val->bitpos = 0; + val->bitsize = 0; VALUE_REGNO (val) = -1; VALUE_LAZY (val) = 0; VALUE_OPTIMIZED_OUT (val) = 0; @@ -121,6 +121,32 @@ allocate_repeat_value (struct type *type, int count) type, range_type)); } +/* Accessor methods. */ + +struct type * +value_type (struct value *value) +{ + return value->type; +} + +int +value_offset (struct value *value) +{ + return value->offset; +} + +int +value_bitpos (struct value *value) +{ + return value->bitpos; +} + +int +value_bitsize (struct value *value) +{ + return value->bitsize; +} + /* Return a mark in the value chain. All values allocated after the mark is obtained (except for those released) are subject to being freed if a subsequent value_free_to_mark is passed the mark. */ @@ -140,7 +166,7 @@ value_free_to_mark (struct value *mark) for (val = all_values; val && val != mark; val = next) { - next = VALUE_NEXT (val); + next = val->next; value_free (val); } all_values = val; @@ -157,7 +183,7 @@ free_all_values (void) for (val = all_values; val; val = next) { - next = VALUE_NEXT (val); + next = val->next; value_free (val); } @@ -195,11 +221,11 @@ value_release_to_mark (struct value *mark) struct value *val; struct value *next; - for (val = next = all_values; next; next = VALUE_NEXT (next)) - if (VALUE_NEXT (next) == mark) + for (val = next = all_values; next; next = next->next) + if (next->next == mark) { - all_values = VALUE_NEXT (next); - VALUE_NEXT (next) = 0; + all_values = next->next; + next->next = NULL; return val; } all_values = 0; @@ -215,12 +241,12 @@ value_copy (struct value *arg) { struct type *encl_type = VALUE_ENCLOSING_TYPE (arg); struct value *val = allocate_value (encl_type); - VALUE_TYPE (val) = VALUE_TYPE (arg); + val->type = arg->type; VALUE_LVAL (val) = VALUE_LVAL (arg); VALUE_ADDRESS (val) = VALUE_ADDRESS (arg); - VALUE_OFFSET (val) = VALUE_OFFSET (arg); - VALUE_BITPOS (val) = VALUE_BITPOS (arg); - VALUE_BITSIZE (val) = VALUE_BITSIZE (arg); + val->offset = arg->offset; + val->bitpos = arg->bitpos; + val->bitsize = arg->bitsize; VALUE_FRAME_ID (val) = VALUE_FRAME_ID (arg); VALUE_REGNO (val) = VALUE_REGNO (arg); VALUE_LAZY (val) = VALUE_LAZY (arg); @@ -440,7 +466,7 @@ set_internalvar_component (struct internalvar *var, int offset, int bitpos, modify_field (addr, value_as_long (newval), bitpos, bitsize); else - memcpy (addr, VALUE_CONTENTS (newval), TYPE_LENGTH (VALUE_TYPE (newval))); + memcpy (addr, VALUE_CONTENTS (newval), TYPE_LENGTH (value_type (newval))); } void @@ -527,7 +553,7 @@ value_as_long (struct value *val) in disassemble_command). It also dereferences references, which I suspect is the most logical thing to do. */ val = coerce_array (val); - return unpack_long (VALUE_TYPE (val), VALUE_CONTENTS (val)); + return unpack_long (value_type (val), VALUE_CONTENTS (val)); } DOUBLEST @@ -536,7 +562,7 @@ value_as_double (struct value *val) DOUBLEST foo; int inv; - foo = unpack_double (VALUE_TYPE (val), VALUE_CONTENTS (val), &inv); + foo = unpack_double (value_type (val), VALUE_CONTENTS (val), &inv); if (inv) error ("Invalid floating value found in program."); return foo; @@ -593,8 +619,8 @@ value_as_address (struct value *val) The following shortcut avoids this whole mess. If VAL is a function, just return its address directly. */ - if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC - || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_METHOD) + if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC + || TYPE_CODE (value_type (val)) == TYPE_CODE_METHOD) return VALUE_ADDRESS (val); val = coerce_array (val); @@ -636,12 +662,12 @@ value_as_address (struct value *val) converted to pointers; usually, the ABI doesn't either, but ABI-specific code is a more reasonable place to handle it. */ - if (TYPE_CODE (VALUE_TYPE (val)) != TYPE_CODE_PTR - && TYPE_CODE (VALUE_TYPE (val)) != TYPE_CODE_REF + if (TYPE_CODE (value_type (val)) != TYPE_CODE_PTR + && TYPE_CODE (value_type (val)) != TYPE_CODE_REF && INTEGER_TO_ADDRESS_P ()) - return INTEGER_TO_ADDRESS (VALUE_TYPE (val), VALUE_CONTENTS (val)); + return INTEGER_TO_ADDRESS (value_type (val), VALUE_CONTENTS (val)); - return unpack_long (VALUE_TYPE (val), VALUE_CONTENTS (val)); + return unpack_long (value_type (val), VALUE_CONTENTS (val)); #endif } @@ -896,9 +922,9 @@ value_primitive_field (struct value *arg1, int offset, VALUE_CONTENTS (arg1) + offset, fieldno)); - VALUE_BITPOS (v) = TYPE_FIELD_BITPOS (arg_type, fieldno) % 8; - VALUE_BITSIZE (v) = TYPE_FIELD_BITSIZE (arg_type, fieldno); - VALUE_OFFSET (v) = VALUE_OFFSET (arg1) + offset + v->bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno) % 8; + v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno); + v->offset = value_offset (arg1) + offset + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8; } else if (fieldno < TYPE_N_BASECLASSES (arg_type)) @@ -907,13 +933,13 @@ value_primitive_field (struct value *arg1, int offset, entire object's contents for later references to virtual bases, etc. */ v = allocate_value (VALUE_ENCLOSING_TYPE (arg1)); - VALUE_TYPE (v) = type; + v->type = type; if (VALUE_LAZY (arg1)) VALUE_LAZY (v) = 1; else memcpy (VALUE_CONTENTS_ALL_RAW (v), VALUE_CONTENTS_ALL_RAW (arg1), TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg1))); - VALUE_OFFSET (v) = VALUE_OFFSET (arg1); + v->offset = value_offset (arg1); VALUE_EMBEDDED_OFFSET (v) = offset + VALUE_EMBEDDED_OFFSET (arg1) + @@ -930,8 +956,8 @@ value_primitive_field (struct value *arg1, int offset, memcpy (VALUE_CONTENTS_RAW (v), VALUE_CONTENTS_RAW (arg1) + offset, TYPE_LENGTH (type)); - VALUE_OFFSET (v) = VALUE_OFFSET (arg1) + offset - + VALUE_EMBEDDED_OFFSET (arg1); + v->offset = (value_offset (arg1) + offset + + VALUE_EMBEDDED_OFFSET (arg1)); } VALUE_LVAL (v) = VALUE_LVAL (arg1); if (VALUE_LVAL (arg1) == lval_internalvar) @@ -950,7 +976,7 @@ value_primitive_field (struct value *arg1, int offset, struct value * value_field (struct value *arg1, int fieldno) { - return value_primitive_field (arg1, 0, fieldno, VALUE_TYPE (arg1)); + return value_primitive_field (arg1, 0, fieldno, value_type (arg1)); } /* Return a non-virtual function as a value. @@ -996,7 +1022,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f, int j, struct type *ty if (arg1p) { - if (type != VALUE_TYPE (*arg1p)) + if (type != value_type (*arg1p)) *arg1p = value_ind (value_cast (lookup_pointer_type (type), value_addr (*arg1p))); @@ -1201,10 +1227,10 @@ value_from_double (struct type *type, DOUBLEST num) struct value * coerce_ref (struct value *arg) { - struct type *value_type_arg_tmp = check_typedef (VALUE_TYPE (arg)); + struct type *value_type_arg_tmp = check_typedef (value_type (arg)); if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF) arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp), - unpack_pointer (VALUE_TYPE (arg), + unpack_pointer (value_type (arg), VALUE_CONTENTS (arg))); return arg; } @@ -1214,9 +1240,9 @@ coerce_array (struct value *arg) { arg = coerce_ref (arg); if (current_language->c_style_arrays - && TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY) + && TYPE_CODE (value_type (arg)) == TYPE_CODE_ARRAY) arg = value_coerce_array (arg); - if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FUNC) + if (TYPE_CODE (value_type (arg)) == TYPE_CODE_FUNC) arg = value_coerce_function (arg); return arg; } @@ -1232,7 +1258,7 @@ coerce_number (struct value *arg) struct value * coerce_enum (struct value *arg) { - if (TYPE_CODE (check_typedef (VALUE_TYPE (arg))) == TYPE_CODE_ENUM) + if (TYPE_CODE (check_typedef (value_type (arg))) == TYPE_CODE_ENUM) arg = value_cast (builtin_type_unsigned_int, arg); return arg; } diff --git a/gdb/value.h b/gdb/value.h index 7e8e32c..fc556ac 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -178,7 +178,12 @@ struct value /* Do not add any new members here -- contents above will trash them. */ }; -#define VALUE_TYPE(val) (val)->type + +extern struct type *value_type (struct value *); +extern int value_bitsize (struct value *); +extern int value_bitpos (struct value *); +extern int value_offset (struct value *); + #define VALUE_ENCLOSING_TYPE(val) (val)->enclosing_type #define VALUE_LAZY(val) (val)->lazy @@ -215,10 +220,6 @@ extern int value_fetch_lazy (struct value *val); #define VALUE_INTERNALVAR(val) (val)->location.internalvar #define VALUE_FRAME_REGNUM(val) ((val)->location.regnum) #define VALUE_FRAME_ID(val) ((val)->frame_id) -#define VALUE_OFFSET(val) (val)->offset -#define VALUE_BITSIZE(val) (val)->bitsize -#define VALUE_BITPOS(val) (val)->bitpos -#define VALUE_NEXT(val) (val)->next #define VALUE_REGNO(val) (val)->regno #define VALUE_OPTIMIZED_OUT(val) ((val)->optimized_out) #define VALUE_EMBEDDED_OFFSET(val) ((val)->embedded_offset) diff --git a/gdb/varobj.c b/gdb/varobj.c index 8c1cd57..23a8bb3 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -505,7 +505,7 @@ varobj_create (char *objname, else var->value = evaluate_type (var->root->exp); - var->type = VALUE_TYPE (var->value); + var->type = value_type (var->value); /* Set language info */ lang = variable_language (var); @@ -744,7 +744,7 @@ varobj_get_type (struct varobj *var) /* To print the type, we simply create a zero ``struct value *'' and cast it to our type. We then typeprint this variable. */ val = value_zero (var->type, not_lval); - type_print (VALUE_TYPE (val), "", stb, -1); + type_print (value_type (val), "", stb, -1); thetype = ui_file_xstrdup (stb, &length); do_cleanups (old_chain); @@ -1705,7 +1705,7 @@ type_of_child (struct varobj *var) /* If the child had no evaluation errors, var->value will be non-NULL and contain a valid type. */ if (var->value != NULL) - return VALUE_TYPE (var->value); + return value_type (var->value); /* Otherwise, we must compute the type. */ return (*var->root->lang->type_of_child) (var->parent, var->index); @@ -2093,7 +2093,7 @@ c_value_of_variable (struct varobj *var) if (VALUE_LAZY (var->value)) gdb_value_fetch_lazy (var->value); - val_print (VALUE_TYPE (var->value), + val_print (value_type (var->value), VALUE_CONTENTS_RAW (var->value), 0, VALUE_ADDRESS (var->value), stb, format_code[(int) var->format], 1, 0, 0); @@ -2378,8 +2378,8 @@ cplus_value_of_child (struct varobj *parent, int index) { struct value *temp = NULL; - if (TYPE_CODE (VALUE_TYPE (parent->value)) == TYPE_CODE_PTR - || TYPE_CODE (VALUE_TYPE (parent->value)) == TYPE_CODE_REF) + if (TYPE_CODE (value_type (parent->value)) == TYPE_CODE_PTR + || TYPE_CODE (value_type (parent->value)) == TYPE_CODE_REF) { if (!gdb_value_ind (parent->value, &temp)) return NULL; |