+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.
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
{
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),
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. */
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 =
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),
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))
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)
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);
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;
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;
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;
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
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,
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
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);
}
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;
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.");
&& (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;
}
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);
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 =
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);
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);
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;
}
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;
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;
{
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
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
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),
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)),
{
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);
}
\f
/* Dummy definitions for an experimental caching module that is not
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. */
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;
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);
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);
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.
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));
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);
}
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);
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");
{
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)
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);
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));
}
}
{
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
{
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);
}
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;
&& 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
|| 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;
}
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)
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);
}
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;
}
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)
{
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);
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:
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:
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);
}
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)
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);
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))))
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;
}
}
/* 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);
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,
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);
}
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);
{
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");
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);
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);
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);
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;
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))
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. */
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,
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;
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);
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);
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);
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);
{
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;
}
}
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
{
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
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;
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
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;
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
{
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;
}
}
{
/* 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
|| (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;
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)
(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),
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;
*/
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 */
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);
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);
}
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
{
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);
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;
/* 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);
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;
/* 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);
bitpos % 8, bitsize);
else
memcpy (addr, VALUE_CONTENTS (val),
- TYPE_LENGTH (VALUE_TYPE (val)));
+ TYPE_LENGTH (value_type (val)));
}
while (--nlabels > 0);
}
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)++;
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)
{
{
(*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
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);
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);
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);
}
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);
}
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:
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)
/* 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 */ ,
/* 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 */
}
/* 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 */ ,
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");
}
/* 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)
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);
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;
}
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);
/* 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);
/* 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);
}
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));
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)
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 */
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;
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);
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)
{
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));
else
{
error ("cannot subscript something of type `%s'",
- TYPE_NAME (VALUE_TYPE (arg1)));
+ TYPE_NAME (value_type (arg1)));
}
}
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)
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));
}
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))
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))
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))
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))
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))
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))
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
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;
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. */
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 */
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;
{
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");
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)
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)));
}
}
(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),
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;
}
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;
{
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;
/* 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. */
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))
{
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;
*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)
{
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;
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)
/* 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;
|| 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;
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. */
/* 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
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;
/* 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? */
*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)
/* 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)));
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;
&& TYPE_CODE (arg_type) != TYPE_CODE_PTR)
{
arg = value_addr (arg);
- VALUE_TYPE (arg) = param_type;
+ arg->type = param_type;
return arg;
}
break;
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;
{
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;
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;
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);
/* 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
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;
}
{
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;
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
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);
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
/* 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
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*/);
}
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);
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));
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 ();
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);
}
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++)
}
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;
}
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;
}
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;
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);
/* 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);
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:
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))
{
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;
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++;
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);
}
/* 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
/* 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.");
}
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);
else
error ("NSString: internal error -- no way to create new NSString");
- VALUE_TYPE(nsstringValue) = type;
+ nsstringValue->type = type;
return nsstringValue;
}
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)
(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);
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.
}
}
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);
}
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);
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)
{
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)
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);
val = evaluate_expression (expr);
- annotate_value_begin (VALUE_TYPE (val));
+ annotate_value_begin (value_type (val));
print_formatted (val, format, fmt.size, gdb_stdout);
*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
/* 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));
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;
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)
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. */
{
arg = args[argno];
- type = check_typedef (VALUE_TYPE (arg));
+ type = check_typedef (value_type (arg));
len = TYPE_LENGTH (type);
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;
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));
}
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);
/* 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);
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,
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));
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));
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);
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);
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;
else
val = access_value_history (0);
- type = VALUE_TYPE (val);
+ type = value_type (val);
if (objectprint)
{
/* 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)
{
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)
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)
{
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)
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;
}
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);
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;
}
\f
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
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)
/* 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);
{
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);
/* 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);
{
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);
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
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))
||
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
&&
? 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
? 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);
}
}
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);
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;
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);
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);
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));
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.");
return value_from_longest (result_type, ~value_as_long (arg1));
}
\f
-/* 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. */
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)
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,
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;
}
}
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)
arg2, 0, type2, 1);
if (v)
{
- VALUE_TYPE (v) = type;
+ v->type = type;
return v;
}
}
if (v)
{
v = value_addr (v);
- VALUE_TYPE (v) = type;
+ v->type = type;
return v;
}
}
{
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);
}
}
/* 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);
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);
toval = coerce_ref (toval);
- type = VALUE_TYPE (toval);
+ type = value_type (toval);
if (VALUE_LVAL (toval) != lval_internalvar)
fromval = value_cast (type, fromval);
else
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;
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;
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);
}
{
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);
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));
/* 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))))
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);
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;
}
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
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;
}
{
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)
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
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");
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);
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. */
/* 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)
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");
{
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");
{
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
{
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");
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");
}
*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. */
{
*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)
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,
{
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)
/* 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,
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);
}
arg1 = coerce_array (arg1);
- t = VALUE_TYPE (arg1);
+ t = value_type (arg1);
/* Follow pointers until we get to a non-pointer. */
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;
}
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)
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;
}
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);
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");
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;
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. */
for (val = all_values; val && val != mark; val = next)
{
- next = VALUE_NEXT (val);
+ next = val->next;
value_free (val);
}
all_values = val;
for (val = all_values; val; val = next)
{
- next = VALUE_NEXT (val);
+ next = val->next;
value_free (val);
}
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;
{
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);
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
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
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;
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);
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
}
\f
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))
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) +
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)
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.
if (arg1p)
{
- if (type != VALUE_TYPE (*arg1p))
+ if (type != value_type (*arg1p))
*arg1p = value_ind (value_cast (lookup_pointer_type (type),
value_addr (*arg1p)));
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;
}
{
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;
}
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;
}
/* 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
#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)
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);
/* 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);
/* 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);
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);
{
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;