gdb: remove TYPE_LENGTH

Remove the macro, replace all uses with calls to type::length.

Change-Id: Ib9bdc954576860b21190886534c99103d6a47afb
This commit is contained in:
Simon Marchi 2022-09-21 11:05:21 -04:00
parent b6cdbc9a81
commit df86565b31
150 changed files with 1320 additions and 1323 deletions

View File

@ -1454,10 +1454,10 @@ aarch64_type_align (gdbarch *gdbarch, struct type *t)
{
/* Use the natural alignment for vector types (the same for
scalar type), but the maximum alignment is 128-bit. */
if (TYPE_LENGTH (t) > 16)
if (t->length () > 16)
return 16;
else
return TYPE_LENGTH (t);
return t->length ();
}
/* Allow the common code to calculate the alignment. */
@ -1483,12 +1483,12 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
{
case TYPE_CODE_FLT:
case TYPE_CODE_DECFLOAT:
if (TYPE_LENGTH (type) > 16)
if (type->length () > 16)
return -1;
if (*fundamental_type == nullptr)
*fundamental_type = type;
else if (TYPE_LENGTH (type) != TYPE_LENGTH (*fundamental_type)
else if (type->length () != (*fundamental_type)->length ()
|| type->code () != (*fundamental_type)->code ())
return -1;
@ -1497,12 +1497,12 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
case TYPE_CODE_COMPLEX:
{
struct type *target_type = check_typedef (type->target_type ());
if (TYPE_LENGTH (target_type) > 16)
if (target_type->length () > 16)
return -1;
if (*fundamental_type == nullptr)
*fundamental_type = target_type;
else if (TYPE_LENGTH (target_type) != TYPE_LENGTH (*fundamental_type)
else if (target_type->length () != (*fundamental_type)->length ()
|| target_type->code () != (*fundamental_type)->code ())
return -1;
@ -1513,12 +1513,12 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
{
if (type->is_vector ())
{
if (TYPE_LENGTH (type) != 8 && TYPE_LENGTH (type) != 16)
if (type->length () != 8 && type->length () != 16)
return -1;
if (*fundamental_type == nullptr)
*fundamental_type = type;
else if (TYPE_LENGTH (type) != TYPE_LENGTH (*fundamental_type)
else if (type->length () != (*fundamental_type)->length ()
|| type->code () != (*fundamental_type)->code ())
return -1;
@ -1533,7 +1533,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
if (count == -1)
return count;
count *= (TYPE_LENGTH (type) / TYPE_LENGTH (target_type));
count *= (type->length () / target_type->length ());
return count;
}
}
@ -1561,8 +1561,8 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
/* Ensure there is no padding between the fields (allowing for empty
zero length structs) */
int ftype_length = (*fundamental_type == nullptr)
? 0 : TYPE_LENGTH (*fundamental_type);
if (count * ftype_length != TYPE_LENGTH (type))
? 0 : (*fundamental_type)->length ();
if (count * ftype_length != type->length ())
return -1;
return count;
@ -1645,7 +1645,7 @@ pass_in_x (struct gdbarch *gdbarch, struct regcache *regcache,
struct value *arg)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type);
int len = type->length ();
enum type_code typecode = type->code ();
int regnum = AARCH64_X0_REGNUM + info->ngrn;
const bfd_byte *buf = value_contents (arg).data ();
@ -1719,7 +1719,7 @@ pass_on_stack (struct aarch64_call_info *info, struct type *type,
struct value *arg)
{
const bfd_byte *buf = value_contents (arg).data ();
int len = TYPE_LENGTH (type);
int len = type->length ();
int align;
stack_item_t item;
@ -1765,7 +1765,7 @@ pass_in_x_or_stack (struct gdbarch *gdbarch, struct regcache *regcache,
struct aarch64_call_info *info, struct type *type,
struct value *arg)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
int nregs = (len + X_REGISTER_SIZE - 1) / X_REGISTER_SIZE;
/* PCS C.13 - Pass in registers if we have enough spare */
@ -1794,7 +1794,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
{
case TYPE_CODE_FLT:
case TYPE_CODE_DECFLOAT:
return pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (arg_type),
return pass_in_v (gdbarch, regcache, info, arg_type->length (),
value_contents (arg).data ());
break;
@ -1803,17 +1803,17 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
const bfd_byte *buf = value_contents (arg).data ();
struct type *target_type = check_typedef (arg_type->target_type ());
if (!pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (target_type),
if (!pass_in_v (gdbarch, regcache, info, target_type->length (),
buf))
return false;
return pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (target_type),
buf + TYPE_LENGTH (target_type));
return pass_in_v (gdbarch, regcache, info, target_type->length (),
buf + target_type->length ());
}
case TYPE_CODE_ARRAY:
if (arg_type->is_vector ())
return pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (arg_type),
return pass_in_v (gdbarch, regcache, info, arg_type->length (),
value_contents (arg).data ());
/* fall through. */
@ -1902,7 +1902,7 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len, elements;
arg_type = check_typedef (value_type (arg));
len = TYPE_LENGTH (arg_type);
len = arg_type->length ();
/* If arg can be passed in v registers as per the AAPCS64, then do so if
if there are enough spare registers. */
@ -2293,7 +2293,7 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
if (aapcs_is_vfp_call_or_return_candidate (type, &elements,
&fundamental_type))
{
int len = TYPE_LENGTH (fundamental_type);
int len = fundamental_type->length ();
for (int i = 0; i < elements; i++)
{
@ -2322,7 +2322,7 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
/* If the type is a plain integer, then the access is
straight-forward. Otherwise we have to play around a bit
more. */
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = AARCH64_X0_REGNUM;
ULONGEST tmp;
@ -2343,7 +2343,7 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
/* For a structure or union the behaviour is as if the value had
been stored to word-aligned memory and then loaded into
registers with 64-bit load instruction(s). */
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = AARCH64_X0_REGNUM;
bfd_byte buf[X_REGISTER_SIZE];
@ -2377,7 +2377,7 @@ aarch64_return_in_memory (struct gdbarch *gdbarch, struct type *type)
return 0;
}
if (TYPE_LENGTH (type) > 16
if (type->length () > 16
|| !language_pass_by_reference (type).trivially_copyable)
{
/* PCS B.6 Aggregates larger than 16 bytes are passed by
@ -2404,7 +2404,7 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
if (aapcs_is_vfp_call_or_return_candidate (type, &elements,
&fundamental_type))
{
int len = TYPE_LENGTH (fundamental_type);
int len = fundamental_type->length ();
for (int i = 0; i < elements; i++)
{
@ -2430,7 +2430,7 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
|| TYPE_IS_REFERENCE (type)
|| type->code () == TYPE_CODE_ENUM)
{
if (TYPE_LENGTH (type) <= X_REGISTER_SIZE)
if (type->length () <= X_REGISTER_SIZE)
{
/* Values of one word or less are zero/sign-extended and
returned in r0. */
@ -2445,7 +2445,7 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
/* Integral values greater than one word are stored in
consecutive registers starting with r0. This will always
be a multiple of the regiser size. */
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = AARCH64_X0_REGNUM;
while (len > 0)
@ -2461,7 +2461,7 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
/* For a structure or union the behaviour is as if the value had
been stored to word-aligned memory and then loaded into
registers with 64-bit load instruction(s). */
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = AARCH64_X0_REGNUM;
bfd_byte tmpbuf[X_REGISTER_SIZE];
@ -2504,7 +2504,7 @@ aarch64_return_value (struct gdbarch *gdbarch, struct value *func_value,
CORE_ADDR addr;
regcache->cooked_read (AARCH64_STRUCT_RETURN_REGNUM, &addr);
read_memory (addr, readbuf, TYPE_LENGTH (valtype));
read_memory (addr, readbuf, valtype->length ());
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
@ -2753,7 +2753,7 @@ aarch64_pseudo_read_value_1 (struct gdbarch *gdbarch,
if (regcache->raw_read (v_regnum, reg_buf) != REG_VALID)
mark_value_bytes_unavailable (result_value, 0,
TYPE_LENGTH (value_type (result_value)));
value_type (result_value)->length ());
else
memcpy (value_contents_raw (result_value).data (), reg_buf, regsize);

View File

@ -560,12 +560,12 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
else if (value_lazy (val)
/* Be careful not to make a lazy not_lval value. */
|| (VALUE_LVAL (val) != not_lval
&& TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))))
&& type->length () > value_type (val)->length ()))
result = allocate_value_lazy (type);
else
{
result = allocate_value (type);
value_contents_copy (result, 0, val, 0, TYPE_LENGTH (type));
value_contents_copy (result, 0, val, 0, type->length ());
}
set_value_component_location (result, val);
set_value_bitsize (result, value_bitsize (val));
@ -646,9 +646,9 @@ static LONGEST
max_of_type (struct type *t)
{
if (t->is_unsigned ())
return (LONGEST) umax_of_size (TYPE_LENGTH (t));
return (LONGEST) umax_of_size (t->length ());
else
return max_of_size (TYPE_LENGTH (t));
return max_of_size (t->length ());
}
/* Minimum value of integral type T, as a signed quantity. */
@ -658,7 +658,7 @@ min_of_type (struct type *t)
if (t->is_unsigned ())
return 0;
else
return min_of_size (TYPE_LENGTH (t));
return min_of_size (t->length ());
}
/* The largest value in the domain of TYPE, a discrete type, as an integer. */
@ -1832,7 +1832,7 @@ desc_bounds (struct value *arr)
return
value_from_longest (lookup_pointer_type (bounds_type),
addr - TYPE_LENGTH (bounds_type));
addr - bounds_type->length ());
}
else if (is_thick_pntr (type))
@ -1880,7 +1880,7 @@ fat_pntr_bounds_bitsize (struct type *type)
if (TYPE_FIELD_BITSIZE (type, 1) > 0)
return TYPE_FIELD_BITSIZE (type, 1);
else
return 8 * TYPE_LENGTH (ada_check_typedef (type->field (1).type ()));
return 8 * ada_check_typedef (type->field (1).type ())->length ();
}
/* If TYPE is the type of an array descriptor (fat or thin pointer) or a
@ -1946,7 +1946,7 @@ fat_pntr_data_bitsize (struct type *type)
if (TYPE_FIELD_BITSIZE (type, 0) > 0)
return TYPE_FIELD_BITSIZE (type, 0);
else
return TARGET_CHAR_BIT * TYPE_LENGTH (type->field (0).type ());
return TARGET_CHAR_BIT * type->field (0).type ()->length ();
}
/* If BOUNDS is an array-bounds structure (or pointer to one), return
@ -1985,7 +1985,7 @@ desc_bound_bitsize (struct type *type, int i, int which)
if (TYPE_FIELD_BITSIZE (type, 2 * i + which - 2) > 0)
return TYPE_FIELD_BITSIZE (type, 2 * i + which - 2);
else
return 8 * TYPE_LENGTH (type->field (2 * i + which - 2).type ());
return 8 * type->field (2 * i + which - 2).type ()->length ();
}
/* If TYPE is the type of an array-bounds structure, the type of its
@ -2517,7 +2517,7 @@ decode_constrained_packed_array (struct value *arr)
const gdb_byte *valaddr = value_contents_for_printing (arr).data ();
CORE_ADDR address = value_address (arr);
gdb::array_view<const gdb_byte> view
= gdb::make_array_view (valaddr, TYPE_LENGTH (type));
= gdb::make_array_view (valaddr, type->length ());
type = resolve_dynamic_type (type, view, address);
recursively_update_array_bitsize (type);
@ -2538,7 +2538,7 @@ decode_constrained_packed_array (struct value *arr)
bit_size += 1;
mod >>= 1;
}
bit_pos = HOST_CHAR_BIT * TYPE_LENGTH (value_type (arr)) - bit_size;
bit_pos = HOST_CHAR_BIT * value_type (arr)->length () - bit_size;
arr = ada_value_primitive_packed_val (arr, NULL,
bit_pos / HOST_CHAR_BIT,
bit_pos % HOST_CHAR_BIT,
@ -2790,7 +2790,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
is_big_endian, has_negatives (type),
is_scalar);
type = resolve_dynamic_type (type, staging, 0);
if (TYPE_LENGTH (type) < (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)
if (type->length () < (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)
{
/* This happens when the length of the object is dynamic,
and is actually smaller than the space reserved for it.
@ -2799,7 +2799,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
normally equal to the maximum size of its element.
But, in reality, each element only actually spans a portion
of that stride. */
bit_size = TYPE_LENGTH (type) * HOST_CHAR_BIT;
bit_size = type->length () * HOST_CHAR_BIT;
}
}
@ -2848,11 +2848,11 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
if (bit_size == 0)
{
memset (unpacked, 0, TYPE_LENGTH (type));
memset (unpacked, 0, type->length ());
return v;
}
if (staging.size () == TYPE_LENGTH (type))
if (staging.size () == type->length ())
{
/* Small short-cut: If we've unpacked the data into a buffer
of the same size as TYPE's length, then we can reuse that,
@ -2861,7 +2861,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
}
else
ada_unpack_from_contents (src, bit_offset, bit_size,
unpacked, TYPE_LENGTH (type),
unpacked, type->length (),
is_big_endian, has_negatives (type), is_scalar);
return v;
@ -2907,7 +2907,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
read_memory (to_addr, buffer, len);
from_size = value_bitsize (fromval);
if (from_size == 0)
from_size = TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT;
from_size = value_type (fromval)->length () * TARGET_CHAR_BIT;
const int is_big_endian = type_byte_order (type) == BFD_ENDIAN_BIG;
ULONGEST from_offset = 0;
@ -2921,7 +2921,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
val = value_copy (toval);
memcpy (value_contents_raw (val).data (),
value_contents (fromval).data (),
TYPE_LENGTH (type));
type->length ());
deprecated_set_value_type (val, type);
return val;
@ -2955,7 +2955,7 @@ value_assign_to_component (struct value *container, struct value *component,
val = value_cast (value_type (component), val);
if (value_bitsize (component) == 0)
bits = TARGET_CHAR_BIT * TYPE_LENGTH (value_type (component));
bits = TARGET_CHAR_BIT * value_type (component)->length ();
else
bits = value_bitsize (component);
@ -2965,7 +2965,7 @@ value_assign_to_component (struct value *container, struct value *component,
if (is_scalar_type (check_typedef (value_type (component))))
src_offset
= TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits;
= value_type (component)->length () * TARGET_CHAR_BIT - bits;
else
src_offset = 0;
copy_bitwise ((value_contents_writeable (container).data ()
@ -3112,7 +3112,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
ULONGEST stride = TYPE_FIELD_BITSIZE (slice_type, 0) / 8;
if (stride == 0)
stride = TYPE_LENGTH (type0->target_type ());
stride = type0->target_type ()->length ();
base = value_as_address (array_ptr) + (*low_pos - *base_low_pos) * stride;
return value_at_lazy (slice_type, base);
@ -3920,7 +3920,7 @@ ada_type_match (struct type *ftype, struct type *atype)
return 0;
atype = atype->target_type ();
/* This can only happen if the actual argument is 'null'. */
if (atype->code () == TYPE_CODE_INT && TYPE_LENGTH (atype) == 0)
if (atype->code () == TYPE_CODE_INT && atype->length () == 0)
return 1;
return ada_type_match (ftype->target_type (), atype);
case TYPE_CODE_INT:
@ -4346,7 +4346,7 @@ ensure_lval (struct value *val)
if (VALUE_LVAL (val) == not_lval
|| VALUE_LVAL (val) == lval_internalvar)
{
int len = TYPE_LENGTH (ada_check_typedef (value_type (val)));
int len = ada_check_typedef (value_type (val))->length ();
const CORE_ADDR addr =
value_as_long (value_allocate_space_in_inferior (len));
@ -4556,7 +4556,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
static CORE_ADDR
value_pointer (struct value *value, struct type *type)
{
unsigned len = TYPE_LENGTH (type);
unsigned len = type->length ();
gdb_byte *buf = (gdb_byte *) alloca (len);
CORE_ADDR addr;
@ -6399,7 +6399,7 @@ value_tag_from_contents_and_address (struct type *type,
gdb::array_view<const gdb_byte> contents;
if (valaddr != nullptr)
contents = gdb::make_array_view (valaddr, TYPE_LENGTH (type));
contents = gdb::make_array_view (valaddr, type->length ());
struct type *resolved_type = resolve_dynamic_type (type, contents, address);
if (find_struct_field ("_tag", resolved_type, 0, &tag_type, &tag_byte_offset,
NULL, NULL, NULL))
@ -6493,7 +6493,7 @@ ada_tag_value_at_base_address (struct value *obj)
/* Storage_Offset'Last is used to indicate that a dynamic offset to
top is used. In this situation the offset is stored just after
the tag, in the object itself. */
ULONGEST last = (((ULONGEST) 1) << (8 * TYPE_LENGTH (offset_type) - 1)) - 1;
ULONGEST last = (((ULONGEST) 1) << (8 * offset_type->length () - 1)) - 1;
if (offset_to_top == last)
{
struct value *tem = value_addr (tag);
@ -7960,8 +7960,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
an overflow should not happen in practice. So rather than
adding overflow recovery code to this already complex code,
we just assume that it's not going to happen. */
fld_bit_len =
TYPE_LENGTH (rtype->field (f).type ()) * TARGET_CHAR_BIT;
fld_bit_len = rtype->field (f).type ()->length () * TARGET_CHAR_BIT;
}
else
{
@ -7992,7 +7991,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
field_type = ada_typedef_target_type (field_type);
fld_bit_len =
TYPE_LENGTH (ada_check_typedef (field_type)) * TARGET_CHAR_BIT;
ada_check_typedef (field_type)->length () * TARGET_CHAR_BIT;
}
}
if (off + fld_bit_len > bit_len)
@ -8039,8 +8038,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
rtype->field (variant_field).set_type (branch_type);
rtype->field (variant_field).set_name ("S");
fld_bit_len =
TYPE_LENGTH (rtype->field (variant_field).type ()) *
TARGET_CHAR_BIT;
rtype->field (variant_field).type ()->length () * TARGET_CHAR_BIT;
if (off + fld_bit_len > bit_len)
bit_len = off + fld_bit_len;
@ -8055,17 +8053,17 @@ ada_template_to_fixed_record_type_1 (struct type *type,
probably in the debug info. In that case, we don't round up the size
of the resulting type. If this record is not part of another structure,
the current RTYPE length might be good enough for our purposes. */
if (TYPE_LENGTH (type) <= 0)
if (type->length () <= 0)
{
if (rtype->name ())
warning (_("Invalid type size for `%s' detected: %s."),
rtype->name (), pulongest (TYPE_LENGTH (type)));
rtype->name (), pulongest (type->length ()));
else
warning (_("Invalid type size for <unnamed> detected: %s."),
pulongest (TYPE_LENGTH (type)));
pulongest (type->length ()));
}
else
rtype->set_length (align_up (TYPE_LENGTH (rtype), TYPE_LENGTH (type)));
rtype->set_length (align_up (rtype->length (), type->length ()));
value_free_to_mark (mark);
return rtype;
@ -8198,7 +8196,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
rtype->set_name (ada_type_name (type));
rtype->set_is_fixed_instance (true);
rtype->set_length (TYPE_LENGTH (type));
rtype->set_length (type->length ());
branch_type = to_fixed_variant_branch_type
(type->field (variant_field).type (),
@ -8221,11 +8219,11 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
rtype->field (variant_field).set_type (branch_type);
rtype->field (variant_field).set_name ("S");
TYPE_FIELD_BITSIZE (rtype, variant_field) = 0;
rtype->set_length (TYPE_LENGTH (rtype) + TYPE_LENGTH (branch_type));
rtype->set_length (rtype->length () + branch_type->length ());
}
rtype->set_length (TYPE_LENGTH (rtype)
- TYPE_LENGTH (type->field (variant_field).type ()));
rtype->set_length (rtype->length ()
- type->field (variant_field).type ()->length ());
value_free_to_mark (mark);
return rtype;
@ -8529,13 +8527,13 @@ to_fixed_array_type (struct type *type0, struct value *dval,
type was a regular (non-packed) array type. As a result, the
bitsize of the array elements needs to be set again, and the array
length needs to be recomputed based on that bitsize. */
int len = TYPE_LENGTH (result) / TYPE_LENGTH (result->target_type ());
int len = result->length () / result->target_type ()->length ();
int elt_bitsize = TYPE_FIELD_BITSIZE (type0, 0);
TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0);
result->set_length (len * elt_bitsize / HOST_CHAR_BIT);
if (TYPE_LENGTH (result) * HOST_CHAR_BIT < len * elt_bitsize)
result->set_length (TYPE_LENGTH (result) + 1);
if (result->length () * HOST_CHAR_BIT < len * elt_bitsize)
result->set_length (result->length () + 1);
}
result->set_is_fixed_instance (true);
@ -8628,7 +8626,7 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
xvz_name, except.what ());
}
if (xvz_found && TYPE_LENGTH (fixed_record_type) != size)
if (xvz_found && fixed_record_type->length () != size)
{
fixed_record_type = copy_type (fixed_record_type);
fixed_record_type->set_length (size);
@ -9282,8 +9280,8 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
gdb_assert (is_integral_type (type->target_type ()));
gdb_assert (value_type (val)->code () == TYPE_CODE_ARRAY);
gdb_assert (is_integral_type (value_type (val)->target_type ()));
gdb_assert (TYPE_LENGTH (type->target_type ())
> TYPE_LENGTH (value_type (val)->target_type ()));
gdb_assert (type->target_type ()->length ()
> value_type (val)->target_type ()->length ());
if (!get_array_bounds (type, &lo, &hi))
error (_("unable to determine array bounds"));
@ -9295,7 +9293,7 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
for (i = 0; i < hi - lo + 1; i++)
{
struct value *elt = value_cast (elt_type, value_subscript (val, lo + i));
int elt_len = TYPE_LENGTH (elt_type);
int elt_len = elt_type->length ();
copy (value_contents_all (elt), res_contents.slice (elt_len * i, elt_len));
}
@ -9332,16 +9330,14 @@ coerce_for_assign (struct type *type, struct value *val)
if (is_integral_type (type->target_type ())
&& is_integral_type (type2->target_type ())
&& TYPE_LENGTH (type2->target_type ())
< TYPE_LENGTH (type->target_type ()))
&& type2->target_type ()->length () < type->target_type ()->length ())
{
/* Allow implicit promotion of the array elements to
a wider type. */
return ada_promote_array_of_integrals (type, val);
}
if (TYPE_LENGTH (type2->target_type ())
!= TYPE_LENGTH (type->target_type ()))
if (type2->target_type ()->length () != type->target_type ()->length ())
error (_("Incompatible types in assignment"));
deprecated_set_value_type (val, type);
}
@ -9414,7 +9410,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
val = allocate_value (type1);
store_unsigned_integer (value_contents_raw (val).data (),
TYPE_LENGTH (value_type (val)),
value_type (val)->length (),
type_byte_order (type1), v);
return val;
}
@ -9444,10 +9440,10 @@ ada_value_equal (struct value *arg1, struct value *arg2)
/* 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 (arg1_type) == TYPE_LENGTH (arg2_type)
return (arg1_type->length () == arg2_type->length ()
&& memcmp (value_contents (arg1).data (),
value_contents (arg2).data (),
TYPE_LENGTH (arg1_type)) == 0);
arg1_type->length ()) == 0);
}
return value_equal (arg1, arg2);
}
@ -10198,7 +10194,7 @@ ada_atr_size (struct type *expect_type,
return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval);
else
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
TARGET_CHAR_BIT * TYPE_LENGTH (type));
TARGET_CHAR_BIT * type->length ());
}
/* A helper function for UNOP_ABS. */
@ -10667,7 +10663,7 @@ ada_string_operation::evaluate (struct type *expect_type,
const std::string &str = std::get<0> (m_storage);
const char *encoding;
switch (TYPE_LENGTH (char_type))
switch (char_type->length ())
{
case 1:
{
@ -10698,7 +10694,7 @@ ada_string_operation::evaluate (struct type *expect_type,
default:
error (_("unexpected character type size %s"),
pulongest (TYPE_LENGTH (char_type)));
pulongest (char_type->length ()));
}
auto_obstack converted;
@ -10710,7 +10706,7 @@ ada_string_operation::evaluate (struct type *expect_type,
struct type *stringtype
= lookup_array_range_type (char_type, 1,
obstack_object_size (&converted)
/ TYPE_LENGTH (char_type));
/ char_type->length ());
struct value *val = allocate_value (stringtype);
memcpy (value_contents_raw (val).data (),
obstack_base (&converted),
@ -11529,7 +11525,7 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
/* create_static_range_type alters the resulting type's length
to match the size of the base_type, which is not what we want.
Set it back to the original range type's length. */
type->set_length (TYPE_LENGTH (raw_type));
type->set_length (raw_type->length ());
type->set_name (name);
return type;
}
@ -12034,7 +12030,7 @@ ada_exception_message_1 (void)
e_msg_val = ada_coerce_to_simple_array (e_msg_val);
gdb_assert (e_msg_val != NULL);
e_msg_len = TYPE_LENGTH (value_type (e_msg_val));
e_msg_len = value_type (e_msg_val)->length ();
/* If the message string is empty, then treat it as if there was
no exception message. */
@ -13548,7 +13544,7 @@ public:
/* Create the equivalent of the System.Storage_Elements.Storage_Offset
type. This is a signed integral type whose size is the same as
the size of addresses. */
unsigned int addr_length = TYPE_LENGTH (system_addr_ptr);
unsigned int addr_length = system_addr_ptr->length ();
add (arch_integer_type (gdbarch, addr_length * HOST_CHAR_BIT, 0,
"storage_offset"));

View File

@ -455,7 +455,7 @@ processInt (struct parser_state *par_state, const char *base0,
yylval.typed_val_float.type = fp_type;
result.write (gdb::make_array_view (yylval.typed_val_float.val,
TYPE_LENGTH (fp_type)),
fp_type->length ()),
type_byte_order (fp_type),
true);

View File

@ -818,7 +818,7 @@ add_ada_task (CORE_ADDR task_id, struct inferior *inf)
static bool
read_known_tasks_array (struct ada_tasks_inferior_data *data)
{
const int target_ptr_byte = TYPE_LENGTH (data->known_tasks_element);
const int target_ptr_byte = data->known_tasks_element->length ();
const int known_tasks_size = target_ptr_byte * data->known_tasks_length;
gdb_byte *known_tasks = (gdb_byte *) alloca (known_tasks_size);
int i;
@ -845,7 +845,7 @@ read_known_tasks_array (struct ada_tasks_inferior_data *data)
static bool
read_known_tasks_list (struct ada_tasks_inferior_data *data)
{
const int target_ptr_byte = TYPE_LENGTH (data->known_tasks_element);
const int target_ptr_byte = data->known_tasks_element->length ();
gdb_byte *known_tasks = (gdb_byte *) alloca (target_ptr_byte);
CORE_ADDR task_id;
const struct ada_tasks_pspace_data *pspace_data

View File

@ -1019,7 +1019,7 @@ ada_print_type (struct type *type0, const char *varstring,
if (!ada_is_range_type_name (name))
fprintf_styled (stream, metadata_style.style (),
_("<%s-byte integer>"),
pulongest (TYPE_LENGTH (type)));
pulongest (type->length ()));
else
{
gdb_printf (stream, "range ");
@ -1046,7 +1046,7 @@ ada_print_type (struct type *type0, const char *varstring,
case TYPE_CODE_FLT:
fprintf_styled (stream, metadata_style.style (),
_("<%s-byte float>"),
pulongest (TYPE_LENGTH (type)));
pulongest (type->length ()));
break;
case TYPE_CODE_ENUM:
if (show < 0)

View File

@ -195,12 +195,12 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
(i * bitsize) / HOST_CHAR_BIT,
(i * bitsize) % HOST_CHAR_BIT,
bitsize, elttype);
if (TYPE_LENGTH (check_typedef (value_type (v0)))
!= TYPE_LENGTH (check_typedef (value_type (v1))))
if (check_typedef (value_type (v0))->length ()
!= check_typedef (value_type (v1))->length ())
break;
if (!value_contents_eq (v0, value_embedded_offset (v0),
v1, value_embedded_offset (v1),
TYPE_LENGTH (check_typedef (value_type (v0)))))
check_typedef (value_type (v0))->length ()))
break;
}
@ -363,7 +363,7 @@ void
ada_printchar (int c, struct type *type, struct ui_file *stream)
{
gdb_puts ("'", stream);
ada_emit_char (c, type, stream, '\'', TYPE_LENGTH (type));
ada_emit_char (c, type, stream, '\'', type->length ());
gdb_puts ("'", stream);
}
@ -540,7 +540,7 @@ ada_printstr (struct ui_file *stream, struct type *type,
const char *encoding, int force_ellipses,
const struct value_print_options *options)
{
printstr (stream, type, string, length, force_ellipses, TYPE_LENGTH (type),
printstr (stream, type, string, length, force_ellipses, type->length (),
options);
}
@ -697,10 +697,10 @@ ada_val_print_string (struct type *type, const gdb_byte *valaddr,
Similarly, the size of ELTTYPE should also be non-null, since
it's a character-like type. */
gdb_assert (elttype != NULL);
gdb_assert (TYPE_LENGTH (elttype) != 0);
gdb_assert (elttype->length () != 0);
eltlen = TYPE_LENGTH (elttype);
len = TYPE_LENGTH (type) / eltlen;
eltlen = elttype->length ();
len = type->length () / eltlen;
/* If requested, look for the first null char and only print
elements up to it. */
@ -732,7 +732,7 @@ ada_value_print_ptr (struct value *val,
{
if (!options->format
&& value_type (val)->target_type ()->code () == TYPE_CODE_INT
&& TYPE_LENGTH (value_type (val)->target_type ()) == 0)
&& value_type (val)->target_type ()->length () == 0)
{
gdb_puts ("null", stream);
return;
@ -1023,7 +1023,7 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
const gdb_byte *valaddr = value_contents_for_printing (val).data ();
CORE_ADDR address = value_address (val);
gdb::array_view<const gdb_byte> view
= gdb::make_array_view (valaddr, TYPE_LENGTH (type));
= gdb::make_array_view (valaddr, type->length ());
type = ada_check_typedef (resolve_dynamic_type (type, view, address));
if (type != saved_type)
{
@ -1094,11 +1094,11 @@ ada_value_print (struct value *val0, struct ui_file *stream,
"void *" pointers. */
if (type->code () == TYPE_CODE_PTR
&& !(type->target_type ()->code () == TYPE_CODE_INT
&& TYPE_LENGTH (type->target_type ()) == 0))
&& type->target_type ()->length () == 0))
{
/* Hack: don't print (char *) for char strings. Their
type is indicated by the quoted string anyway. */
if (TYPE_LENGTH (type->target_type ()) != sizeof (char)
if (type->target_type ()->length () != sizeof (char)
|| type->target_type ()->code () != TYPE_CODE_INT
|| type->target_type ()->is_unsigned ())
{

View File

@ -234,7 +234,7 @@ alpha_convert_register_p (struct gdbarch *gdbarch, int regno,
struct type *type)
{
return (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31
&& TYPE_LENGTH (type) == 4);
&& type->length () == 4);
}
static int
@ -257,7 +257,7 @@ alpha_register_to_value (struct frame_info *frame, int regnum,
/* Convert to VALTYPE. */
gdb_assert (TYPE_LENGTH (valtype) == 4);
gdb_assert (valtype->length () == 4);
alpha_sts (gdbarch, out, value_contents_all (value).data ());
release_value (value);
@ -270,7 +270,7 @@ alpha_value_to_register (struct frame_info *frame, int regnum,
{
gdb_byte out[ALPHA_REGISTER_SIZE];
gdb_assert (TYPE_LENGTH (valtype) == 4);
gdb_assert (valtype->length () == 4);
gdb_assert (register_size (get_frame_arch (frame), regnum)
<= ALPHA_REGISTER_SIZE);
alpha_lds (get_frame_arch (frame), out, in);
@ -334,14 +334,14 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
case TYPE_CODE_CHAR:
case TYPE_CODE_RANGE:
case TYPE_CODE_ENUM:
if (TYPE_LENGTH (arg_type) == 4)
if (arg_type->length () == 4)
{
/* 32-bit values must be sign-extended to 64 bits
even if the base data type is unsigned. */
arg_type = builtin_type (gdbarch)->builtin_int32;
arg = value_cast (arg_type, arg);
}
if (TYPE_LENGTH (arg_type) < ALPHA_REGISTER_SIZE)
if (arg_type->length () < ALPHA_REGISTER_SIZE)
{
arg_type = builtin_type (gdbarch)->builtin_int64;
arg = value_cast (arg_type, arg);
@ -352,14 +352,14 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* "float" arguments loaded in registers must be passed in
register format, aka "double". */
if (accumulate_size < sizeof (arg_reg_buffer)
&& TYPE_LENGTH (arg_type) == 4)
&& arg_type->length () == 4)
{
arg_type = builtin_type (gdbarch)->builtin_double;
arg = value_cast (arg_type, arg);
}
/* Tru64 5.1 has a 128-bit long double, and passes this by
invisible reference. No one else uses this data type. */
else if (TYPE_LENGTH (arg_type) == 16)
else if (arg_type->length () == 16)
{
/* Allocate aligned storage. */
sp = (sp & -16) - 16;
@ -380,7 +380,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Tru64 5.1 has a 128-bit long double, and passes this by
invisible reference. */
if (TYPE_LENGTH (arg_type) == 32)
if (arg_type->length () == 32)
{
/* Allocate aligned storage. */
sp = (sp & -16) - 16;
@ -397,7 +397,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
default:
break;
}
m_arg->len = TYPE_LENGTH (arg_type);
m_arg->len = arg_type->length ();
m_arg->offset = accumulate_size;
accumulate_size = (accumulate_size + m_arg->len + 7) & ~7;
m_arg->contents = value_contents (arg).data ();
@ -481,7 +481,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
switch (valtype->code ())
{
case TYPE_CODE_FLT:
switch (TYPE_LENGTH (valtype))
switch (valtype->length ())
{
case 4:
regcache->cooked_read (ALPHA_FP0_REGNUM, raw_buffer);
@ -504,7 +504,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
break;
case TYPE_CODE_COMPLEX:
switch (TYPE_LENGTH (valtype))
switch (valtype->length ())
{
case 8:
/* ??? This isn't correct wrt the ABI, but it's what GCC does. */
@ -530,7 +530,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
default:
/* Assume everything else degenerates to an integer. */
regcache_cooked_read_unsigned (regcache, ALPHA_V0_REGNUM, &l);
store_unsigned_integer (valbuf, TYPE_LENGTH (valtype), byte_order, l);
store_unsigned_integer (valbuf, valtype->length (), byte_order, l);
break;
}
}
@ -549,7 +549,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
switch (valtype->code ())
{
case TYPE_CODE_FLT:
switch (TYPE_LENGTH (valtype))
switch (valtype->length ())
{
case 4:
alpha_lds (gdbarch, raw_buffer, valbuf);
@ -573,7 +573,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
break;
case TYPE_CODE_COMPLEX:
switch (TYPE_LENGTH (valtype))
switch (valtype->length ())
{
case 8:
/* ??? This isn't correct wrt the ABI, but it's what GCC does. */
@ -601,7 +601,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
/* Assume everything else degenerates to an integer. */
/* 32-bit values must be sign-extended to 64 bits
even if the base data type is unsigned. */
if (TYPE_LENGTH (valtype) == 4)
if (valtype->length () == 4)
valtype = builtin_type (gdbarch)->builtin_int32;
l = unpack_long (valtype, valbuf);
regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l);
@ -626,7 +626,7 @@ alpha_return_value (struct gdbarch *gdbarch, struct value *function,
{
ULONGEST addr;
regcache_raw_read_unsigned (regcache, ALPHA_V0_REGNUM, &addr);
read_memory (addr, readbuf, TYPE_LENGTH (type));
read_memory (addr, readbuf, type->length ());
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;

View File

@ -376,7 +376,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
memcpy (buf, raw_buf + 1, 1);
else
mark_value_bytes_unavailable (result_value, 0,
TYPE_LENGTH (value_type (result_value)));
value_type (result_value)->length ());
}
else
{
@ -386,7 +386,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
memcpy (buf, raw_buf, 1);
else
mark_value_bytes_unavailable (result_value, 0,
TYPE_LENGTH (value_type (result_value)));
value_type (result_value)->length ());
}
}
else if (i386_dword_regnum_p (gdbarch, regnum))
@ -399,7 +399,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
memcpy (buf, raw_buf, 4);
else
mark_value_bytes_unavailable (result_value, 0,
TYPE_LENGTH (value_type (result_value)));
value_type (result_value)->length ());
}
else
i386_pseudo_register_read_into_value (gdbarch, regcache, regnum,
@ -559,7 +559,7 @@ amd64_has_unaligned_fields (struct type *type)
the caller). */
if (field_is_static (&type->field (i))
|| (TYPE_FIELD_BITSIZE (type, i) == 0
&& TYPE_LENGTH (subtype) == 0)
&& subtype->length () == 0)
|| TYPE_FIELD_PACKED (type, i))
continue;
@ -597,7 +597,7 @@ amd64_classify_aggregate_field (struct type *type, int i,
int bitsize = TYPE_FIELD_BITSIZE (type, i);
if (bitsize == 0)
bitsize = TYPE_LENGTH (subtype) * 8;
bitsize = subtype->length () * 8;
/* Ignore static fields, or empty fields, for example nested
empty structures.*/
@ -666,7 +666,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
loc_bitpos attributes, which will cause an assert to trigger within
the unaligned field check. As classes with virtual bases are not
trivially copyable, checking that first avoids this problem. */
if (TYPE_LENGTH (type) > 16
if (type->length () > 16
|| !language_pass_by_reference (type).trivially_copyable
|| amd64_has_unaligned_fields (type))
{
@ -688,7 +688,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
/* All fields in an array have the same type. */
amd64_classify (subtype, theclass);
if (TYPE_LENGTH (type) > 8 && theclass[1] == AMD64_NO_CLASS)
if (type->length () > 8 && theclass[1] == AMD64_NO_CLASS)
theclass[1] = theclass[0];
}
else
@ -724,7 +724,7 @@ static void
amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
{
enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
int len = type->length ();
theclass[0] = theclass[1] = AMD64_NO_CLASS;
@ -791,7 +791,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum amd64_reg_class theclass[2];
int len = TYPE_LENGTH (type);
int len = type->length ();
static int integer_regnum[] = { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM };
static int sse_regnum[] = { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM };
int integer_reg = 0;
@ -821,7 +821,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
ULONGEST addr;
regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &addr);
read_memory (addr, readbuf, TYPE_LENGTH (type));
read_memory (addr, readbuf, type->length ());
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
@ -955,7 +955,7 @@ if (return_method == return_method_struct)
for (i = 0; i < nargs; i++)
{
struct type *type = value_type (args[i]);
int len = TYPE_LENGTH (type);
int len = type->length ();
enum amd64_reg_class theclass[2];
int needed_integer_regs = 0;
int needed_sse_regs = 0;
@ -1040,7 +1040,7 @@ if (return_method == return_method_struct)
{
struct type *type = value_type (stack_args[i]);
const gdb_byte *valbuf = value_contents (stack_args[i]).data ();
int len = TYPE_LENGTH (type);
int len = type->length ();
write_memory (sp + element * 8, valbuf, len);
element += ((len + 7) / 8);
@ -3071,7 +3071,7 @@ amd64_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
struct gdbarch *gdbarch = get_frame_arch (frame);
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int jb_pc_offset = tdep->jb_pc_offset;
int len = TYPE_LENGTH (builtin_type (gdbarch)->builtin_func_ptr);
int len = builtin_type (gdbarch)->builtin_func_ptr->length ();
/* If JB_PC_OFFSET is -1, we have no way to find out where the
longjmp will land. */

View File

@ -126,10 +126,10 @@ amd64_windows_passed_by_integer_register (struct type *type)
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_COMPLEX:
return (TYPE_LENGTH (type) == 1
|| TYPE_LENGTH (type) == 2
|| TYPE_LENGTH (type) == 4
|| TYPE_LENGTH (type) == 8);
return (type->length () == 1
|| type->length () == 2
|| type->length () == 4
|| type->length () == 8);
default:
return 0;
@ -144,7 +144,7 @@ amd64_windows_passed_by_xmm_register (struct type *type)
{
return ((type->code () == TYPE_CODE_FLT
|| type->code () == TYPE_CODE_DECFLOAT)
&& (TYPE_LENGTH (type) == 4 || TYPE_LENGTH (type) == 8));
&& (type->length () == 4 || type->length () == 8));
}
/* Return non-zero iff an argument of the given TYPE should be passed
@ -180,7 +180,7 @@ amd64_windows_adjust_args_passed_by_pointer (struct value **args,
{
struct type *type = value_type (args[i]);
const gdb_byte *valbuf = value_contents (args[i]).data ();
const int len = TYPE_LENGTH (type);
const int len = type->length ();
/* Store a copy of that argument on the stack, aligned to
a 16 bytes boundary, and then use the copy's address as
@ -208,9 +208,9 @@ amd64_windows_store_arg_in_reg (struct regcache *regcache,
const gdb_byte *valbuf = value_contents (arg).data ();
gdb_byte buf[8];
gdb_assert (TYPE_LENGTH (type) <= 8);
gdb_assert (type->length () <= 8);
memset (buf, 0, sizeof buf);
memcpy (buf, valbuf, std::min (TYPE_LENGTH (type), (ULONGEST) 8));
memcpy (buf, valbuf, std::min (type->length (), (ULONGEST) 8));
regcache->cooked_write (regno, buf);
}
@ -252,7 +252,7 @@ amd64_windows_push_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++)
{
struct type *type = value_type (args[i]);
int len = TYPE_LENGTH (type);
int len = type->length ();
int on_stack_p = 1;
if (reg_idx < ARRAY_SIZE (amd64_windows_dummy_call_integer_regs))
@ -297,8 +297,8 @@ amd64_windows_push_arguments (struct regcache *regcache, int nargs,
struct type *type = value_type (stack_args[i]);
const gdb_byte *valbuf = value_contents (stack_args[i]).data ();
write_memory (sp + element * 8, valbuf, TYPE_LENGTH (type));
element += ((TYPE_LENGTH (type) + 7) / 8);
write_memory (sp + element * 8, valbuf, type->length ());
element += ((type->length () + 7) / 8);
}
return sp;
@ -357,7 +357,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
int regnum = -1;
/* See if our value is returned through a register. If it is, then
@ -399,7 +399,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
ULONGEST addr;
regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &addr);
read_memory (addr, readbuf, TYPE_LENGTH (type));
read_memory (addr, readbuf, type->length ());
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
}

View File

@ -761,7 +761,7 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
argument's size up to an integral number of words. */
for (int i = 0; i < nargs; i++)
{
unsigned int len = TYPE_LENGTH (value_type (args[i]));
unsigned int len = value_type (args[i])->length ();
unsigned int space = align_up (len, 4);
total_space += space;
@ -776,7 +776,7 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte *data = memory_image;
for (int i = 0; i < nargs; i++)
{
unsigned int len = TYPE_LENGTH (value_type (args[i]));
unsigned int len = value_type (args[i])->length ();
unsigned int space = align_up (len, 4);
memcpy (data, value_contents (args[i]).data (), (size_t) len);
@ -906,7 +906,7 @@ static void
arc_extract_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, gdb_byte *valbuf)
{
unsigned int len = TYPE_LENGTH (type);
unsigned int len = type->length ();
arc_debug_printf ("called");
@ -957,7 +957,7 @@ static void
arc_store_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, const gdb_byte *valbuf)
{
unsigned int len = TYPE_LENGTH (type);
unsigned int len = type->length ();
arc_debug_printf ("called");
@ -1029,7 +1029,7 @@ arc_return_value (struct gdbarch *gdbarch, struct value *function,
stored. Otherwise, the result is returned in registers. */
int is_struct_return = (valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION
|| TYPE_LENGTH (valtype) > 2 * ARC_REGISTER_SIZE);
|| valtype->length () > 2 * ARC_REGISTER_SIZE);
arc_debug_printf ("readbuf = %s, writebuf = %s",
host_address_to_string (readbuf),
@ -2237,7 +2237,7 @@ arc_type_align (struct gdbarch *gdbarch, struct type *type)
case TYPE_CODE_METHODPTR:
case TYPE_CODE_MEMBERPTR:
type = check_typedef (type);
return std::min<ULONGEST> (4, TYPE_LENGTH (type));
return std::min<ULONGEST> (4, type->length ());
default:
return 0;
}

View File

@ -4132,10 +4132,10 @@ arm_type_align (gdbarch *gdbarch, struct type *t)
{
/* Use the natural alignment for vector types (the same for
scalar type), but the maximum alignment is 64-bit. */
if (TYPE_LENGTH (t) > 8)
if (t->length () > 8)
return 8;
else
return TYPE_LENGTH (t);
return t->length ();
}
/* Allow the common code to calculate the alignment. */
@ -4218,7 +4218,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
switch (t->code ())
{
case TYPE_CODE_FLT:
switch (TYPE_LENGTH (t))
switch (t->length ())
{
case 4:
if (*base_type == VFP_CPRC_UNKNOWN)
@ -4250,7 +4250,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
};
*/
switch (TYPE_LENGTH (t))
switch (t->length ())
{
case 8:
if (*base_type == VFP_CPRC_UNKNOWN)
@ -4277,7 +4277,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
{
/* A 64-bit or 128-bit containerized vector type are VFP
CPRCs. */
switch (TYPE_LENGTH (t))
switch (t->length ())
{
case 8:
if (*base_type == VFP_CPRC_UNKNOWN)
@ -4300,7 +4300,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
base_type);
if (count == -1)
return -1;
if (TYPE_LENGTH (t) == 0)
if (t->length () == 0)
{
gdb_assert (count == 0);
return 0;
@ -4308,8 +4308,8 @@ arm_vfp_cprc_sub_candidate (struct type *t,
else if (count == 0)
return -1;
unitlen = arm_vfp_cprc_unit_length (*base_type);
gdb_assert ((TYPE_LENGTH (t) % unitlen) == 0);
return TYPE_LENGTH (t) / unitlen;
gdb_assert ((t->length () % unitlen) == 0);
return t->length () / unitlen;
}
}
break;
@ -4330,7 +4330,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
return -1;
count += sub_count;
}
if (TYPE_LENGTH (t) == 0)
if (t->length () == 0)
{
gdb_assert (count == 0);
return 0;
@ -4338,7 +4338,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
else if (count == 0)
return -1;
unitlen = arm_vfp_cprc_unit_length (*base_type);
if (TYPE_LENGTH (t) != unitlen * count)
if (t->length () != unitlen * count)
return -1;
return count;
}
@ -4356,7 +4356,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
return -1;
count = (count > sub_count ? count : sub_count);
}
if (TYPE_LENGTH (t) == 0)
if (t->length () == 0)
{
gdb_assert (count == 0);
return 0;
@ -4364,7 +4364,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
else if (count == 0)
return -1;
unitlen = arm_vfp_cprc_unit_length (*base_type);
if (TYPE_LENGTH (t) != unitlen * count)
if (t->length () != unitlen * count)
return -1;
return count;
}
@ -4484,7 +4484,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int may_use_core_reg = 1;
arg_type = check_typedef (value_type (args[argnum]));
len = TYPE_LENGTH (arg_type);
len = arg_type->length ();
target_type = arg_type->target_type ();
typecode = arg_type->code ();
val = value_contents (args[argnum]).data ();
@ -8705,7 +8705,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
not using the VFP ABI code. */
case ARM_FLOAT_VFP:
regs->cooked_read (ARM_A1_REGNUM, valbuf);
if (TYPE_LENGTH (type) > 4)
if (type->length () > 4)
regs->cooked_read (ARM_A1_REGNUM + 1,
valbuf + ARM_INT_REGISTER_SIZE);
break;
@ -8728,7 +8728,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
/* If the type is a plain integer, then the access is
straight-forward. Otherwise we have to play around a bit
more. */
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = ARM_A1_REGNUM;
ULONGEST tmp;
@ -8750,7 +8750,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
/* For a structure or union the behaviour is as if the value had
been stored to word-aligned memory and then loaded into
registers with 32-bit load instruction(s). */
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = ARM_A1_REGNUM;
bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE];
@ -8788,7 +8788,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
{
/* Vector values should be returned using ARM registers if they
are not over 16 bytes. */
return (TYPE_LENGTH (type) > 16);
return (type->length () > 16);
}
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
@ -8796,7 +8796,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
{
/* The AAPCS says all aggregates not larger than a word are returned
in a register. */
if (TYPE_LENGTH (type) <= ARM_INT_REGISTER_SIZE
if (type->length () <= ARM_INT_REGISTER_SIZE
&& language_pass_by_reference (type).trivially_copyable)
return 0;
@ -8808,7 +8808,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
/* All aggregate types that won't fit in a register must be returned
in memory. */
if (TYPE_LENGTH (type) > ARM_INT_REGISTER_SIZE
if (type->length () > ARM_INT_REGISTER_SIZE
|| !language_pass_by_reference (type).trivially_copyable)
return 1;
@ -8913,7 +8913,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
not using the VFP ABI code. */
case ARM_FLOAT_VFP:
regs->cooked_write (ARM_A1_REGNUM, valbuf);
if (TYPE_LENGTH (type) > 4)
if (type->length () > 4)
regs->cooked_write (ARM_A1_REGNUM + 1,
valbuf + ARM_INT_REGISTER_SIZE);
break;
@ -8932,7 +8932,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
|| TYPE_IS_REFERENCE (type)
|| type->code () == TYPE_CODE_ENUM)
{
if (TYPE_LENGTH (type) <= 4)
if (type->length () <= 4)
{
/* Values of one word or less are zero/sign-extended and
returned in r0. */
@ -8947,7 +8947,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
/* Integral values greater than one word are stored in consecutive
registers starting with r0. This will always be a multiple of
the regiser size. */
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = ARM_A1_REGNUM;
while (len > 0)
@ -8963,7 +8963,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
/* For a structure or union the behaviour is as if the value had
been stored to word-aligned memory and then loaded into
registers with 32-bit load instruction(s). */
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = ARM_A1_REGNUM;
bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE];
@ -9053,7 +9053,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function,
CORE_ADDR addr;
regcache->cooked_read (ARM_A1_REGNUM, &addr);
read_memory (addr, readbuf, TYPE_LENGTH (valtype));
read_memory (addr, readbuf, valtype->length ());
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
}

View File

@ -84,7 +84,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
struct bound_minimal_symbol msym;
CORE_ADDR data_address, pointer_address;
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
size_t ptr_size = TYPE_LENGTH (ptr_type);
size_t ptr_size = ptr_type->length ();
size_t auxv_pair_size = 2 * ptr_size;
gdb_byte *ptr_buf = (gdb_byte *) alloca (ptr_size);
LONGEST retval;
@ -255,7 +255,7 @@ generic_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr,
int sizeof_auxv_type)
{
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
const int sizeof_auxv_val = TYPE_LENGTH (ptr_type);
const int sizeof_auxv_val = ptr_type->length ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte *ptr = *readptr;
@ -286,7 +286,7 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
{
struct gdbarch *gdbarch = target_gdbarch ();
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
const int sizeof_auxv_type = TYPE_LENGTH (ptr_type);
const int sizeof_auxv_type = ptr_type->length ();
return generic_auxv_parse (gdbarch, readptr, endptr, typep, valp,
sizeof_auxv_type);
@ -299,7 +299,7 @@ svr4_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
struct type *int_type = builtin_type (gdbarch)->builtin_int;
const int sizeof_auxv_type = TYPE_LENGTH (int_type);
const int sizeof_auxv_type = int_type->length ();
return generic_auxv_parse (gdbarch, readptr, endptr, typep, valp,
sizeof_auxv_type);

View File

@ -315,7 +315,7 @@ avr_address_to_pointer (struct gdbarch *gdbarch,
if (AVR_TYPE_ADDRESS_CLASS_FLASH (type))
{
/* A data pointer in flash is byte addressed. */
store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
store_unsigned_integer (buf, type->length (), byte_order,
avr_convert_iaddr_to_raw (addr));
}
/* Is it a code address? */
@ -324,13 +324,13 @@ avr_address_to_pointer (struct gdbarch *gdbarch,
{
/* A code pointer is word (16 bits) addressed. We shift the address down
by 1 bit to convert it to a pointer. */
store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
store_unsigned_integer (buf, type->length (), byte_order,
avr_convert_iaddr_to_raw (addr >> 1));
}
else
{
/* Strip off any upper segment bits. */
store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
store_unsigned_integer (buf, type->length (), byte_order,
avr_convert_saddr_to_raw (addr));
}
}
@ -341,7 +341,7 @@ avr_pointer_to_address (struct gdbarch *gdbarch,
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR addr
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
= extract_unsigned_integer (buf, type->length (), byte_order);
/* Is it a data address in flash? */
if (AVR_TYPE_ADDRESS_CLASS_FLASH (type))
@ -946,27 +946,27 @@ avr_return_value (struct gdbarch *gdbarch, struct value *function,
if ((valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION
|| valtype->code () == TYPE_CODE_ARRAY)
&& TYPE_LENGTH (valtype) > 8)
&& valtype->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
if (TYPE_LENGTH (valtype) <= 2)
if (valtype->length () <= 2)
lsb_reg = 24;
else if (TYPE_LENGTH (valtype) <= 4)
else if (valtype->length () <= 4)
lsb_reg = 22;
else if (TYPE_LENGTH (valtype) <= 8)
else if (valtype->length () <= 8)
lsb_reg = 18;
else
gdb_assert_not_reached ("unexpected type length");
if (writebuf != NULL)
{
for (i = 0; i < TYPE_LENGTH (valtype); i++)
for (i = 0; i < valtype->length (); i++)
regcache->cooked_write (lsb_reg + i, writebuf + i);
}
if (readbuf != NULL)
{
for (i = 0; i < TYPE_LENGTH (valtype); i++)
for (i = 0; i < valtype->length (); i++)
regcache->cooked_read (lsb_reg + i, readbuf + i);
}
@ -1302,7 +1302,7 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value *arg = args[i];
struct type *type = check_typedef (value_type (arg));
const bfd_byte *contents = value_contents (arg).data ();
int len = TYPE_LENGTH (type);
int len = type->length ();
/* Calculate the potential last register needed.
E.g. For length 2, registers regnum and regnum-1 (say 25 and 24)

View File

@ -221,7 +221,7 @@ gen_trace_static_fields (struct agent_expr *ax,
{
/* Initialize the TYPE_LENGTH if it is a typedef. */
check_typedef (value.type);
ax_const_l (ax, TYPE_LENGTH (value.type));
ax_const_l (ax, value.type->length ());
ax_simple (ax, aop_trace);
}
break;
@ -292,7 +292,7 @@ gen_traced_pop (struct agent_expr *ax, struct axs_value *value)
"const8 SIZE trace" is also three bytes, does the same
thing, and the simplest code which generates that will also
work correctly for objects with large sizes. */
ax_const_l (ax, TYPE_LENGTH (value->type));
ax_const_l (ax, value->type->length ());
ax_simple (ax, aop_trace);
}
}
@ -337,7 +337,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *type)
{
/* Do we need to sign-extend this? */
if (!type->is_unsigned ())
ax_ext (ax, TYPE_LENGTH (type) * TARGET_CHAR_BIT);
ax_ext (ax, type->length () * TARGET_CHAR_BIT);
}
@ -347,7 +347,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *type)
static void
gen_extend (struct agent_expr *ax, struct type *type)
{
int bits = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
int bits = type->length () * TARGET_CHAR_BIT;
/* I just had to. */
((type->is_unsigned () ? ax_zero_ext : ax_ext) (ax, bits));
@ -363,7 +363,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
if (ax->tracing)
{
/* Record the area of memory we're about to fetch. */
ax_trace_quick (ax, TYPE_LENGTH (type));
ax_trace_quick (ax, type->length ());
}
if (type->code () == TYPE_CODE_RANGE)
@ -380,7 +380,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
case TYPE_CODE_BOOL:
/* It's a scalar value, so we know how to dereference it. How
many bytes long is it? */
switch (TYPE_LENGTH (type))
switch (type->length ())
{
case 8 / TARGET_CHAR_BIT:
ax_simple (ax, aop_ref8);
@ -761,8 +761,8 @@ gen_usual_unary (struct agent_expr *ax, struct axs_value *value)
static int
type_wider_than (struct type *type1, struct type *type2)
{
return (TYPE_LENGTH (type1) > TYPE_LENGTH (type2)
|| (TYPE_LENGTH (type1) == TYPE_LENGTH (type2)
return (type1->length () > type2->length ()
|| (type1->length () == type2->length ()
&& type1->is_unsigned ()
&& !type2->is_unsigned ()));
}
@ -784,12 +784,12 @@ gen_conversion (struct agent_expr *ax, struct type *from, struct type *to)
/* If we're converting to a narrower type, then we need to clear out
the upper bits. */
if (TYPE_LENGTH (to) < TYPE_LENGTH (from))
if (to->length () < from->length ())
gen_extend (ax, to);
/* If the two values have equal width, but different signednesses,
then we need to extend. */
else if (TYPE_LENGTH (to) == TYPE_LENGTH (from))
else if (to->length () == from->length ())
{
if (from->is_unsigned () != to->is_unsigned ())
gen_extend (ax, to);
@ -797,7 +797,7 @@ gen_conversion (struct agent_expr *ax, struct type *from, struct type *to)
/* If we're converting to a wider type, and becoming unsigned, then
we need to zero out any possible sign bits. */
else if (TYPE_LENGTH (to) > TYPE_LENGTH (from))
else if (to->length () > from->length ())
{
if (to->is_unsigned ())
gen_extend (ax, to);
@ -948,9 +948,9 @@ gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type)
{
struct type *element = type->target_type ();
if (TYPE_LENGTH (element) != 1)
if (element->length () != 1)
{
ax_const_l (ax, TYPE_LENGTH (element));
ax_const_l (ax, element->length ());
ax_simple (ax, op);
}
}
@ -997,8 +997,8 @@ gen_ptrdiff (struct agent_expr *ax, struct axs_value *value,
gdb_assert (value1->type->is_pointer_or_reference ());
gdb_assert (value2->type->is_pointer_or_reference ());
if (TYPE_LENGTH (value1->type->target_type ())
!= TYPE_LENGTH (value2->type->target_type ()))
if (value1->type->target_type ()->length ()
!= value2->type->target_type ()->length ())
error (_("\
First argument of `-' is a pointer, but second argument is neither\n\
an integer nor a pointer of the same type."));
@ -1810,7 +1810,7 @@ unop_sizeof_operation::do_generate_ax (struct expression *exp,
/* Throw away the code we just generated. */
ax->len = start;
ax_const_l (ax, TYPE_LENGTH (value->type));
ax_const_l (ax, value->type->length ());
value->kind = axs_rvalue;
value->type = builtin_type (ax->gdbarch)->builtin_int;
}

View File

@ -511,7 +511,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
{
struct type *value_type = value_enclosing_type (args[i]);
total_len += align_up (TYPE_LENGTH (value_type), 4);
total_len += align_up (value_type->length (), 4);
}
/* At least twelve bytes of stack space must be allocated for the function's
@ -527,7 +527,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
{
struct type *value_type = value_enclosing_type (args[i]);
struct type *arg_type = check_typedef (value_type);
int container_len = align_up (TYPE_LENGTH (arg_type), 4);
int container_len = align_up (arg_type->length (), 4);
sp -= container_len;
write_memory (sp, value_contents (args[i]).data (), container_len);
@ -612,7 +612,7 @@ bfin_extract_return_value (struct type *type,
struct gdbarch *gdbarch = regs->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
bfd_byte *valbuf = dst;
int len = TYPE_LENGTH (type);
int len = type->length ();
ULONGEST tmp;
int regno = BFIN_R0_REGNUM;
@ -641,7 +641,7 @@ bfin_store_return_value (struct type *type,
registers starting with R0. This will always be a multiple of
the register size. */
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = BFIN_R0_REGNUM;
gdb_assert (len <= 8);
@ -668,7 +668,7 @@ bfin_return_value (struct gdbarch *gdbarch,
gdb_byte *readbuf,
const gdb_byte *writebuf)
{
if (TYPE_LENGTH (type) > 8)
if (type->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)

View File

@ -265,7 +265,7 @@ static void
bpf_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
gdb_byte vbuf[8];
gdb_assert (len <= 8);
@ -279,7 +279,7 @@ static void
bpf_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
gdb_byte vbuf[8];
gdb_assert (len <= 8);
@ -295,7 +295,7 @@ bpf_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
if (len > 8)
return RETURN_VALUE_STRUCT_CONVENTION;

View File

@ -2120,7 +2120,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
loc->length = ((bitpos % 8) + bitsize + 7) / 8;
}
else
loc->length = TYPE_LENGTH (value_type (v));
loc->length = value_type (v)->length ();
loc->watchpoint_type = type;
}
@ -10259,7 +10259,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
len = (target_exact_watchpoints
&& is_scalar_type_recursive (vtype))?
1 : TYPE_LENGTH (value_type (v));
1 : value_type (v)->length ();
num_regs = target_region_ok_for_hw_watchpoint (vaddr, len);
if (!num_regs)

View File

@ -957,7 +957,7 @@ exp : SIZEOF '(' type ')' %prec UNARY
type = check_typedef (type->target_type ());
pstate->push_new<long_const_operation>
(int_type, TYPE_LENGTH (type));
(int_type, type->length ());
}
;

View File

@ -280,7 +280,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
if (! c_textual_element_type (element_type, 0))
goto error;
classify_type (element_type, element_type->arch (), charset);
width = TYPE_LENGTH (element_type);
width = element_type->length ();
/* If the string lives in GDB's memory instead of the inferior's,
then we just need to copy it to BUFFER. Also, since such strings
@ -433,9 +433,9 @@ emit_numeric_character (struct type *type, unsigned long value,
{
gdb_byte *buffer;
buffer = (gdb_byte *) alloca (TYPE_LENGTH (type));
buffer = (gdb_byte *) alloca (type->length ());
pack_long (buffer, type, value);
obstack_grow (output, buffer, TYPE_LENGTH (type));
obstack_grow (output, buffer, type->length ());
}
/* Convert an octal escape sequence. TYPE is the target character
@ -645,7 +645,7 @@ c_string_operation::evaluate (struct type *expect_type,
{
LONGEST value;
if (obstack_object_size (&output) != TYPE_LENGTH (type))
if (obstack_object_size (&output) != type->length ())
error (_("Could not convert character "
"constant to target character set"));
value = unpack_long (type, (gdb_byte *) obstack_base (&output));
@ -656,19 +656,19 @@ c_string_operation::evaluate (struct type *expect_type,
int i;
/* Write the terminating character. */
for (i = 0; i < TYPE_LENGTH (type); ++i)
for (i = 0; i < type->length (); ++i)
obstack_1grow (&output, 0);
if (satisfy_expected)
{
LONGEST low_bound, high_bound;
int element_size = TYPE_LENGTH (type);
int element_size = type->length ();
if (!get_discrete_bounds (expect_type->index_type (),
&low_bound, &high_bound))
{
low_bound = 0;
high_bound = (TYPE_LENGTH (expect_type) / element_size) - 1;
high_bound = (expect_type->length () / element_size) - 1;
}
if (obstack_object_size (&output) / element_size
> (high_bound - low_bound + 1))
@ -707,8 +707,8 @@ c_is_string_type_p (struct type *type)
{
/* See if target type looks like a string. */
struct type *array_target_type = type->target_type ();
return (TYPE_LENGTH (type) > 0
&& TYPE_LENGTH (array_target_type) > 0
return (type->length () > 0
&& array_target_type->length () > 0
&& c_textual_element_type (array_target_type, 0));
}
case TYPE_CODE_STRING:

View File

@ -1188,7 +1188,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
the whole struct/union. */
local_podata.end_bitpos
= podata->end_bitpos
- TYPE_LENGTH (type->field (i).type ()) * TARGET_CHAR_BIT;
- type->field (i).type ()->length () * TARGET_CHAR_BIT;
}
c_print_type_1 (type->field (i).type (),

View File

@ -98,7 +98,7 @@ c_textual_element_type (struct type *type, char format)
/* Print this as a string if we can manage it. For now, no wide
character support. */
if (true_type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (true_type) == 1)
&& true_type->length () == 1)
return 1;
}
else
@ -107,7 +107,7 @@ c_textual_element_type (struct type *type, char format)
flag, then we treat it as text; otherwise, we assume it's
being used as data. */
if (true_type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (true_type) == 1
&& true_type->length () == 1
&& !TYPE_NOTTEXT (true_type))
return 1;
}
@ -241,7 +241,7 @@ c_value_print_array (struct value *val,
struct type *unresolved_elttype = type->target_type ();
struct type *elttype = check_typedef (unresolved_elttype);
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0)
if (type->length () > 0 && unresolved_elttype->length () > 0)
{
LONGEST low_bound, high_bound;
int eltlen, len;
@ -250,16 +250,16 @@ c_value_print_array (struct value *val,
if (!get_array_bounds (type, &low_bound, &high_bound))
error (_("Could not determine the array high bound"));
eltlen = TYPE_LENGTH (elttype);
eltlen = elttype->length ();
len = high_bound - low_bound + 1;
/* Print arrays of textual chars with a string syntax, as
long as the entire array is valid. */
if (c_textual_element_type (unresolved_elttype,
options->format)
&& value_bytes_available (val, 0, TYPE_LENGTH (type))
&& value_bytes_available (val, 0, type->length ())
&& !value_bits_any_optimized_out (val, 0,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
TARGET_CHAR_BIT * type->length ()))
{
int force_ellipses = 0;
@ -569,8 +569,8 @@ c_value_print (struct value *val, struct ui_file *stream,
superclass of the object's type. In this case it is
better to leave the object as-is. */
if (!(full
&& (TYPE_LENGTH (real_type)
< TYPE_LENGTH (value_enclosing_type (val)))))
&& (real_type->length ()
< value_enclosing_type (val)->length ())))
val = value_cast (real_type, val);
gdb_printf (stream, "(%s%s) ",
real_type->name (),

View File

@ -191,9 +191,9 @@ c_number_of_children (const struct varobj *var)
switch (type->code ())
{
case TYPE_CODE_ARRAY:
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0
if (type->length () > 0 && target->length () > 0
&& (type->bounds ()->high.kind () != PROP_UNDEFINED))
children = TYPE_LENGTH (type) / TYPE_LENGTH (target);
children = type->length () / target->length ();
else
/* If we don't know how many elements there are, don't display
any. */

View File

@ -225,7 +225,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
/* Have everything. Open/write the data. */
if (file_format == NULL || strcmp (file_format, "binary") == 0)
dump_binary_file (filename.get (), mode, value_contents (val).data (),
TYPE_LENGTH (value_type (val)));
value_type (val)->length ());
else
{
CORE_ADDR vaddr;
@ -242,7 +242,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
dump_bfd_file (filename.get (), mode, file_format, vaddr,
value_contents (val).data (),
TYPE_LENGTH (value_type (val)));
value_type (val)->length ());
}
}

View File

@ -1509,7 +1509,7 @@ patch_opaque_types (struct symtab *s)
if (real_sym->aclass () == LOC_TYPEDEF
&& real_sym->domain () == VAR_DOMAIN
&& real_sym->type ()->code () == TYPE_CODE_PTR
&& TYPE_LENGTH (real_sym->type ()->target_type ()) != 0)
&& real_sym->type ()->target_type ()->length () != 0)
{
const char *name = real_sym->linkage_name ();
int hash = hashname (name);
@ -1699,7 +1699,7 @@ process_coff_symbol (struct coff_symbol *cs,
references work themselves out via the magic of
coff_lookup_type. */
if (sym->type ()->code () == TYPE_CODE_PTR
&& TYPE_LENGTH (sym->type ()->target_type ()) == 0
&& sym->type ()->target_type ()->length () == 0
&& sym->type ()->target_type ()->code ()
!= TYPE_CODE_UNDEF)
{

View File

@ -252,7 +252,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
case TYPE_CODE_INT:
{
const char *mode
= c_get_mode_for_size (TYPE_LENGTH (regtype));
= c_get_mode_for_size (regtype->length ());
if (mode != NULL)
{
@ -275,7 +275,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
" __attribute__((__aligned__("
"__BIGGEST_ALIGNMENT__)))",
regname.c_str (),
pulongest (TYPE_LENGTH (regtype)));
pulongest (regtype->length ()));
}
gdb_puts (";\n", stream);
}

View File

@ -110,7 +110,7 @@ convert_struct_or_union (compile_c_instance *context, struct type *type)
field_type = context->convert_type (type->field (i).type ());
if (bitsize == 0)
bitsize = 8 * TYPE_LENGTH (type->field (i).type ());
bitsize = 8 * type->field (i).type ()->length ();
context->plugin ().build_add_field (result,
type->field (i).name (),
field_type,
@ -118,7 +118,7 @@ convert_struct_or_union (compile_c_instance *context, struct type *type)
type->field (i).loc_bitpos ());
}
context->plugin ().finish_record_or_union (result, TYPE_LENGTH (type));
context->plugin ().finish_record_or_union (result, type->length ());
return result;
}
@ -131,7 +131,7 @@ convert_enum (compile_c_instance *context, struct type *type)
int i;
int_type = context->plugin ().int_type_v0 (type->is_unsigned (),
TYPE_LENGTH (type));
type->length ());
result = context->plugin ().build_enum_type (int_type);
for (i = 0; i < type->num_fields (); ++i)
@ -196,16 +196,16 @@ convert_int (compile_c_instance *context, struct type *type)
{
if (type->has_no_signedness ())
{
gdb_assert (TYPE_LENGTH (type) == 1);
gdb_assert (type->length () == 1);
return context->plugin ().char_type ();
}
return context->plugin ().int_type (type->is_unsigned (),
TYPE_LENGTH (type),
type->length (),
type->name ());
}
else
return context->plugin ().int_type_v0 (type->is_unsigned (),
TYPE_LENGTH (type));
type->length ());
}
/* Convert a floating-point type to its gcc representation. */
@ -214,10 +214,10 @@ static gcc_type
convert_float (compile_c_instance *context, struct type *type)
{
if (context->plugin ().version () >= GCC_C_FE_VERSION_1)
return context->plugin ().float_type (TYPE_LENGTH (type),
return context->plugin ().float_type (type->length (),
type->name ());
else
return context->plugin ().float_type_v0 (TYPE_LENGTH (type));
return context->plugin ().float_type_v0 (type->length ());
}
/* Convert the 'void' type to its gcc representation. */

View File

@ -648,7 +648,7 @@ compile_cplus_convert_struct_or_union_members
| get_field_access_flag (type, i);
if (bitsize == 0)
bitsize = 8 * TYPE_LENGTH (type->field (i).type ());
bitsize = 8 * type->field (i).type ()->length ();
instance->plugin ().build_field
(field_name, field_type, field_flags, bitsize,
@ -891,7 +891,7 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
compile_cplus_convert_struct_or_union_members (instance, type, result);
/* All finished. */
instance->plugin ().finish_class_type (name.get (), TYPE_LENGTH (type));
instance->plugin ().finish_class_type (name.get (), type->length ());
/* Pop all scopes. */
instance->leave_scope ();
@ -926,7 +926,7 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type,
gcc_type int_type
= instance->plugin ().get_int_type (type->is_unsigned (),
TYPE_LENGTH (type), nullptr);
type->length (), nullptr);
gcc_type result
= instance->plugin ().start_enum_type (name.get (), int_type,
GCC_CP_SYMBOL_ENUM | nested_access
@ -1012,12 +1012,12 @@ compile_cplus_convert_int (compile_cplus_instance *instance, struct type *type)
{
if (type->has_no_signedness ())
{
gdb_assert (TYPE_LENGTH (type) == 1);
gdb_assert (type->length () == 1);
return instance->plugin ().get_char_type ();
}
return instance->plugin ().get_int_type
(type->is_unsigned (), TYPE_LENGTH (type), type->name ());
(type->is_unsigned (), type->length (), type->name ());
}
/* Convert a floating-point type to its gcc representation. */
@ -1027,7 +1027,7 @@ compile_cplus_convert_float (compile_cplus_instance *instance,
struct type *type)
{
return instance->plugin ().get_float_type
(TYPE_LENGTH (type), type->name ());
(type->length (), type->name ());
}
/* Convert the 'void' type to its gcc representation. */

View File

@ -557,7 +557,7 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
ULONGEST reg_offset;
struct type *reg_type
= check_typedef (regs_type->field (fieldno).type ());
ULONGEST reg_size = TYPE_LENGTH (reg_type);
ULONGEST reg_size = reg_type->length ();
int regnum;
struct value *regval;
CORE_ADDR inferior_addr;
@ -806,15 +806,15 @@ compile_object_load (const compile_file_names &file_names,
{
/* Use read-only non-executable memory protection. */
regs_addr = gdbarch_infcall_mmap (target_gdbarch (),
TYPE_LENGTH (regs_type),
regs_type->length (),
GDB_MMAP_PROT_READ);
gdb_assert (regs_addr != 0);
setup_sections_data.munmap_list.add (regs_addr, TYPE_LENGTH (regs_type));
setup_sections_data.munmap_list.add (regs_addr, regs_type->length ());
if (compile_debug)
gdb_printf (gdb_stdlog,
"allocated %s bytes at %s for registers\n",
paddress (target_gdbarch (),
TYPE_LENGTH (regs_type)),
regs_type->length ()),
paddress (target_gdbarch (), regs_addr));
store_regs (regs_type, regs_addr);
}
@ -827,17 +827,17 @@ compile_object_load (const compile_file_names &file_names,
return NULL;
check_typedef (out_value_type);
out_value_addr = gdbarch_infcall_mmap (target_gdbarch (),
TYPE_LENGTH (out_value_type),
out_value_type->length (),
(GDB_MMAP_PROT_READ
| GDB_MMAP_PROT_WRITE));
gdb_assert (out_value_addr != 0);
setup_sections_data.munmap_list.add (out_value_addr,
TYPE_LENGTH (out_value_type));
out_value_type->length ());
if (compile_debug)
gdb_printf (gdb_stdlog,
"allocated %s bytes at %s for printed value\n",
paddress (target_gdbarch (),
TYPE_LENGTH (out_value_type)),
out_value_type->length ()),
paddress (target_gdbarch (), out_value_addr));
}

View File

@ -335,9 +335,9 @@ read_code_unsigned_integer (CORE_ADDR memaddr, int len,
CORE_ADDR
read_memory_typed_address (CORE_ADDR addr, struct type *type)
{
gdb_byte *buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
gdb_byte *buf = (gdb_byte *) alloca (type->length ());
read_memory (addr, buf, TYPE_LENGTH (type));
read_memory (addr, buf, type->length ());
return extract_typed_address (buf, type);
}

View File

@ -451,12 +451,12 @@ cp_print_value (struct value *val, struct ui_file *stream,
clobbered by the user program. Make sure that it
still points to a valid memory location. */
if (boffset < 0 || boffset >= TYPE_LENGTH (type))
if (boffset < 0 || boffset >= type->length ())
{
gdb::byte_vector buf (TYPE_LENGTH (baseclass));
gdb::byte_vector buf (baseclass->length ());
if (target_read_memory (address + boffset, buf.data (),
TYPE_LENGTH (baseclass)) != 0)
baseclass->length ()) != 0)
skip = 1;
base_val = value_from_contents_and_address (baseclass,
buf.data (),
@ -652,7 +652,7 @@ cp_find_class_member (struct type **self_p, int *fieldno,
for (i = 0; i < TYPE_N_BASECLASSES (self); i++)
{
LONGEST bitpos = self->field (i).loc_bitpos ();
LONGEST bitsize = 8 * TYPE_LENGTH (self->field (i).type ());
LONGEST bitsize = 8 * self->field (i).type ()->length ();
if (offset >= bitpos && offset < bitpos + bitsize)
{
@ -679,7 +679,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct type *type,
int fieldno;
val = extract_signed_integer (valaddr,
TYPE_LENGTH (type),
type->length (),
byte_order);
/* Pointers to data members are usually byte offsets into an object.
@ -763,7 +763,7 @@ test_print_fields (gdbarch *arch)
value *val = allocate_value (the_struct);
gdb_byte *contents = value_contents_writeable (val).data ();
store_unsigned_integer (contents, TYPE_LENGTH (value_enclosing_type (val)),
store_unsigned_integer (contents, value_enclosing_type (val)->length (),
gdbarch_byte_order (arch), 0xe9);
string_file out;

View File

@ -821,7 +821,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int reg_demand;
int i;
len = TYPE_LENGTH (value_type (args[argnum]));
len = value_type (args[argnum])->length ();
val = value_contents (args[argnum]).data ();
/* How may registers worth of storage do we need for this argument? */
@ -1611,7 +1611,7 @@ cris_store_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
int len = TYPE_LENGTH (type);
int len = type->length ();
if (len <= 4)
{
@ -1779,7 +1779,7 @@ cris_extract_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
int len = TYPE_LENGTH (type);
int len = type->length ();
if (len <= 4)
{
@ -1808,7 +1808,7 @@ cris_return_value (struct gdbarch *gdbarch, struct value *function,
{
if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION
|| TYPE_LENGTH (type) > 8)
|| type->length () > 8)
/* Structs, unions, and anything larger than 8 bytes (2 registers)
goes on the stack. */
return RETURN_VALUE_STRUCT_CONVENTION;

View File

@ -802,7 +802,7 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
const gdb_byte *val;
arg_type = check_typedef (value_type (args[argnum]));
len = TYPE_LENGTH (arg_type);
len = arg_type->length ();
val = value_contents (args[argnum]).data ();
/* Copy the argument to argument registers or the dummy stack.
@ -869,7 +869,7 @@ csky_return_value (struct gdbarch *gdbarch, struct value *function,
{
CORE_ADDR regval;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (valtype);
int len = valtype->length ();
unsigned int ret_regnum = CSKY_RET_REGNUM;
/* Csky abi specifies that return values larger than 8 bytes

View File

@ -749,7 +749,7 @@ read_enum_type (struct ctf_context *ccp, ctf_id_t tid)
type->set_code (TYPE_CODE_ENUM);
type->set_length (ctf_type_size (fp, tid));
/* Set the underlying type based on its ctf_type_size bits. */
type->set_target_type (objfile_int_type (of, TYPE_LENGTH (type), false));
type->set_target_type (objfile_int_type (of, type->length (), false));
set_type_align (type, ctf_type_align (fp, tid));
return set_tid_type (of, tid, type);

View File

@ -40,7 +40,7 @@ dynamic_array_type (struct type *type,
&& strcmp (type->field (1).name (), "ptr") == 0
&& !value_bits_any_optimized_out (val,
TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
TARGET_CHAR_BIT * type->length ()))
{
CORE_ADDR addr;
struct type *elttype;

View File

@ -110,7 +110,7 @@ dwarf2_cu::addr_type () const
struct type *addr_type = lookup_pointer_type (void_type);
int addr_size = this->per_cu->addr_size ();
if (TYPE_LENGTH (addr_type) == addr_size)
if (addr_type->length () == addr_size)
return addr_type;
addr_type = addr_sized_int_type (addr_type->is_unsigned ());

View File

@ -182,14 +182,14 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
== BFD_ENDIAN_BIG))
{
/* Use the least significant bits of FROM. */
max_offset = 8 * TYPE_LENGTH (value_type (from));
max_offset = 8 * value_type (from)->length ();
offset = max_offset - value_bitsize (v);
}
else
max_offset = value_bitsize (v);
}
else
max_offset = 8 * TYPE_LENGTH (value_type (v));
max_offset = 8 * value_type (v)->length ();
/* Advance to the first non-skipped piece. */
for (i = 0; i < c->pieces.size () && bits_to_skip >= c->pieces[i].size; i++)
@ -368,7 +368,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
gdbarch *objfile_gdbarch = c->per_objfile->objfile->arch ();
ULONGEST stack_value_size_bits
= 8 * TYPE_LENGTH (value_type (p->v.value));
= 8 * value_type (p->v.value)->length ();
/* Use zeroes if piece reaches beyond stack value. */
if (p->offset + p->size > stack_value_size_bits)
@ -515,7 +515,7 @@ indirect_pieced_value (value *value)
if (type->code () != TYPE_CODE_PTR)
return NULL;
int bit_length = 8 * TYPE_LENGTH (type);
int bit_length = 8 * type->length ();
LONGEST bit_offset = 8 * value_offset (value);
if (value_bitsize (value))
bit_offset += value_bitpos (value);
@ -581,7 +581,7 @@ coerce_pieced_ref (const value *value)
struct type *type = check_typedef (value_type (value));
if (value_bits_synthetic_pointer (value, value_embedded_offset (value),
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
TARGET_CHAR_BIT * type->length ()))
{
const piece_closure *closure
= (piece_closure *) value_computed_closure (value);
@ -930,7 +930,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
bit_size += piece.size;
/* Complain if the expression is larger than the size of the
outer type. */
if (bit_size > 8 * TYPE_LENGTH (type))
if (bit_size > 8 * type->length ())
invalid_synthetic_pointer ();
piece_closure *c
@ -974,7 +974,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
<optimized out> instead of <not saved>. */
value *tmp = allocate_value (subobj_type);
value_contents_copy (tmp, 0, retval, 0,
TYPE_LENGTH (subobj_type));
subobj_type->length ());
retval = tmp;
}
}
@ -1016,9 +1016,9 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
case DWARF_VALUE_STACK:
{
value *val = this->fetch (0);
size_t n = TYPE_LENGTH (value_type (val));
size_t len = TYPE_LENGTH (subobj_type);
size_t max = TYPE_LENGTH (type);
size_t n = value_type (val)->length ();
size_t len = subobj_type->length ();
size_t max = type->length ();
if (subobj_offset + len > max)
invalid_synthetic_pointer ();
@ -1036,7 +1036,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
case DWARF_VALUE_LITERAL:
{
size_t n = TYPE_LENGTH (subobj_type);
size_t n = subobj_type->length ();
if (subobj_offset + n > this->m_len)
invalid_synthetic_pointer ();
@ -1100,7 +1100,7 @@ dwarf_require_integral (struct type *type)
static struct type *
get_unsigned_type (struct gdbarch *gdbarch, struct type *type)
{
switch (TYPE_LENGTH (type))
switch (type->length ())
{
case 1:
return builtin_type (gdbarch)->builtin_uint8;
@ -1122,7 +1122,7 @@ get_unsigned_type (struct gdbarch *gdbarch, struct type *type)
static struct type *
get_signed_type (struct gdbarch *gdbarch, struct type *type)
{
switch (TYPE_LENGTH (type))
switch (type->length ())
{
case 1:
return builtin_type (gdbarch)->builtin_int8;
@ -1308,7 +1308,7 @@ base_types_equal_p (struct type *t1, struct type *t2)
return 0;
if (t1->is_unsigned () != t2->is_unsigned ())
return 0;
return TYPE_LENGTH (t1) == TYPE_LENGTH (t2);
return t1->length () == t2->length ();
}
/* If <BUF..BUF_END] contains DW_FORM_block* with single DW_OP_reg* return the
@ -1906,13 +1906,13 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
/* If the size of the object read from memory is different
from the type length, we need to zero-extend it. */
if (TYPE_LENGTH (type) != addr_size)
if (type->length () != addr_size)
{
ULONGEST datum =
extract_unsigned_integer (buf, addr_size, byte_order);
buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
store_unsigned_integer (buf, TYPE_LENGTH (type),
buf = (gdb_byte *) alloca (type->length ());
store_unsigned_integer (buf, type->length (),
byte_order, datum);
}
@ -2302,7 +2302,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
type = get_base_type (type_die_cu_off);
if (TYPE_LENGTH (type) != n)
if (type->length () != n)
error (_("DW_OP_const_type has different sizes for type and data"));
result_val = value_from_contents (type, data);
@ -2350,8 +2350,8 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
{
/* Nothing. */
}
else if (TYPE_LENGTH (type)
!= TYPE_LENGTH (value_type (result_val)))
else if (type->length ()
!= value_type (result_val)->length ())
error (_("DW_OP_reinterpret has wrong size"));
else
result_val

View File

@ -1364,7 +1364,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
return outer_val;
target_val = dwarf_entry_parameter_to_value (parameter,
TYPE_LENGTH (target_type),
target_type->length (),
target_type, caller_frame,
caller_per_cu,
caller_per_objfile);
@ -1375,7 +1375,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
/* Copy the referencing pointer to the new computed value. */
memcpy (value_contents_raw (val).data (),
value_contents_raw (outer_val).data (),
TYPE_LENGTH (checked_type));
checked_type->length ());
set_value_lazy (val, 0);
return val;
@ -1430,7 +1430,7 @@ fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset,
if (bytes != NULL)
{
if (byte_offset >= 0
&& byte_offset + TYPE_LENGTH (type->target_type ()) <= len)
&& byte_offset + type->target_type ()->length () <= len)
{
bytes += byte_offset;
result = value_from_contents (type->target_type (), bytes);
@ -1526,7 +1526,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
free_values.free_to_mark ();
retval = allocate_value (subobj_type);
mark_value_bytes_unavailable (retval, 0,
TYPE_LENGTH (subobj_type));
subobj_type->length ());
return retval;
}
else if (ex.error == NO_ENTRY_VALUE_ERROR)
@ -1672,7 +1672,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
gdb_assert (baton->property_type != NULL);
struct type *type = check_typedef (baton->property_type);
if (TYPE_LENGTH (type) < sizeof (CORE_ADDR)
if (type->length () < sizeof (CORE_ADDR)
&& !type->is_unsigned ())
{
/* If we have a valid return candidate and it's value

View File

@ -8191,7 +8191,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* In Rust, each element should have the size of the
enclosing enum. */
type->field (i).type ()->set_length (TYPE_LENGTH (type));
type->field (i).type ()->set_length (type->length ());
/* Remove the discriminant field, if it exists. */
struct type *sub_type = type->field (i).type ();
@ -9012,7 +9012,7 @@ dwarf2_compute_name (const char *name,
{
v = allocate_value (type);
memcpy (value_contents_writeable (v).data (), bytes,
TYPE_LENGTH (type));
type->length ());
}
else
v = value_from_longest (type, value);
@ -13613,7 +13613,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
the bit field must be inferred from the type
attribute of the data member containing the
bit field. */
anonymous_size = TYPE_LENGTH (fp->type ());
anonymous_size = fp->type ()->length ();
}
fp->set_loc_bitpos (fp->loc_bitpos ()
+ anonymous_size * bits_per_byte
@ -14655,7 +14655,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
maybe_set_alignment (cu, die, type);
if (producer_is_icc_lt_14 (cu) && (TYPE_LENGTH (type) == 0))
if (producer_is_icc_lt_14 (cu) && (type->length () == 0))
{
/* ICC<14 does not output the required DW_AT_declaration on
incomplete types, but gives them a size of zero. */
@ -15227,8 +15227,8 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
type->set_is_unsigned (underlying_type->is_unsigned ());
if (TYPE_LENGTH (type) == 0)
type->set_length (TYPE_LENGTH (underlying_type));
if (type->length () == 0)
type->set_length (underlying_type->length ());
if (TYPE_RAW_ALIGN (type) == 0
&& TYPE_RAW_ALIGN (underlying_type) != 0)
@ -15409,7 +15409,7 @@ recognize_bound_expression (struct die_info *die, enum dwarf_attribute name,
return false;
field->set_loc_bitpos (8 * offset);
if (size != TYPE_LENGTH (field->type ()))
if (size != field->type ()->length ())
FIELD_BITSIZE (*field) = 8 * size;
return true;
@ -15524,7 +15524,7 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
int last_fieldno = range_fields.size () - 1;
int bounds_size = (bounds->field (last_fieldno).loc_bitpos () / 8
+ TYPE_LENGTH (bounds->field (last_fieldno).type ()));
+ bounds->field (last_fieldno).type ()->length ());
bounds->set_length (align_up (bounds_size, max_align));
/* Rewrite the existing array type in place. Specifically, we
@ -15559,8 +15559,8 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
result->field (1).set_loc_bitpos (8 * bounds_offset);
result->set_name (type->name ());
result->set_length (TYPE_LENGTH (result->field (0).type ())
+ TYPE_LENGTH (result->field (1).type ()));
result->set_length (result->field (0).type ()->length ()
+ result->field (1).type ()->length ());
return result;
}
@ -15700,7 +15700,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr != nullptr && attr->form_is_unsigned ())
{
if (attr->as_unsigned () >= TYPE_LENGTH (type))
if (attr->as_unsigned () >= type->length ())
type->set_length (attr->as_unsigned ());
else
complaint (_("DW_AT_byte_size for array type smaller "
@ -16158,7 +16158,7 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
/* If the pointer size, alignment, or address class is different
than the default, create a type variant marked as such and set
the length accordingly. */
if (TYPE_LENGTH (type) != byte_size
if (type->length () != byte_size
|| (alignment != 0 && TYPE_RAW_ALIGN (type) != 0
&& alignment != TYPE_RAW_ALIGN (type))
|| addr_class != DW_ADDR_none)
@ -16172,7 +16172,7 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
== 0);
type = make_type_with_address_space (type, type_flags);
}
else if (TYPE_LENGTH (type) != byte_size)
else if (type->length () != byte_size)
{
complaint (_("invalid pointer size %d"), byte_size);
}
@ -17088,7 +17088,7 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
/* If the type we found doesn't match the size we were looking for, then
pretend we didn't find a type at all, the complex target type we
create will then be nameless. */
if (tt != nullptr && TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits)
if (tt != nullptr && tt->length () * TARGET_CHAR_BIT != bits)
tt = nullptr;
const char *name = (tt == nullptr) ? nullptr : tt->name ();
@ -17280,14 +17280,14 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_INT)
{
attr = dwarf2_attr (die, DW_AT_bit_size, cu);
if (attr != nullptr && attr->as_unsigned () <= 8 * TYPE_LENGTH (type))
if (attr != nullptr && attr->as_unsigned () <= 8 * type->length ())
{
unsigned real_bit_size = attr->as_unsigned ();
attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
/* Only use the attributes if they make sense together. */
if (attr == nullptr
|| (attr->as_unsigned () + real_bit_size
<= 8 * TYPE_LENGTH (type)))
<= 8 * type->length ()))
{
TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_size
= real_bit_size;
@ -17618,7 +17618,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
the bounds as signed, and thus sign-extend their values, when
the base type is signed. */
negative_mask =
-((ULONGEST) 1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1));
-((ULONGEST) 1 << (base_type->length () * TARGET_CHAR_BIT - 1));
if (low.kind () == PROP_CONST
&& !base_type->is_unsigned () && (low.const_val () & negative_mask))
low.set_const_val (low.const_val () | negative_mask);
@ -21188,10 +21188,10 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
{
gdb_byte *data;
if (TYPE_LENGTH (type) != cu_header->addr_size)
if (type->length () != cu_header->addr_size)
dwarf2_const_value_length_mismatch_complaint (name,
cu_header->addr_size,
TYPE_LENGTH (type));
type->length ());
/* Symbols of this form are reasonably rare, so we just
piggyback on the existing location code rather than writing
a new implementation of symbol_computed_ops. */
@ -21226,9 +21226,9 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
case DW_FORM_exprloc:
case DW_FORM_data16:
blk = attr->as_block ();
if (TYPE_LENGTH (type) != blk->size)
if (type->length () != blk->size)
dwarf2_const_value_length_mismatch_complaint (name, blk->size,
TYPE_LENGTH (type));
type->length ());
*bytes = blk->data;
break;
@ -22523,7 +22523,7 @@ write_constant_as_bytes (struct obstack *obstack,
{
gdb_byte *result;
*len = TYPE_LENGTH (type);
*len = type->length ();
result = (gdb_byte *) obstack_alloc (obstack, *len);
store_unsigned_integer (result, *len, byte_order, value);

View File

@ -553,7 +553,7 @@ elf_rel_plt_read (minimal_symbol_reader &reader,
bfd_size_type reloc_count, reloc;
struct gdbarch *gdbarch = objfile->arch ();
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
size_t ptr_size = TYPE_LENGTH (ptr_type);
size_t ptr_size = ptr_type->length ();
if (objfile->separate_debug_objfile_backlink)
return;
@ -819,7 +819,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
bfd *obfd = objfile->obfd.get ();
struct gdbarch *gdbarch = objfile->arch ();
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
size_t ptr_size = TYPE_LENGTH (ptr_type);
size_t ptr_size = ptr_type->length ();
CORE_ADDR pointer_address, addr;
asection *plt;
gdb_byte *buf = (gdb_byte *) alloca (ptr_size);

View File

@ -245,7 +245,7 @@ unop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
{
struct type *builtin_int = builtin_type (gdbarch)->builtin_int;
if (TYPE_LENGTH (type1) < TYPE_LENGTH (builtin_int))
if (type1->length () < builtin_int->length ())
*arg1 = value_cast (builtin_int, *arg1);
}
break;
@ -306,8 +306,8 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
version 6.7 for backward compatibility.
If either arg was long double, make sure that value is also long
double. Otherwise use double. */
if (TYPE_LENGTH (type1) * 8 > gdbarch_double_bit (gdbarch)
|| TYPE_LENGTH (type2) * 8 > gdbarch_double_bit (gdbarch))
if (type1->length () * 8 > gdbarch_double_bit (gdbarch)
|| type2->length () * 8 > gdbarch_double_bit (gdbarch))
promoted_type = builtin_type (gdbarch)->builtin_long_double;
else
promoted_type = builtin_type (gdbarch)->builtin_double;
@ -324,8 +324,8 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
/* FIXME: Also mixed integral/booleans, with result an integer. */
{
const struct builtin_type *builtin = builtin_type (gdbarch);
unsigned int promoted_len1 = TYPE_LENGTH (type1);
unsigned int promoted_len2 = TYPE_LENGTH (type2);
unsigned int promoted_len1 = type1->length ();
unsigned int promoted_len2 = type2->length ();
int is_unsigned1 = type1->is_unsigned ();
int is_unsigned2 = type2->is_unsigned ();
unsigned int result_len;
@ -333,15 +333,15 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
/* Determine type length and signedness after promotion for
both operands. */
if (promoted_len1 < TYPE_LENGTH (builtin->builtin_int))
if (promoted_len1 < builtin->builtin_int->length ())
{
is_unsigned1 = 0;
promoted_len1 = TYPE_LENGTH (builtin->builtin_int);
promoted_len1 = builtin->builtin_int->length ();
}
if (promoted_len2 < TYPE_LENGTH (builtin->builtin_int))
if (promoted_len2 < builtin->builtin_int->length ())
{
is_unsigned2 = 0;
promoted_len2 = TYPE_LENGTH (builtin->builtin_int);
promoted_len2 = builtin->builtin_int->length ();
}
if (promoted_len1 > promoted_len2)
@ -366,13 +366,13 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
case language_cplus:
case language_asm:
case language_objc:
if (result_len <= TYPE_LENGTH (builtin->builtin_int))
if (result_len <= builtin->builtin_int->length ())
{
promoted_type = (unsigned_operation
? builtin->builtin_unsigned_int
: builtin->builtin_int);
}
else if (result_len <= TYPE_LENGTH (builtin->builtin_long))
else if (result_len <= builtin->builtin_long->length ())
{
promoted_type = (unsigned_operation
? builtin->builtin_unsigned_long
@ -386,16 +386,16 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
}
break;
case language_opencl:
if (result_len <= TYPE_LENGTH (lookup_signed_typename
(language, "int")))
if (result_len
<= lookup_signed_typename (language, "int")->length())
{
promoted_type =
(unsigned_operation
? lookup_unsigned_typename (language, "int")
: lookup_signed_typename (language, "int"));
}
else if (result_len <= TYPE_LENGTH (lookup_signed_typename
(language, "long")))
else if (result_len
<= lookup_signed_typename (language, "long")->length())
{
promoted_type =
(unsigned_operation
@ -2408,7 +2408,7 @@ array_operation::evaluate_struct_tuple (struct value *struct_val,
value_as_long (val), bitpos % 8, bitsize);
else
memcpy (addr, value_contents (val).data (),
TYPE_LENGTH (value_type (val)));
value_type (val)->length ());
}
return struct_val;
@ -2431,7 +2431,7 @@ array_operation::evaluate (struct type *expect_type,
{
struct value *rec = allocate_value (expect_type);
memset (value_contents_raw (rec).data (), '\0', TYPE_LENGTH (type));
memset (value_contents_raw (rec).data (), '\0', type->length ());
return evaluate_struct_tuple (rec, exp, noside, nargs);
}
@ -2441,16 +2441,16 @@ array_operation::evaluate (struct type *expect_type,
struct type *range_type = type->index_type ();
struct type *element_type = type->target_type ();
struct value *array = allocate_value (expect_type);
int element_size = TYPE_LENGTH (check_typedef (element_type));
int element_size = check_typedef (element_type)->length ();
LONGEST low_bound, high_bound, index;
if (!get_discrete_bounds (range_type, &low_bound, &high_bound))
{
low_bound = 0;
high_bound = (TYPE_LENGTH (type) / element_size) - 1;
high_bound = (type->length () / element_size) - 1;
}
index = low_bound;
memset (value_contents_raw (array).data (), 0, TYPE_LENGTH (expect_type));
memset (value_contents_raw (array).data (), 0, expect_type->length ());
for (tem = nargs; --nargs >= 0;)
{
struct value *element;
@ -2487,7 +2487,7 @@ array_operation::evaluate (struct type *expect_type,
if (!get_discrete_bounds (element_type, &low_bound, &high_bound))
error (_("(power)set type with unknown size"));
memset (valaddr, '\0', TYPE_LENGTH (type));
memset (valaddr, '\0', type->length ());
int idx = 0;
for (tem = 0; tem < nargs; tem++)
{
@ -2555,11 +2555,11 @@ unop_extract_operation::evaluate (struct type *expect_type,
value *old_value = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
struct type *type = get_type ();
if (TYPE_LENGTH (type) > TYPE_LENGTH (value_type (old_value)))
if (type->length () > value_type (old_value)->length ())
error (_("length type is larger than the value type"));
struct value *result = allocate_value (type);
value_contents_copy (result, 0, old_value, 0, TYPE_LENGTH (type));
value_contents_copy (result, 0, old_value, 0, type->length ());
return result;
}
@ -2730,7 +2730,7 @@ evaluate_subexp_for_sizeof_base (struct expression *exp, struct type *type)
if (exp->language_defn->la_language == language_cplus
&& (TYPE_IS_REFERENCE (type)))
type = check_typedef (type->target_type ());
return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
return value_from_longest (size_type, (LONGEST) type->length ());
}
namespace expr
@ -2757,7 +2757,7 @@ var_msym_value_operation::evaluate_for_sizeof (struct expression *exp,
/* FIXME: This should be size_t. */
struct type *size_type = builtin_type (exp->gdbarch)->builtin_int;
return value_from_longest (size_type, TYPE_LENGTH (type));
return value_from_longest (size_type, type->length ());
}
value *
@ -2784,7 +2784,7 @@ subscript_operation::evaluate_for_sizeof (struct expression *exp,
struct type *size_type
= builtin_type (exp->gdbarch)->builtin_int;
return value_from_longest
(size_type, (LONGEST) TYPE_LENGTH (value_type (val)));
(size_type, (LONGEST) value_type (val)->length ());
}
}
}
@ -2808,7 +2808,7 @@ unop_ind_base_operation::evaluate_for_sizeof (struct expression *exp,
type = value_type (value_ind (val));
/* FIXME: This should be size_t. */
struct type *size_type = builtin_type (exp->gdbarch)->builtin_int;
return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
return value_from_longest (size_type, (LONGEST) type->length ());
}
value *

View File

@ -618,7 +618,7 @@ exp : SIZEOF '(' type ')' %prec UNARY
$3 = check_typedef ($3);
pstate->push_new<long_const_operation>
(parse_f_type (pstate)->builtin_integer,
TYPE_LENGTH ($3));
$3->length ());
}
;

View File

@ -82,7 +82,7 @@ f_language::get_encoding (struct type *type)
{
const char *encoding;
switch (TYPE_LENGTH (type))
switch (type->length ())
{
case 1:
encoding = target_charset (type->arch ());
@ -141,7 +141,7 @@ fortran_bounds_all_dims (bool lbound_p,
/* Walk the array dimensions backwards due to the way the array will be
laid out in memory, the first dimension will be the most inner. */
LONGEST elm_len = TYPE_LENGTH (elm_type);
LONGEST elm_len = elm_type->length ();
for (LONGEST dst_offset = elm_len * (ndimensions - 1);
dst_offset >= 0;
dst_offset -= elm_len)
@ -156,9 +156,9 @@ fortran_bounds_all_dims (bool lbound_p,
/* And copy the value into the result value. */
struct value *v = value_from_longest (elm_type, b);
gdb_assert (dst_offset + TYPE_LENGTH (value_type (v))
<= TYPE_LENGTH (value_type (result)));
gdb_assert (TYPE_LENGTH (value_type (v)) == elm_len);
gdb_assert (dst_offset + value_type (v)->length ()
<= value_type (result)->length ());
gdb_assert (value_type (v)->length () == elm_len);
value_contents_copy (result, dst_offset, v, 0, elm_len);
/* Peel another dimension of the array. */
@ -283,8 +283,8 @@ protected:
void copy_element_to_dest (struct value *elt)
{
value_contents_copy (m_dest, m_dest_offset, elt, 0,
TYPE_LENGTH (value_type (elt)));
m_dest_offset += TYPE_LENGTH (value_type (elt));
value_type (elt)->length ());
m_dest_offset += value_type (elt)->length ();
}
/* The value being written to. */
@ -447,8 +447,8 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
if (pointer_target_type->code () != target_target_type->code ()
|| (pointer_target_type->code () != TYPE_CODE_ARRAY
&& (TYPE_LENGTH (pointer_target_type)
!= TYPE_LENGTH (target_target_type))))
&& (pointer_target_type->length ()
!= target_target_type->length ())))
error (_("arguments to associated must be of same type and kind"));
/* If TARGET is not in memory, or the original pointer is specifically
@ -721,7 +721,7 @@ fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
struct type *result_type = create_array_type (nullptr, elm_type, range);
struct value *result = allocate_value (result_type);
LONGEST elm_len = TYPE_LENGTH (elm_type);
LONGEST elm_len = elm_type->length ();
/* Walk the array dimensions backwards due to the way the array will be
laid out in memory, the first dimension will be the most inner.
@ -741,9 +741,9 @@ fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
/* And copy the value into the result value. */
struct value *v = value_from_longest (elm_type, dim_size);
gdb_assert (dst_offset + TYPE_LENGTH (value_type (v))
<= TYPE_LENGTH (value_type (result)));
gdb_assert (TYPE_LENGTH (value_type (v)) == elm_len);
gdb_assert (dst_offset + value_type (v)->length ()
<= value_type (result)->length ());
gdb_assert (value_type (v)->length () == elm_len);
value_contents_copy (result, dst_offset, v, 0, elm_len);
/* Peel another dimension of the array. */
@ -1018,9 +1018,9 @@ eval_op_f_kind (struct type *expect_type, struct expression *exp,
if (!type->target_type ())
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
TYPE_LENGTH (type));
type->length ());
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
TYPE_LENGTH (type->target_type ()));
type->target_type ()->length ());
}
/* A helper function for UNOP_FORTRAN_ALLOCATED. */
@ -1153,7 +1153,7 @@ fortran_undetermined::value_subarray (value *array,
of an element at each dimension of the new slice array. Initially the
elements of the inner most dimension of the array are the same inner
most elements as the original ARRAY. */
LONGEST slice_element_size = TYPE_LENGTH (inner_element_type);
LONGEST slice_element_size = inner_element_type->length ();
/* Start off assuming all data is contiguous, this will be set to false
if access to any dimension results in non-contiguous data. */
@ -1234,7 +1234,7 @@ fortran_undetermined::value_subarray (value *array,
LONGEST ub = f77_get_upperbound (dim_type);
LONGEST sd = index_type->bit_stride ();
if (sd == 0)
sd = TYPE_LENGTH (target_type) * 8;
sd = target_type->length () * 8;
if (fortran_array_slicing_debug)
{
@ -1247,9 +1247,9 @@ fortran_undetermined::value_subarray (value *array,
debug_printf ("| | |-> Bit stride: %s\n", plongest (sd));
debug_printf ("| | |-> Byte stride: %s\n", plongest (sd / 8));
debug_printf ("| | |-> Type size: %s\n",
pulongest (TYPE_LENGTH (dim_type)));
pulongest (dim_type->length ()));
debug_printf ("| | '-> Target type size: %s\n",
pulongest (TYPE_LENGTH (target_type)));
pulongest (target_type->length ()));
debug_printf ("| |-> Accessing:\n");
debug_printf ("| | |-> Low bound: %s\n",
plongest (low));
@ -1282,7 +1282,7 @@ fortran_undetermined::value_subarray (value *array,
LONGEST remainder = high - last_elem;
if (low > high)
{
offset += std::abs (remainder) * TYPE_LENGTH (target_type);
offset += std::abs (remainder) * target_type->length ();
if (stride > 0)
error (_("incorrect stride and boundary combination"));
}
@ -1336,7 +1336,7 @@ fortran_undetermined::value_subarray (value *array,
LONGEST ub = f77_get_upperbound (dim_type);
LONGEST sd = index_type->bit_stride () / 8;
if (sd == 0)
sd = TYPE_LENGTH (target_type);
sd = target_type->length ();
if (fortran_array_slicing_debug)
{
@ -1348,9 +1348,9 @@ fortran_undetermined::value_subarray (value *array,
debug_printf ("| | |-> High bound: %s\n", plongest (ub));
debug_printf ("| | |-> Byte stride: %s\n", plongest (sd));
debug_printf ("| | |-> Type size: %s\n",
pulongest (TYPE_LENGTH (dim_type)));
pulongest (dim_type->length ()));
debug_printf ("| | '-> Target type size: %s\n",
pulongest (TYPE_LENGTH (target_type)));
pulongest (target_type->length ()));
debug_printf ("| '-> Accessing:\n");
debug_printf ("| '-> Index: %s\n",
plongest (index));
@ -1427,7 +1427,7 @@ fortran_undetermined::value_subarray (value *array,
p_low.set_const_val (d.low);
p_high.set_const_val (d.high);
p_stride.set_const_val (TYPE_LENGTH (repacked_array_type));
p_stride.set_const_val (repacked_array_type->length ());
struct type *new_range
= create_range_type_with_stride ((struct type *) NULL,
@ -1442,8 +1442,8 @@ fortran_undetermined::value_subarray (value *array,
array value DEST. */
struct value *dest = allocate_value (repacked_array_type);
if (value_lazy (array)
|| (total_offset + TYPE_LENGTH (array_slice_type)
> TYPE_LENGTH (check_typedef (value_type (array)))))
|| (total_offset + array_slice_type->length ()
> check_typedef (value_type (array))->length ()))
{
fortran_array_walker<fortran_lazy_array_repacker_impl> p
(array_slice_type, value_address (array) + total_offset, dest);
@ -1467,8 +1467,8 @@ fortran_undetermined::value_subarray (value *array,
just create a new lazy value pointing at the memory where the
contents we're looking for exist. */
if (value_lazy (array)
|| (total_offset + TYPE_LENGTH (array_slice_type)
> TYPE_LENGTH (check_typedef (value_type (array)))))
|| (total_offset + array_slice_type->length ()
> check_typedef (value_type (array))->length ()))
array = value_at_lazy (array_slice_type,
value_address (array) + total_offset);
else
@ -1634,7 +1634,7 @@ fortran_structop_operation::evaluate (struct type *expect_type,
const gdb_byte *valaddr = value_contents_for_printing (elt).data ();
CORE_ADDR address = value_address (elt);
gdb::array_view<const gdb_byte> view
= gdb::make_array_view (valaddr, TYPE_LENGTH (elt_type));
= gdb::make_array_view (valaddr, elt_type->length ());
elt_type = resolve_dynamic_type (elt_type, view, address);
}
elt = value_zero (elt_type, VALUE_LVAL (elt));
@ -1875,7 +1875,7 @@ fortran_argument_convert (struct value *value, bool is_artificial)
if (VALUE_LVAL (value) != lval_memory)
{
struct type *type = value_type (value);
const int length = TYPE_LENGTH (type);
const int length = type->length ();
const CORE_ADDR addr
= value_as_long (value_allocate_space_in_inferior (length));
write_memory (addr, value_contents (value).data (), length);

View File

@ -175,7 +175,7 @@ public:
{
const char *type_encoding = get_encoding (elttype);
if (TYPE_LENGTH (elttype) == 4)
if (elttype->length () == 4)
gdb_puts ("4_", stream);
if (!encoding || !*encoding)

View File

@ -92,7 +92,7 @@ f77_get_dynamic_length_of_aggregate (struct type *type)
/* Patch in a valid length value. */
type->set_length ((upper_bound - lower_bound + 1)
* TYPE_LENGTH (check_typedef (type->target_type ())));
* check_typedef (type->target_type ())->length ());
}
/* Per-dimension statistics. */
@ -264,7 +264,7 @@ public:
bool repeated = (m_options->repeat_count_threshold < UINT_MAX
&& elt_type_prev != nullptr
&& value_contents_eq (m_val, elt_off_prev, m_val, elt_off,
TYPE_LENGTH (elt_type)));
elt_type->length ()));
if (repeated)
m_nrepeats++;
@ -363,7 +363,7 @@ private:
}
else
return value_contents_eq (val, offset1, val, offset2,
TYPE_LENGTH (type));
type->length ());
}
/* The number of elements printed so far. */
@ -446,7 +446,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
case TYPE_CODE_STRING:
f77_get_dynamic_length_of_aggregate (type);
printstr (stream, builtin_type (gdbarch)->builtin_char, valaddr,
TYPE_LENGTH (type), NULL, 0, options);
type->length (), NULL, 0, options);
break;
case TYPE_CODE_ARRAY:
@ -458,7 +458,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
f77_get_dynamic_length_of_aggregate (type);
printstr (stream, ch_type, valaddr,
TYPE_LENGTH (type) / TYPE_LENGTH (ch_type), NULL, 0,
type->length () / ch_type->length (), NULL, 0,
options);
}
break;
@ -494,7 +494,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
if (TYPE_LENGTH (elttype) == 1
if (elttype->length () == 1
&& elttype->code () == TYPE_CODE_INT
&& (options->format == 0 || options->format == 's')
&& addr != 0)

View File

@ -1608,13 +1608,13 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch)
/* __pid_t */
pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (int32_type) * TARGET_CHAR_BIT, "__pid_t");
int32_type->length () * TARGET_CHAR_BIT, "__pid_t");
pid_type->set_target_type (int32_type);
pid_type->set_target_is_stub (true);
/* __uid_t */
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (uint32_type) * TARGET_CHAR_BIT,
uint32_type->length () * TARGET_CHAR_BIT,
"__uid_t");
uid_type->set_target_type (uint32_type);
pid_type->set_target_is_stub (true);
@ -2030,7 +2030,7 @@ fbsd_get_thread_local_address (struct gdbarch *gdbarch, CORE_ADDR dtv_addr,
CORE_ADDR addr = gdbarch_pointer_to_address (gdbarch,
builtin->builtin_data_ptr, buf);
addr += (tls_index + 1) * TYPE_LENGTH (builtin->builtin_data_ptr);
addr += (tls_index + 1) * builtin->builtin_data_ptr->length ();
if (target_read_memory (addr, buf, sizeof buf) != 0)
throw_error (TLS_GENERIC_ERROR,
_("Cannot find thread-local variables on this target"));

View File

@ -187,7 +187,7 @@ parse_find_args (const char *args, ULONGEST *max_countp,
{
const gdb_byte *contents = value_contents (v).data ();
pattern_buf.insert (pattern_buf.end (), contents,
contents + TYPE_LENGTH (t));
contents + t->length ());
}
if (*s == ',')

View File

@ -318,7 +318,7 @@ unsigned_pointer_to_address (struct gdbarch *gdbarch,
{
enum bfd_endian byte_order = type_byte_order (type);
return extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
return extract_unsigned_integer (buf, type->length (), byte_order);
}
CORE_ADDR
@ -327,7 +327,7 @@ signed_pointer_to_address (struct gdbarch *gdbarch,
{
enum bfd_endian byte_order = type_byte_order (type);
return extract_signed_integer (buf, TYPE_LENGTH (type), byte_order);
return extract_signed_integer (buf, type->length (), byte_order);
}
/* Given an address, store it as a pointer of type TYPE in target
@ -338,7 +338,7 @@ unsigned_address_to_pointer (struct gdbarch *gdbarch, struct type *type,
{
enum bfd_endian byte_order = type_byte_order (type);
store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
store_unsigned_integer (buf, type->length (), byte_order, addr);
}
void
@ -347,7 +347,7 @@ address_to_signed_pointer (struct gdbarch *gdbarch, struct type *type,
{
enum bfd_endian byte_order = type_byte_order (type);
store_signed_integer (buf, TYPE_LENGTH (type), byte_order, addr);
store_signed_integer (buf, type->length (), byte_order, addr);
}
/* See value.h. */
@ -595,7 +595,7 @@ language_defn::read_var_value (struct symbol *var,
}
/* Put the constant back in target format. */
v = allocate_value (type);
store_signed_integer (value_contents_raw (v).data (), TYPE_LENGTH (type),
store_signed_integer (value_contents_raw (v).data (), type->length (),
type_byte_order (type), var->value_longest ());
VALUE_LVAL (v) = not_lval;
return v;
@ -624,7 +624,7 @@ language_defn::read_var_value (struct symbol *var,
}
v = allocate_value (type);
memcpy (value_contents_raw (v).data (), var->value_bytes (),
TYPE_LENGTH (type));
type->length ());
VALUE_LVAL (v) = not_lval;
return v;
@ -796,7 +796,7 @@ struct value *
default_value_from_register (struct gdbarch *gdbarch, struct type *type,
int regnum, struct frame_id frame_id)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
struct value *value = allocate_value (type);
struct frame_info *frame;
@ -902,9 +902,9 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
if (!ok)
{
if (optim)
mark_value_bytes_optimized_out (v, 0, TYPE_LENGTH (type));
mark_value_bytes_optimized_out (v, 0, type->length ());
if (unavail)
mark_value_bytes_unavailable (v, 0, TYPE_LENGTH (type));
mark_value_bytes_unavailable (v, 0, type->length ());
}
}
else
@ -947,7 +947,7 @@ address_from_register (int regnum, struct frame_info *frame)
pointer types. Avoid constructing a value object in those cases. */
if (gdbarch_convert_register_p (gdbarch, regnum, type))
{
gdb_byte *buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
gdb_byte *buf = (gdb_byte *) alloca (type->length ());
int optim, unavail, ok;
ok = gdbarch_register_to_value (gdbarch, frame, regnum, type,

View File

@ -1157,9 +1157,9 @@ frame_register_unwind (frame_info *next_frame, int regnum,
{
if (!*optimizedp && !*unavailablep)
memcpy (bufferp, value_contents_all (value).data (),
TYPE_LENGTH (value_type (value)));
value_type (value)->length ());
else
memset (bufferp, 0, TYPE_LENGTH (value_type (value)));
memset (bufferp, 0, value_type (value)->length ());
}
/* Dispose of the new value. This prevents watchpoints from

View File

@ -1110,7 +1110,7 @@ frv_extract_return_value (struct type *type, struct regcache *regcache,
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type);
int len = type->length ();
if (len <= 4)
{
@ -1216,7 +1216,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
stack_space = 0;
for (argnum = 0; argnum < nargs; ++argnum)
stack_space += align_up (TYPE_LENGTH (value_type (args[argnum])), 4);
stack_space += align_up (value_type (args[argnum])->length (), 4);
stack_space -= (6 * 4);
if (stack_space > 0)
@ -1237,7 +1237,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
arg = args[argnum];
arg_type = check_typedef (value_type (arg));
len = TYPE_LENGTH (arg_type);
len = arg_type->length ();
typecode = arg_type->code ();
if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
@ -1319,7 +1319,7 @@ static void
frv_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
if (len <= 4)
{

View File

@ -129,7 +129,7 @@ ft32_store_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR regval;
int len = TYPE_LENGTH (type);
int len = type->length ();
/* Things always get returned in RET1_REGNUM, RET2_REGNUM. */
regval = extract_unsigned_integer (valbuf, len > 4 ? 4 : len, byte_order);
@ -331,7 +331,7 @@ ft32_pointer_to_address (struct gdbarch *gdbarch,
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR addr
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
= extract_unsigned_integer (buf, type->length (), byte_order);
if (TYPE_ADDRESS_CLASS_1 (type))
return addr;
@ -397,7 +397,7 @@ ft32_extract_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
bfd_byte *valbuf = dst;
int len = TYPE_LENGTH (type);
int len = type->length ();
ULONGEST tmp;
/* By using store_unsigned_integer we avoid having to do
@ -421,7 +421,7 @@ ft32_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (TYPE_LENGTH (valtype) > 8)
if (valtype->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
else
{

View File

@ -82,7 +82,7 @@ register_to_value_test (struct gdbarch *gdbarch)
{
if (gdbarch_convert_register_p (gdbarch, regnum, type))
{
std::vector<gdb_byte> expected (TYPE_LENGTH (type), 0);
std::vector<gdb_byte> expected (type->length (), 0);
if (type->code () == TYPE_CODE_FLT)
{
@ -99,12 +99,12 @@ register_to_value_test (struct gdbarch *gdbarch)
expected.data ());
/* Allocate two bytes more for overflow check. */
std::vector<gdb_byte> buf (TYPE_LENGTH (type) + 2, 0);
std::vector<gdb_byte> buf (type->length () + 2, 0);
int optim, unavail, ok;
/* Set the fingerprint in the last two bytes. */
buf [TYPE_LENGTH (type)]= 'w';
buf [TYPE_LENGTH (type) + 1]= 'l';
buf [type->length ()]= 'w';
buf [type->length () + 1]= 'l';
ok = gdbarch_register_to_value (gdbarch, frame, regnum, type,
buf.data (), &optim, &unavail);
@ -112,10 +112,10 @@ register_to_value_test (struct gdbarch *gdbarch)
SELF_CHECK (!optim);
SELF_CHECK (!unavail);
SELF_CHECK (buf[TYPE_LENGTH (type)] == 'w');
SELF_CHECK (buf[TYPE_LENGTH (type) + 1] == 'l');
SELF_CHECK (buf[type->length ()] == 'w');
SELF_CHECK (buf[type->length () + 1] == 'l');
for (auto k = 0; k < TYPE_LENGTH(type); k++)
for (auto k = 0; k < type->length (); k++)
SELF_CHECK (buf[k] == expected[k]);
}
}

View File

@ -281,7 +281,7 @@ type_length_units (struct type *type)
{
int unit_size = gdbarch_addressable_memory_unit_size (type->arch ());
return TYPE_LENGTH (type) / unit_size;
return type->length () / unit_size;
}
/* Alloc a new type instance structure, fill it with some defaults,
@ -388,7 +388,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
chain = TYPE_CHAIN (ntype);
while (chain != ntype)
{
chain->set_length (TYPE_LENGTH (ntype));
chain->set_length (ntype->length ());
chain = TYPE_CHAIN (chain);
}
@ -468,7 +468,7 @@ make_reference_type (struct type *type, struct type **typeptr,
chain = TYPE_CHAIN (ntype);
while (chain != ntype)
{
chain->set_length (TYPE_LENGTH (ntype));
chain->set_length (ntype->length ());
chain = TYPE_CHAIN (chain);
}
@ -671,7 +671,7 @@ make_qualified_type (struct type *type, type_instance_flags new_flags,
ntype->set_instance_flags (new_flags);
/* Set length of new type to that of the original type. */
ntype->set_length (TYPE_LENGTH (type));
ntype->set_length (type->length ());
return ntype;
}
@ -824,7 +824,7 @@ replace_type (struct type *ntype, struct type *type)
call replace_type(). */
gdb_assert (TYPE_ADDRESS_CLASS_ALL (chain) == 0);
chain->set_length (TYPE_LENGTH (type));
chain->set_length (type->length ());
chain = TYPE_CHAIN (chain);
}
while (ntype != chain);
@ -936,7 +936,7 @@ create_range_type (struct type *result_type, struct type *index_type,
/* The INDEX_TYPE should be a type capable of holding the upper and lower
bounds, as such a zero sized, or void type makes no sense. */
gdb_assert (index_type->code () != TYPE_CODE_VOID);
gdb_assert (TYPE_LENGTH (index_type) > 0);
gdb_assert (index_type->length () > 0);
if (result_type == NULL)
result_type = alloc_type_copy (index_type);
@ -945,7 +945,7 @@ create_range_type (struct type *result_type, struct type *index_type,
if (index_type->is_stub ())
result_type->set_target_is_stub (true);
else
result_type->set_length (TYPE_LENGTH (check_typedef (index_type)));
result_type->set_length (check_typedef (index_type)->length ());
range_bounds *bounds
= (struct range_bounds *) TYPE_ZALLOC (result_type, sizeof (range_bounds));
@ -1096,11 +1096,11 @@ get_discrete_low_bound (struct type *type)
return 0;
case TYPE_CODE_INT:
if (TYPE_LENGTH (type) > sizeof (LONGEST)) /* Too big */
if (type->length () > sizeof (LONGEST)) /* Too big */
return {};
if (!type->is_unsigned ())
return -(1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1));
return -(1 << (type->length () * TARGET_CHAR_BIT - 1));
/* fall through */
case TYPE_CODE_CHAR:
@ -1163,12 +1163,12 @@ get_discrete_high_bound (struct type *type)
return 1;
case TYPE_CODE_INT:
if (TYPE_LENGTH (type) > sizeof (LONGEST)) /* Too big */
if (type->length () > sizeof (LONGEST)) /* Too big */
return {};
if (!type->is_unsigned ())
{
LONGEST low = -(1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1));
LONGEST low = -(1 << (type->length () * TARGET_CHAR_BIT - 1));
return -low - 1;
}
@ -1176,9 +1176,9 @@ get_discrete_high_bound (struct type *type)
case TYPE_CODE_CHAR:
{
/* This round-about calculation is to avoid shifting by
TYPE_LENGTH (type) * TARGET_CHAR_BIT, which will not work
if TYPE_LENGTH (type) == sizeof (LONGEST). */
LONGEST high = 1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1);
type->length () * TARGET_CHAR_BIT, which will not work
if type->length () == sizeof (LONGEST). */
LONGEST high = 1 << (type->length () * TARGET_CHAR_BIT - 1);
return (high - 1) | high;
}
@ -1310,7 +1310,7 @@ update_static_array_size (struct type *type)
type->set_length (((std::abs (stride) * element_count) + 7) / 8);
}
else
type->set_length (TYPE_LENGTH (element_type)
type->set_length (element_type->length ()
* (high_bound - low_bound + 1));
/* If this array's element is itself an array with a bit stride,
@ -1319,7 +1319,7 @@ update_static_array_size (struct type *type)
wrong size when trying to find elements of the outer
array. */
if (element_type->code () == TYPE_CODE_ARRAY
&& TYPE_LENGTH (element_type) != 0
&& element_type->length () != 0
&& TYPE_FIELD_BITSIZE (element_type, 0) != 0
&& get_array_bounds (element_type, &low_bound, &high_bound)
&& high_bound >= low_bound)
@ -1400,7 +1400,7 @@ create_array_type_with_stride (struct type *result_type,
}
/* TYPE_TARGET_STUB will take care of zero length arrays. */
if (TYPE_LENGTH (result_type) == 0)
if (result_type->length () == 0)
result_type->set_target_is_stub (true);
return result_type;
@ -1909,10 +1909,10 @@ get_unsigned_type_max (struct type *type)
type = check_typedef (type);
gdb_assert (type->code () == TYPE_CODE_INT && type->is_unsigned ());
gdb_assert (TYPE_LENGTH (type) <= sizeof (ULONGEST));
gdb_assert (type->length () <= sizeof (ULONGEST));
/* Written this way to avoid overflow. */
n = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
n = type->length () * TARGET_CHAR_BIT;
return ((((ULONGEST) 1 << (n - 1)) - 1) << 1) | 1;
}
@ -1926,9 +1926,9 @@ get_signed_type_minmax (struct type *type, LONGEST *min, LONGEST *max)
type = check_typedef (type);
gdb_assert (type->code () == TYPE_CODE_INT && !type->is_unsigned ());
gdb_assert (TYPE_LENGTH (type) <= sizeof (LONGEST));
gdb_assert (type->length () <= sizeof (LONGEST));
n = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
n = type->length () * TARGET_CHAR_BIT;
*min = -((ULONGEST) 1 << (n - 1));
*max = ((ULONGEST) 1 << (n - 1)) - 1;
}
@ -1942,9 +1942,9 @@ get_pointer_type_max (struct type *type)
type = check_typedef (type);
gdb_assert (type->code () == TYPE_CODE_PTR);
gdb_assert (TYPE_LENGTH (type) <= sizeof (CORE_ADDR));
gdb_assert (type->length () <= sizeof (CORE_ADDR));
n = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
n = type->length () * TARGET_CHAR_BIT;
return ((((CORE_ADDR) 1 << (n - 1)) - 1) << 1) | 1;
}
@ -2501,8 +2501,8 @@ resolve_dynamic_union (struct type *type,
resolved_type->field (i).set_type (t);
struct type *real_type = check_typedef (t);
if (TYPE_LENGTH (real_type) > max_len)
max_len = TYPE_LENGTH (real_type);
if (real_type->length () > max_len)
max_len = real_type->length ();
}
resolved_type->set_length (max_len);
@ -2595,7 +2595,7 @@ compute_variant_fields_inner (struct type *type,
LONGEST bitsize = TYPE_FIELD_BITSIZE (type, idx);
LONGEST size = bitsize / 8;
if (size == 0)
size = TYPE_LENGTH (type->field (idx).type ());
size = type->field (idx).type ()->length ();
gdb_byte bits[sizeof (ULONGEST)];
read_memory (addr, bits, size);
@ -2761,7 +2761,7 @@ resolve_dynamic_struct (struct type *type,
struct type *real_type
= check_typedef (resolved_type->field (i).type ());
new_bit_length += (TYPE_LENGTH (real_type) * TARGET_CHAR_BIT);
new_bit_length += (real_type->length () * TARGET_CHAR_BIT);
}
/* Normally, we would use the position and size of the last field
@ -3148,7 +3148,7 @@ check_typedef (struct type *type)
}
else if (type->code () == TYPE_CODE_RANGE)
{
type->set_length (TYPE_LENGTH (target_type));
type->set_length (target_type->length ());
type->set_target_is_stub (false);
}
else if (type->code () == TYPE_CODE_ARRAY
@ -3159,7 +3159,7 @@ check_typedef (struct type *type)
type = make_qualified_type (type, instance_flags, NULL);
/* Cache TYPE_LENGTH for future use. */
orig_type->set_length (TYPE_LENGTH (type));
orig_type->set_length (type->length ());
return type;
}
@ -3581,7 +3581,7 @@ init_complex_type (const char *name, struct type *target_type)
t = alloc_type_copy (target_type);
set_type_code (t, TYPE_CODE_COMPLEX);
t->set_length (2 * TYPE_LENGTH (target_type));
t->set_length (2 * target_type->length ());
t->set_name (name);
t->set_target_type (target_type);
@ -4330,7 +4330,7 @@ check_types_equal (struct type *type1, struct type *type2,
return true;
if (type1->code () != type2->code ()
|| TYPE_LENGTH (type1) != TYPE_LENGTH (type2)
|| type1->length () != type2->length ()
|| type1->is_unsigned () != type2->is_unsigned ()
|| type1->has_no_signedness () != type2->has_no_signedness ()
|| type1->endianity_is_not_default () != type2->endianity_is_not_default ()
@ -4602,7 +4602,7 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
switch (arg->code ())
{
case TYPE_CODE_INT:
if (TYPE_LENGTH (arg) == TYPE_LENGTH (parm))
if (arg->length () == parm->length ())
{
/* Deal with signed, unsigned, and plain chars and
signed and unsigned ints. */
@ -4662,7 +4662,7 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
else
return INTEGER_CONVERSION_BADNESS;
}
else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
else if (arg->length () < parm->length ())
return INTEGER_PROMOTION_BADNESS;
else
return INTEGER_CONVERSION_BADNESS;
@ -4721,9 +4721,9 @@ rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *valu
case TYPE_CODE_FLT:
return INT_FLOAT_CONVERSION_BADNESS;
case TYPE_CODE_INT:
if (TYPE_LENGTH (arg) > TYPE_LENGTH (parm))
if (arg->length () > parm->length ())
return INTEGER_CONVERSION_BADNESS;
else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
else if (arg->length () < parm->length ())
return INTEGER_PROMOTION_BADNESS;
/* fall through */
case TYPE_CODE_CHAR:
@ -4811,9 +4811,9 @@ rank_one_type_parm_float (struct type *parm, struct type *arg, struct value *val
switch (arg->code ())
{
case TYPE_CODE_FLT:
if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
if (arg->length () < parm->length ())
return FLOAT_PROMOTION_BADNESS;
else if (TYPE_LENGTH (arg) == TYPE_LENGTH (parm))
else if (arg->length () == parm->length ())
return EXACT_MATCH_BADNESS;
else
return FLOAT_CONVERSION_BADNESS;
@ -5348,7 +5348,7 @@ recursive_dump_type (struct type *type, int spaces)
}
gdb_puts ("\n");
gdb_printf ("%*slength %s\n", spaces, "",
pulongest (TYPE_LENGTH (type)));
pulongest (type->length ()));
if (type->is_objfile_owned ())
gdb_printf ("%*sobjfile %s\n", spaces, "",
host_address_to_string (type->objfile_owner ()));
@ -5660,7 +5660,7 @@ copy_type_recursive (struct type *type, htab_t copied_types)
new_type->set_name (xstrdup (type->name ()));
new_type->set_instance_flags (type->instance_flags ());
new_type->set_length (TYPE_LENGTH (type));
new_type->set_length (type->length ());
/* Copy the fields. */
if (type->num_fields ())
@ -5789,7 +5789,7 @@ copy_type (const struct type *type)
{
struct type *new_type = alloc_type_copy (type);
new_type->set_instance_flags (type->instance_flags ());
new_type->set_length (TYPE_LENGTH (type));
new_type->set_length (type->length ());
memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type),
sizeof (struct main_type));
if (type->main_type->dyn_prop_list != NULL)
@ -5952,7 +5952,7 @@ void
append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
struct type *field_type, const char *name)
{
int type_bitsize = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
int type_bitsize = type->length () * TARGET_CHAR_BIT;
int field_nr = type->num_fields ();
gdb_assert (type->code () == TYPE_CODE_FLAGS);
@ -6027,16 +6027,17 @@ append_composite_type_field_aligned (struct type *t, const char *name,
if (t->code () == TYPE_CODE_UNION)
{
if (TYPE_LENGTH (t) < TYPE_LENGTH (field))
t->set_length (TYPE_LENGTH (field));
if (t->length () < field->length ())
t->set_length (field->length ());
}
else if (t->code () == TYPE_CODE_STRUCT)
{
t->set_length (TYPE_LENGTH (t) + TYPE_LENGTH (field));
t->set_length (t->length () + field->length ());
if (t->num_fields () > 1)
{
f->set_loc_bitpos
(f[-1].loc_bitpos () + (TYPE_LENGTH (f[-1].type ()) * TARGET_CHAR_BIT));
(f[-1].loc_bitpos ()
+ (f[-1].type ()->length () * TARGET_CHAR_BIT));
if (alignment)
{

View File

@ -1045,6 +1045,10 @@ struct type
this->main_type->name = name;
}
/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
so you only have to call check_typedef once. Since allocate_value
calls check_typedef, VALUE_TYPE (X)->length () is safe. */
ULONGEST length () const
{
return this->m_length;
@ -2111,11 +2115,6 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
#define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
#define TYPE_CHAIN(thistype) (thistype)->chain
/* * Note that if thistype is a TYPEDEF type, you have to call check_typedef.
But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
so you only have to call check_typedef once. Since allocate_value
calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */
#define TYPE_LENGTH(thistype) ((thistype)->length ())
/* * Return the alignment of the type in target addressable memory
units, or 0 if no alignment was specified. */

View File

@ -267,7 +267,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
TYPE_VPTR_FIELDNO(rtti_type)) / 8;
if (top && ((*top) >0))
{
if (TYPE_LENGTH(rtti_type) > TYPE_LENGTH(known_type))
if (rtti_type->length () > known_type->length ())
{
if (full)
*full=0;
@ -365,7 +365,7 @@ gnuv2_baseclass_offset (struct type *type, int index,
field_type = check_typedef (type->field (i).type ());
field_offset = type->field (i).loc_bitpos () / 8;
field_length = TYPE_LENGTH (field_type);
field_length = field_type->length ();
if (!value_bytes_available (val, embedded_offset + field_offset,
field_length))

View File

@ -142,28 +142,28 @@ get_gdb_vtable_type (struct gdbarch *arch)
field->set_name ("vcall_and_vbase_offsets");
field->set_type (lookup_array_range_type (ptrdiff_type, 0, -1));
field->set_loc_bitpos (offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (field->type ());
offset += field->type ()->length ();
field++;
/* ptrdiff_t offset_to_top; */
field->set_name ("offset_to_top");
field->set_type (ptrdiff_type);
field->set_loc_bitpos (offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (field->type ());
offset += field->type ()->length ();
field++;
/* void *type_info; */
field->set_name ("type_info");
field->set_type (void_ptr_type);
field->set_loc_bitpos (offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (field->type ());
offset += field->type ()->length ();
field++;
/* void (*virtual_functions[0]) (); */
field->set_name ("virtual_functions");
field->set_type (lookup_array_range_type (ptr_to_void_fn_type, 0, -1));
field->set_loc_bitpos (offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (field->type ());
offset += field->type ()->length ();
field++;
/* We assumed in the allocation above that there were four fields. */
@ -371,8 +371,8 @@ gnuv3_rtti_type (struct value *value,
if (full_p)
*full_p = (- offset_to_top == value_embedded_offset (value)
&& (TYPE_LENGTH (value_enclosing_type (value))
>= TYPE_LENGTH (run_time_type)));
&& (value_enclosing_type (value)->length ()
>= run_time_type->length ()));
if (top_p)
*top_p = - offset_to_top;
return run_time_type;
@ -500,9 +500,9 @@ gnuv3_baseclass_offset (struct type *type, int index,
error (_("Expected a negative vbase offset (old compiler?)"));
cur_base_offset = cur_base_offset + vtable_address_point_offset (gdbarch);
if ((- cur_base_offset) % TYPE_LENGTH (ptr_type) != 0)
if ((- cur_base_offset) % ptr_type->length () != 0)
error (_("Misaligned vbase offset."));
cur_base_offset = cur_base_offset / ((int) TYPE_LENGTH (ptr_type));
cur_base_offset = cur_base_offset / ((int) ptr_type->length ());
vtable = gnuv3_get_vtable (gdbarch, type, address + embedded_offset);
gdb_assert (vtable != NULL);
@ -556,7 +556,7 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset,
basetype = domain->field (i).type ();
/* Recurse with a modified adjustment. We don't need to adjust
voffset. */
if (adjustment >= pos && adjustment < pos + TYPE_LENGTH (basetype))
if (adjustment >= pos && adjustment < pos + basetype->length ())
return gnuv3_find_method_in (basetype, voffset, adjustment - pos);
}
@ -586,10 +586,10 @@ gnuv3_decode_method_ptr (struct gdbarch *gdbarch,
interpretations and choose the right one later on. */
ptr_value = extract_typed_address (contents, funcptr_type);
voffset = extract_signed_integer (contents,
TYPE_LENGTH (funcptr_type), byte_order);
contents += TYPE_LENGTH (funcptr_type);
funcptr_type->length (), byte_order);
contents += funcptr_type->length ();
adjustment = extract_signed_integer (contents,
TYPE_LENGTH (offset_type), byte_order);
offset_type->length (), byte_order);
if (!gdbarch_vbit_in_delta (gdbarch))
{
@ -639,7 +639,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
/* It's a virtual table offset, maybe in this class. Search
for a field with the correct vtable offset. First convert it
to an index, as used in TYPE_FN_FIELD_VOFFSET. */
voffset = ptr_value / TYPE_LENGTH (vtable_ptrdiff_type (gdbarch));
voffset = ptr_value / vtable_ptrdiff_type (gdbarch)->length ();
physname = gnuv3_find_method_in (self_type, voffset, adjustment);
@ -693,7 +693,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
static int
gnuv3_method_ptr_size (struct type *type)
{
return 2 * TYPE_LENGTH (builtin_type (type->arch ())->builtin_data_ptr);
return 2 * builtin_type (type->arch ())->builtin_data_ptr->length ();
}
/* GNU v3 implementation of cplus_make_method_ptr. */
@ -703,7 +703,7 @@ gnuv3_make_method_ptr (struct type *type, gdb_byte *contents,
CORE_ADDR value, int is_virtual)
{
struct gdbarch *gdbarch = type->arch ();
int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
int size = builtin_type (gdbarch)->builtin_data_ptr->length ();
enum bfd_endian byte_order = type_byte_order (type);
/* FIXME drow/2006-12-24: The adjustment of "this" is currently
@ -775,7 +775,7 @@ gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
{
LONGEST voffset;
voffset = ptr_value / TYPE_LENGTH (vtable_ptrdiff_type (gdbarch));
voffset = ptr_value / vtable_ptrdiff_type (gdbarch)->length ();
return gnuv3_get_virtual_fn (gdbarch, value_ind (*this_p),
method_type, voffset);
}
@ -1040,14 +1040,14 @@ build_std_type_info_type (struct gdbarch *arch)
field->set_name ("_vptr.type_info");
field->set_type (void_ptr_type);
field->set_loc_bitpos (offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (field->type ());
offset += field->type ()->length ();
field++;
/* The name. */
field->set_name ("__name");
field->set_type (char_ptr_type);
field->set_loc_bitpos (offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (field->type ());
offset += field->type ()->length ();
field++;
gdb_assert (field == (field_list + 2));

View File

@ -475,7 +475,7 @@ exp : SIZEOF_KEYWORD '(' type ')' %prec UNARY
= parse_type (pstate)->builtin_unsigned_int;
$3 = check_typedef ($3);
pstate->push_new<long_const_operation>
(size_type, (LONGEST) TYPE_LENGTH ($3));
(size_type, (LONGEST) $3->length ());
}
;

View File

@ -91,7 +91,7 @@ gccgo_string_p (struct type *type)
target_type = check_typedef (target_type);
if (target_type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (target_type) == 1
&& target_type->length () == 1
&& strcmp (target_type->name (), "uint8") == 0)
return 1;
}

View File

@ -586,7 +586,7 @@ vlscm_integer_fits_p (SCM obj, struct type *type)
if (type->is_unsigned ())
{
/* If scm_is_unsigned_integer can't work with this type, just punt. */
if (TYPE_LENGTH (type) > sizeof (uintmax_t))
if (type->length () > sizeof (uintmax_t))
return 0;
ULONGEST max = get_unsigned_type_max (type);
@ -597,7 +597,7 @@ vlscm_integer_fits_p (SCM obj, struct type *type)
LONGEST min, max;
/* If scm_is_signed_integer can't work with this type, just punt. */
if (TYPE_LENGTH (type) > sizeof (intmax_t))
if (type->length () > sizeof (intmax_t))
return 0;
get_signed_type_minmax (type, &min, &max);
return scm_is_signed_integer (obj, min, max);
@ -681,7 +681,7 @@ vlscm_convert_bytevector (SCM bv, struct type *type, SCM type_scm,
make_vector_type (type);
}
type = check_typedef (type);
if (TYPE_LENGTH (type) != length)
if (type->length () != length)
{
*except_scmp = gdbscm_make_out_of_range_error (func_name, arg_pos,
type_scm,

View File

@ -969,7 +969,7 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
value_fetch_lazy (value);
/* No pretty-printer support for unavailable values. */
if (!value_bytes_available (value, 0, TYPE_LENGTH (type)))
if (!value_bytes_available (value, 0, type->length ()))
return EXT_LANG_RC_NOP;
if (!gdb_scheme_initialized)

View File

@ -633,7 +633,7 @@ gdbscm_type_sizeof (SCM self)
/* Ignore exceptions. */
return scm_from_long (TYPE_LENGTH (type));
return scm_from_long (type->length ());
}
/* (type-strip-typedefs <gdb:type>) -> <gdb:type>

View File

@ -827,7 +827,7 @@ gdbscm_value_to_bytevector (SCM self)
try
{
type = check_typedef (type);
length = TYPE_LENGTH (type);
length = type->length ();
contents = value_contents (value).data ();
}
catch (const gdb_exception &except)
@ -1104,7 +1104,7 @@ gdbscm_value_to_string (SCM self, SCM rest)
gdbscm_dynwind_xfree (buffer_contents);
result = scm_from_stringn ((const char *) buffer_contents,
length * TYPE_LENGTH (char_type),
length * char_type->length (),
(encoding != NULL && *encoding != '\0'
? encoding
: la_encoding),

View File

@ -632,8 +632,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make sure there's space on the stack for the arguments. We
may over-allocate a little here, but that won't hurt anything. */
for (argument = 0; argument < nargs; argument++)
stack_alloc += align_up (TYPE_LENGTH (value_type (args[argument])),
wordsize);
stack_alloc += align_up (value_type (args[argument])->length (), wordsize);
sp -= stack_alloc;
/* Now load as many arguments as possible into registers, and push
@ -647,7 +646,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (argument = 0; argument < nargs; argument++)
{
struct type *type = value_type (args[argument]);
int len = TYPE_LENGTH (type);
int len = type->length ();
char *contents = (char *) value_contents (args[argument]).data ();
/* Pad the argument appropriately. */
@ -725,7 +724,7 @@ h8300_extract_return_value (struct type *type, struct regcache *regcache,
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type);
int len = type->length ();
ULONGEST c, addr;
switch (len)
@ -764,13 +763,13 @@ h8300h_extract_return_value (struct type *type, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST c;
switch (TYPE_LENGTH (type))
switch (type->length ())
{
case 1:
case 2:
case 4:
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c);
store_unsigned_integer (valbuf, type->length (), byte_order, c);
break;
case 8: /* long long is now 8 bytes. */
if (type->code () == TYPE_CODE_INT)
@ -797,9 +796,9 @@ h8300_use_struct_convention (struct type *value_type)
if (value_type->code () == TYPE_CODE_STRUCT
|| value_type->code () == TYPE_CODE_UNION)
return 1;
return !(TYPE_LENGTH (value_type) == 1
|| TYPE_LENGTH (value_type) == 2
|| TYPE_LENGTH (value_type) == 4);
return !(value_type->length () == 1
|| value_type->length () == 2
|| value_type->length () == 4);
}
static int
@ -810,10 +809,10 @@ h8300h_use_struct_convention (struct type *value_type)
if (value_type->code () == TYPE_CODE_STRUCT
|| value_type->code () == TYPE_CODE_UNION)
return 1;
return !(TYPE_LENGTH (value_type) == 1
|| TYPE_LENGTH (value_type) == 2
|| TYPE_LENGTH (value_type) == 4
|| (TYPE_LENGTH (value_type) == 8
return !(value_type->length () == 1
|| value_type->length () == 2
|| value_type->length () == 4
|| (value_type->length () == 8
&& value_type->code () == TYPE_CODE_INT));
}
@ -829,15 +828,15 @@ h8300_store_return_value (struct type *type, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
switch (TYPE_LENGTH (type))
switch (type->length ())
{
case 1:
case 2: /* short... */
val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
val = extract_unsigned_integer (valbuf, type->length (), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
case 4: /* long, float */
val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
val = extract_unsigned_integer (valbuf, type->length (), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
(val >> 16) & 0xffff);
regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff);
@ -858,16 +857,16 @@ h8300h_store_return_value (struct type *type, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
switch (TYPE_LENGTH (type))
switch (type->length ())
{
case 1:
case 2:
case 4: /* long, float */
val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
val = extract_unsigned_integer (valbuf, type->length (), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
case 8:
val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
val = extract_unsigned_integer (valbuf, type->length (), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
(val >> 32) & 0xffffffff);
regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM,
@ -902,7 +901,7 @@ h8300h_return_value (struct gdbarch *gdbarch, struct value *function,
ULONGEST addr;
regcache_raw_read_unsigned (regcache, E_R0_REGNUM, &addr);
read_memory (addr, readbuf, TYPE_LENGTH (type));
read_memory (addr, readbuf, type->length ());
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;

View File

@ -741,15 +741,15 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte param_val[8];
int param_len;
memset (param_val, 0, sizeof param_val);
if (TYPE_LENGTH (type) > 8)
if (type->length () > 8)
{
/* Large parameter, pass by reference. Store the value
in "struct" area and then pass its address. */
param_len = 4;
struct_ptr += align_up (TYPE_LENGTH (type), 8);
struct_ptr += align_up (type->length (), 8);
if (write_pass)
write_memory (struct_end - struct_ptr,
value_contents (arg).data (), TYPE_LENGTH (type));
value_contents (arg).data (), type->length ());
store_unsigned_integer (param_val, 4, byte_order,
struct_end - struct_ptr);
}
@ -758,7 +758,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* Integer value store, right aligned. "unpack_long"
takes care of any sign-extension problems. */
param_len = align_up (TYPE_LENGTH (type), 4);
param_len = align_up (type->length (), 4);
store_unsigned_integer
(param_val, param_len, byte_order,
unpack_long (type, value_contents (arg).data ()));
@ -766,16 +766,16 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else if (type->code () == TYPE_CODE_FLT)
{
/* Floating point value store, right aligned. */
param_len = align_up (TYPE_LENGTH (type), 4);
param_len = align_up (type->length (), 4);
memcpy (param_val, value_contents (arg).data (), param_len);
}
else
{
param_len = align_up (TYPE_LENGTH (type), 4);
param_len = align_up (type->length (), 4);
/* Small struct value are stored right-aligned. */
memcpy (param_val + param_len - TYPE_LENGTH (type),
value_contents (arg).data (), TYPE_LENGTH (type));
memcpy (param_val + param_len - type->length (),
value_contents (arg).data (), type->length ());
/* Structures of size 5, 6 and 7 bytes are special in that
the higher-ordered word is stored in the lower-ordered
@ -874,13 +874,13 @@ hppa64_integral_or_pointer_p (const struct type *type)
case TYPE_CODE_ENUM:
case TYPE_CODE_RANGE:
{
int len = TYPE_LENGTH (type);
int len = type->length ();
return (len == 1 || len == 2 || len == 4 || len == 8);
}
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
return (TYPE_LENGTH (type) == 8);
return (type->length () == 8);
default:
break;
}
@ -897,7 +897,7 @@ hppa64_floating_p (const struct type *type)
{
case TYPE_CODE_FLT:
{
int len = TYPE_LENGTH (type);
int len = type->length ();
return (len == 4 || len == 8 || len == 16);
}
default:
@ -970,7 +970,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
struct value *arg = args[i];
struct type *type = value_type (arg);
int len = TYPE_LENGTH (type);
int len = type->length ();
const bfd_byte *valbuf;
bfd_byte fptrbuf[8];
int regnum;
@ -1057,7 +1057,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
codeptr = unpack_long (type, value_contents (arg).data ());
fptr = hppa64_convert_code_addr_to_fptr (gdbarch, codeptr);
store_unsigned_integer (fptrbuf, TYPE_LENGTH (type), byte_order,
store_unsigned_integer (fptrbuf, type->length (), byte_order,
fptr);
valbuf = fptrbuf;
}
@ -1125,13 +1125,13 @@ hppa32_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (TYPE_LENGTH (type) <= 2 * 4)
if (type->length () <= 2 * 4)
{
/* The value always lives in the right hand end of the register
(or register pair)? */
int b;
int reg = type->code () == TYPE_CODE_FLT ? HPPA_FP4_REGNUM : 28;
int part = TYPE_LENGTH (type) % 4;
int part = type->length () % 4;
/* The left hand register contains only part of the value,
transfer that first so that the rest can be xfered as entire
4-byte registers. */
@ -1144,7 +1144,7 @@ hppa32_return_value (struct gdbarch *gdbarch, struct value *function,
reg++;
}
/* Now transfer the remaining register values. */
for (b = part; b < TYPE_LENGTH (type); b += 4)
for (b = part; b < type->length (); b += 4)
{
if (readbuf != NULL)
regcache->cooked_read (reg, readbuf + b);
@ -1163,7 +1163,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
int regnum, offset;
if (len > 16)

View File

@ -110,7 +110,7 @@ static int
i386_m128_p (struct type *type)
{
return (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
&& TYPE_LENGTH (type) == 16);
&& type->length () == 16);
}
/* Return the alignment for TYPE when passed as an argument. */
@ -125,7 +125,7 @@ i386_darwin_arg_type_alignment (struct type *type)
7. [...] The caller aligns 128-bit vectors in the parameter area to
16-byte boundaries. */
if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
return TYPE_LENGTH (type);
return type->length ();
/* 4. The caller places all the fields of structures (or unions) with no
vector elements in the parameter area. These structures are 4-byte
aligned.
@ -201,7 +201,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (write_pass)
write_memory (sp + args_space,
value_contents_all (args[i]).data (),
TYPE_LENGTH (arg_type));
arg_type->length ());
/* The System V ABI says that:
@ -210,7 +210,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
depending on the size of the argument."
This makes sure the stack stays word-aligned. */
args_space += align_up (TYPE_LENGTH (arg_type), 4);
args_space += align_up (arg_type->length (), 4);
}
}

View File

@ -2644,7 +2644,7 @@ i386_16_byte_align_p (struct type *type)
type = check_typedef (type);
if ((type->code () == TYPE_CODE_DECFLOAT
|| (type->code () == TYPE_CODE_ARRAY && type->is_vector ()))
&& TYPE_LENGTH (type) == 16)
&& type->length () == 16)
return 1;
if (type->code () == TYPE_CODE_ARRAY)
return i386_16_byte_align_p (type->target_type ());
@ -2725,7 +2725,7 @@ i386_thiscall_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = thiscall ? 1 : 0; i < nargs; i++)
{
int len = TYPE_LENGTH (value_enclosing_type (args[i]));
int len = value_enclosing_type (args[i])->length ();
if (write_pass)
{
@ -2862,7 +2862,7 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, gdb_byte *valbuf)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int len = TYPE_LENGTH (type);
int len = type->length ();
gdb_byte buf[I386_MAX_REGISTER_SIZE];
/* _Float16 and _Float16 _Complex values are returned via xmm0. */
@ -2920,7 +2920,7 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, const gdb_byte *valbuf)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int len = TYPE_LENGTH (type);
int len = type->length ();
if (type->code () == TYPE_CODE_FLT)
{
@ -3000,7 +3000,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
int len = type->length ();
gdb_assert (code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION
@ -3041,10 +3041,10 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
|| code == TYPE_CODE_ARRAY)
&& !i386_reg_struct_return_p (gdbarch, type))
/* Complex double and long double uses the struct return convention. */
|| (code == TYPE_CODE_COMPLEX && TYPE_LENGTH (type) == 16)
|| (code == TYPE_CODE_COMPLEX && TYPE_LENGTH (type) == 24)
|| (code == TYPE_CODE_COMPLEX && type->length () == 16)
|| (code == TYPE_CODE_COMPLEX && type->length () == 24)
/* 128-bit decimal float uses the struct return convention. */
|| (code == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 16))
|| (code == TYPE_CODE_DECFLOAT && type->length () == 16))
{
/* The System V ABI says that:
@ -3068,7 +3068,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
ULONGEST addr;
regcache_raw_read_unsigned (regcache, I386_EAX_REGNUM, &addr);
read_memory (addr, readbuf, TYPE_LENGTH (type));
read_memory (addr, readbuf, type->length ());
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
@ -3382,7 +3382,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
status = regcache->raw_read (fpnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0,
TYPE_LENGTH (value_type (result_value)));
value_type (result_value)->length ());
else
memcpy (buf, raw_buf, register_size (gdbarch, regnum));
}
@ -3402,7 +3402,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
LONGEST upper, lower;
int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
int size = builtin_type (gdbarch)->builtin_data_ptr->length ();
lower = extract_unsigned_integer (raw_buf, 8, byte_order);
upper = extract_unsigned_integer (raw_buf + 8, 8, byte_order);
@ -3519,7 +3519,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
status = regcache->raw_read (gpnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0,
TYPE_LENGTH (value_type (result_value)));
value_type (result_value)->length ());
else
memcpy (buf, raw_buf, 2);
}
@ -3532,7 +3532,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
status = regcache->raw_read (gpnum % 4, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0,
TYPE_LENGTH (value_type (result_value)));
value_type (result_value)->length ());
else if (gpnum >= 4)
memcpy (buf, raw_buf + 1, 1);
else
@ -3583,7 +3583,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
if (i386_bnd_regnum_p (gdbarch, regnum))
{
ULONGEST upper, lower;
int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
int size = builtin_type (gdbarch)->builtin_data_ptr->length ();
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
/* New values from input value. */
@ -3799,7 +3799,7 @@ static int
i386_convert_register_p (struct gdbarch *gdbarch,
int regnum, struct type *type)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
/* Values may be spread across multiple registers. Most debugging
formats aren't expressive enough to specify the locations, so
@ -3832,7 +3832,7 @@ i386_register_to_value (struct frame_info *frame, int regnum,
int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int len = TYPE_LENGTH (type);
int len = type->length ();
if (i386_fp_regnum_p (gdbarch, regnum))
return i387_register_to_value (frame, regnum, type, to,
@ -3870,7 +3870,7 @@ static void
i386_value_to_register (struct frame_info *frame, int regnum,
struct type *type, const gdb_byte *from)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
if (i386_fp_regnum_p (get_frame_arch (frame), regnum))
{
@ -4443,7 +4443,7 @@ i386_stap_adjust_register (struct gdbarch *gdbarch, struct stap_parse_info *p,
specified by the "[-]N@" prefix, and it is one of the registers that
we know has an extended variant available, then use the extended
version of the register instead. */
if (register_size (gdbarch, regnum) < TYPE_LENGTH (p->arg_type)
if (register_size (gdbarch, regnum) < p->arg_type->length ()
&& reg_assoc.find (regname) != reg_assoc.end ())
return "e" + regname;
@ -8427,12 +8427,12 @@ i386_type_align (struct gdbarch *gdbarch, struct type *type)
{
if ((type->code () == TYPE_CODE_INT
|| type->code () == TYPE_CODE_FLT)
&& TYPE_LENGTH (type) > 4)
&& type->length () > 4)
return 4;
/* Handle x86's funny long double. */
if (type->code () == TYPE_CODE_FLT
&& gdbarch_long_double_bit (gdbarch) == TYPE_LENGTH (type) * 8)
&& gdbarch_long_double_bit (gdbarch) == type->length () * 8)
return 4;
}
@ -9006,7 +9006,7 @@ i386_mpx_info_bounds (const char *args, int from_tty)
for (i = 0; i < 4; i++)
bt_entry[i] = read_memory_typed_address (bt_entry_addr
+ i * TYPE_LENGTH (data_ptr_type),
+ i * data_ptr_type->length (),
data_ptr_type);
i386_mpx_print_bounds (bt_entry);
@ -9053,15 +9053,15 @@ i386_mpx_set_bounds (const char *args, int from_tty)
bt_entry_addr = i386_mpx_get_bt_entry (addr, bd_base);
for (i = 0; i < 2; i++)
bt_entry[i] = read_memory_typed_address (bt_entry_addr
+ i * TYPE_LENGTH (data_ptr_type),
+ i * data_ptr_type->length (),
data_ptr_type);
bt_entry[0] = (uint64_t) lower;
bt_entry[1] = ~(uint64_t) upper;
for (i = 0; i < 2; i++)
write_memory_unsigned_integer (bt_entry_addr
+ i * TYPE_LENGTH (data_ptr_type),
TYPE_LENGTH (data_ptr_type), byte_order,
+ i * data_ptr_type->length (),
data_ptr_type->length (), byte_order,
bt_entry[i]);
}

View File

@ -3168,12 +3168,12 @@ ia64_use_struct_convention (struct type *type)
case. */
float_elt_type = is_float_or_hfa_type (type);
if (float_elt_type != NULL
&& TYPE_LENGTH (type) / TYPE_LENGTH (float_elt_type) <= 8)
&& type->length () / float_elt_type->length () <= 8)
return 0;
/* Other structs of length 32 or less are returned in r8-r11.
Don't use the struct convention for those either. */
return TYPE_LENGTH (type) > 32;
return type->length () > 32;
}
/* Return non-zero if TYPE is a structure or union type. */
@ -3198,18 +3198,18 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte from[IA64_FP_REGISTER_SIZE];
int offset = 0;
int regnum = IA64_FR8_REGNUM;
int n = TYPE_LENGTH (type) / TYPE_LENGTH (float_elt_type);
int n = type->length () / float_elt_type->length ();
while (n-- > 0)
{
regcache->cooked_read (regnum, from);
target_float_convert (from, ia64_ext_type (gdbarch),
valbuf + offset, float_elt_type);
offset += TYPE_LENGTH (float_elt_type);
offset += float_elt_type->length ();
regnum++;
}
}
else if (!ia64_struct_type_p (type) && TYPE_LENGTH (type) < 8)
else if (!ia64_struct_type_p (type) && type->length () < 8)
{
/* This is an integral value, and its size is less than 8 bytes.
These values are LSB-aligned, so extract the relevant bytes,
@ -3222,16 +3222,16 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
ULONGEST val;
regcache_cooked_read_unsigned (regcache, IA64_GR8_REGNUM, &val);
store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, val);
store_unsigned_integer (valbuf, type->length (), byte_order, val);
}
else
{
ULONGEST val;
int offset = 0;
int regnum = IA64_GR8_REGNUM;
int reglen = TYPE_LENGTH (register_type (gdbarch, IA64_GR8_REGNUM));
int n = TYPE_LENGTH (type) / reglen;
int m = TYPE_LENGTH (type) % reglen;
int reglen = register_type (gdbarch, IA64_GR8_REGNUM)->length ();
int n = type->length () / reglen;
int m = type->length () % reglen;
while (n-- > 0)
{
@ -3263,14 +3263,14 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
gdb_byte to[IA64_FP_REGISTER_SIZE];
int offset = 0;
int regnum = IA64_FR8_REGNUM;
int n = TYPE_LENGTH (type) / TYPE_LENGTH (float_elt_type);
int n = type->length () / float_elt_type->length ();
while (n-- > 0)
{
target_float_convert (valbuf + offset, float_elt_type,
to, ia64_ext_type (gdbarch));
regcache->cooked_write (regnum, to);
offset += TYPE_LENGTH (float_elt_type);
offset += float_elt_type->length ();
regnum++;
}
}
@ -3278,9 +3278,9 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
{
int offset = 0;
int regnum = IA64_GR8_REGNUM;
int reglen = TYPE_LENGTH (register_type (gdbarch, IA64_GR8_REGNUM));
int n = TYPE_LENGTH (type) / reglen;
int m = TYPE_LENGTH (type) % reglen;
int reglen = register_type (gdbarch, IA64_GR8_REGNUM)->length ();
int n = type->length () / reglen;
int m = type->length () % reglen;
while (n-- > 0)
{
@ -3332,7 +3332,7 @@ is_float_or_hfa_type_recurse (struct type *t, struct type **etp)
{
case TYPE_CODE_FLT:
if (*etp)
return TYPE_LENGTH (*etp) == TYPE_LENGTH (t);
return (*etp)->length () == t->length ();
else
{
*etp = t;
@ -3387,7 +3387,7 @@ slot_alignment_is_next_even (struct type *t)
{
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
if (TYPE_LENGTH (t) > 8)
if (t->length () > 8)
return 1;
else
return 0;
@ -3699,7 +3699,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
arg = args[argno];
type = check_typedef (value_type (arg));
len = TYPE_LENGTH (type);
len = type->length ();
if ((nslots & 1) && slot_alignment_is_next_even (type))
nslots++;
@ -3742,7 +3742,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
arg = args[argno];
type = check_typedef (value_type (arg));
len = TYPE_LENGTH (type);
len = type->length ();
/* Special handling for function parameters. */
if (len == 8
@ -3817,7 +3817,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (float_elt_type != NULL)
{
argoffset = 0;
len = TYPE_LENGTH (type);
len = type->length ();
while (len > 0 && floatreg < IA64_FR16_REGNUM)
{
gdb_byte to[IA64_FP_REGISTER_SIZE];
@ -3826,8 +3826,8 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
ia64_ext_type (gdbarch));
regcache->cooked_write (floatreg, to);
floatreg++;
argoffset += TYPE_LENGTH (float_elt_type);
len -= TYPE_LENGTH (float_elt_type);
argoffset += float_elt_type->length ();
len -= float_elt_type->length ();
}
}
}

View File

@ -194,21 +194,21 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
/* If we don't have a prototype, coerce to integer type if necessary. */
if (!is_prototyped)
{
if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin->builtin_int))
if (type->length () < builtin->builtin_int->length ())
type = builtin->builtin_int;
}
/* Currently all target ABIs require at least the width of an integer
type for an argument. We may have to conditionalize the following
type coercion for future targets. */
if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin->builtin_int))
if (type->length () < builtin->builtin_int->length ())
type = builtin->builtin_int;
break;
case TYPE_CODE_FLT:
if (!is_prototyped && coerce_float_to_double_p)
{
if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin->builtin_double))
if (type->length () < builtin->builtin_double->length ())
type = builtin->builtin_double;
else if (TYPE_LENGTH (type) > TYPE_LENGTH (builtin->builtin_double))
else if (type->length () > builtin->builtin_double->length ())
type = builtin->builtin_long_double;
}
break;
@ -307,7 +307,7 @@ find_function_addr (struct value *function,
{
/* Handle the case of functions lacking debugging info.
Their values are characters since their addresses are char. */
if (TYPE_LENGTH (ftype) == 1)
if (ftype->length () == 1)
funaddr = value_as_address (value_addr (function));
else
{
@ -452,7 +452,7 @@ get_call_return_value (struct call_return_meta_info *ri)
retval = allocate_value (ri->value_type);
read_value_memory (retval, 0, 1, ri->struct_addr,
value_contents_raw (retval).data (),
TYPE_LENGTH (ri->value_type));
ri->value_type->length ());
}
}
else
@ -681,7 +681,7 @@ reserve_stack_space (const type *values_type, CORE_ADDR &sp)
{
/* Stack grows downward. Align STRUCT_ADDR and SP after
making space. */
sp -= TYPE_LENGTH (values_type);
sp -= values_type->length ();
if (gdbarch_frame_align_p (gdbarch))
sp = gdbarch_frame_align (gdbarch, sp);
addr = sp;
@ -693,7 +693,7 @@ reserve_stack_space (const type *values_type, CORE_ADDR &sp)
if (gdbarch_frame_align_p (gdbarch))
sp = gdbarch_frame_align (gdbarch, sp);
addr = sp;
sp += TYPE_LENGTH (values_type);
sp += values_type->length ();
if (gdbarch_frame_align_p (gdbarch))
sp = gdbarch_frame_align (gdbarch, sp);
}
@ -926,7 +926,7 @@ call_function_by_hand_dummy (struct value *function,
else
{
gdb_assert (sp <= lastval_addr);
sp = lastval_addr + TYPE_LENGTH (value_type (lastval));
sp = lastval_addr + value_type (lastval)->length ();
}
if (gdbarch_frame_align_p (gdbarch))
@ -1083,7 +1083,7 @@ call_function_by_hand_dummy (struct value *function,
if (info.trivially_copy_constructible)
{
int length = TYPE_LENGTH (param_type);
int length = param_type->length ();
write_memory (addr, value_contents (args[i]).data (), length);
}
else

View File

@ -2151,7 +2151,7 @@ default_print_one_register_info (struct ui_file *file,
{
pad_to_column (format_stream, value_column_2);
format_stream.puts ("(raw ");
print_hex_chars (&format_stream, valaddr, TYPE_LENGTH (regtype),
print_hex_chars (&format_stream, valaddr, regtype->length (),
byte_order, true);
format_stream.putc (')');
}

View File

@ -9177,9 +9177,9 @@ siginfo_value_read (struct value *v)
NULL,
value_contents_all_raw (v).data (),
value_offset (v),
TYPE_LENGTH (value_type (v)));
value_type (v)->length ());
if (transferred != TYPE_LENGTH (value_type (v)))
if (transferred != value_type (v)->length ())
error (_("Unable to read siginfo"));
}
@ -9200,9 +9200,9 @@ siginfo_value_write (struct value *v, struct value *fromval)
NULL,
value_contents_all_raw (fromval).data (),
value_offset (v),
TYPE_LENGTH (value_type (fromval)));
value_type (fromval)->length ());
if (transferred != TYPE_LENGTH (value_type (fromval)))
if (transferred != value_type (fromval)->length ())
error (_("Unable to write siginfo"));
}
@ -9256,7 +9256,7 @@ public:
if (gdbarch_get_siginfo_type_p (gdbarch))
{
struct type *type = gdbarch_get_siginfo_type (gdbarch);
size_t len = TYPE_LENGTH (type);
size_t len = type->length ();
siginfo_data.reset ((gdb_byte *) xmalloc (len));
@ -9298,7 +9298,7 @@ public:
/* Errors ignored. */
target_write (current_inferior ()->top_target (),
TARGET_OBJECT_SIGNAL_INFO, NULL,
m_siginfo_data.get (), 0, TYPE_LENGTH (type));
m_siginfo_data.get (), 0, type->length ());
}
/* The inferior can be gone if the user types "print exit(0)"
@ -9320,7 +9320,7 @@ private:
struct gdbarch *m_siginfo_gdbarch = nullptr;
/* The inferior format depends on SIGINFO_GDBARCH and it has a length of
TYPE_LENGTH (gdbarch_get_siginfo_type ()). For different gdbarch the
gdbarch_get_siginfo_type ()->length (). For different gdbarch the
content would be invalid. */
gdb::unique_xmalloc_ptr<gdb_byte> m_siginfo_data;
};

View File

@ -91,7 +91,7 @@ iq2000_pointer_to_address (struct gdbarch *gdbarch,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = type->target_type ()->code ();
CORE_ADDR addr
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
= extract_unsigned_integer (buf, type->length (), byte_order);
if (target == TYPE_CODE_FUNC
|| target == TYPE_CODE_METHOD
@ -113,7 +113,7 @@ iq2000_address_to_pointer (struct gdbarch *gdbarch,
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
addr = insn_ptr_from_addr (addr);
store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
store_unsigned_integer (buf, type->length (), byte_order, addr);
}
/* Real register methods: */
@ -482,7 +482,7 @@ static void
iq2000_store_return_value (struct type *type, struct regcache *regcache,
const void *valbuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
int regno = E_FN_RETURN_REGNUM;
while (len > 0)
@ -507,7 +507,7 @@ iq2000_use_struct_convention (struct type *type)
{
return ((type->code () == TYPE_CODE_STRUCT)
|| (type->code () == TYPE_CODE_UNION))
&& TYPE_LENGTH (type) > 8;
&& type->length () > 8;
}
/* Function: extract_return_value
@ -528,7 +528,7 @@ iq2000_extract_return_value (struct type *type, struct regcache *regcache,
returned in a register, and if larger than 8 bytes, it is
returned in a stack location which is pointed to by the same
register. */
int len = TYPE_LENGTH (type);
int len = type->length ();
if (len <= (2 * 4))
{
@ -556,7 +556,7 @@ iq2000_extract_return_value (struct type *type, struct regcache *regcache,
ULONGEST return_buffer;
regcache_cooked_read_unsigned (regcache, E_FN_RETURN_REGNUM,
&return_buffer);
read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
read_memory (return_buffer, valbuf, type->length ());
}
}
@ -610,7 +610,7 @@ iq2000_pass_8bytetype_by_address (struct type *type)
/* Get field type. */
ftype = type->field (0).type ();
/* The field type must have size 8, otherwise pass by address. */
if (TYPE_LENGTH (ftype) != 8)
if (ftype->length () != 8)
return 1;
/* Skip typedefs of field type. */
while (ftype->code () == TYPE_CODE_TYPEDEF)
@ -645,7 +645,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
i++)
{
type = value_type (args[i]);
typelen = TYPE_LENGTH (type);
typelen = type->length ();
if (typelen <= 4)
{
/* Scalars of up to 4 bytes,
@ -711,7 +711,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = 0; i < nargs; i++)
{
type = value_type (args[i]);
typelen = TYPE_LENGTH (type);
typelen = type->length ();
val = value_contents (args[i]).data ();
if (typelen <= 4)
{

View File

@ -265,7 +265,7 @@ jit_read_descriptor (gdbarch *gdbarch,
/* Figure out how big the descriptor is on the remote and how to read it. */
ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
ptr_size = TYPE_LENGTH (ptr_type);
ptr_size = ptr_type->length ();
desc_size = 8 + 2 * ptr_size; /* Two 32-bit ints and two pointers. */
desc_buf = (gdb_byte *) alloca (desc_size);
@ -305,7 +305,7 @@ jit_read_code_entry (struct gdbarch *gdbarch,
/* Figure out how big the entry is on the remote and how to read it. */
ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
ptr_size = TYPE_LENGTH (ptr_type);
ptr_size = ptr_type->length ();
/* Figure out where the uint64_t value will be. */
align_bytes = type_align (builtin_type (gdbarch)->builtin_uint64);

View File

@ -84,7 +84,7 @@
#define RECORD_Q_XGETQUOTA (('3' << 8) + 3)
#define OUTPUT_REG(val, num) phex_nz ((val), \
TYPE_LENGTH (gdbarch_register_type (regcache->arch (), (num))))
gdbarch_register_type (regcache->arch (), (num))->length ())
/* Record a memory area of length LEN pointed to by register
REGNUM. */

View File

@ -293,19 +293,19 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
/* __pid_t */
pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (int_type) * TARGET_CHAR_BIT, "__pid_t");
int_type->length () * TARGET_CHAR_BIT, "__pid_t");
pid_type->set_target_type (int_type);
pid_type->set_target_is_stub (true);
/* __uid_t */
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (uint_type) * TARGET_CHAR_BIT, "__uid_t");
uint_type->length () * TARGET_CHAR_BIT, "__uid_t");
uid_type->set_target_type (uint_type);
uid_type->set_target_is_stub (true);
/* __clock_t */
clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (long_type) * TARGET_CHAR_BIT,
long_type->length () * TARGET_CHAR_BIT,
"__clock_t");
clock_type->set_target_type (long_type);
clock_type->set_target_is_stub (true);
@ -394,7 +394,7 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
append_composite_type_field (siginfo_type, "si_code", int_type);
append_composite_type_field_aligned (siginfo_type,
"_sifields", sifields_type,
TYPE_LENGTH (long_type));
long_type->length ());
linux_gdbarch_data->siginfo_type = siginfo_type;
@ -1715,11 +1715,11 @@ linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size,
++map_data->file_count;
pack_long (buf, map_data->long_type, vaddr);
obstack_grow (map_data->data_obstack, buf, TYPE_LENGTH (map_data->long_type));
obstack_grow (map_data->data_obstack, buf, map_data->long_type->length ());
pack_long (buf, map_data->long_type, vaddr + size);
obstack_grow (map_data->data_obstack, buf, TYPE_LENGTH (map_data->long_type));
obstack_grow (map_data->data_obstack, buf, map_data->long_type->length ());
pack_long (buf, map_data->long_type, offset);
obstack_grow (map_data->data_obstack, buf, TYPE_LENGTH (map_data->long_type));
obstack_grow (map_data->data_obstack, buf, map_data->long_type->length ());
obstack_grow_str0 (map_data->filename_obstack, filename);
@ -1748,11 +1748,11 @@ linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
mapping_data.long_type = long_type;
/* Reserve space for the count. */
obstack_blank (&data_obstack, TYPE_LENGTH (long_type));
obstack_blank (&data_obstack, long_type->length ());
/* We always write the page size as 1 since we have no good way to
determine the correct value. */
pack_long (buf, long_type, 1);
obstack_grow (&data_obstack, buf, TYPE_LENGTH (long_type));
obstack_grow (&data_obstack, buf, long_type->length ());
linux_find_memory_regions_full (gdbarch,
dump_note_entry_p,
@ -1794,12 +1794,12 @@ linux_get_siginfo_data (thread_info *thread, struct gdbarch *gdbarch)
siginfo_type = gdbarch_get_siginfo_type (gdbarch);
gdb::byte_vector buf (TYPE_LENGTH (siginfo_type));
gdb::byte_vector buf (siginfo_type->length ());
bytes_read = target_read (current_inferior ()->top_target (),
TARGET_OBJECT_SIGNAL_INFO, NULL,
buf.data (), 0, TYPE_LENGTH (siginfo_type));
if (bytes_read != TYPE_LENGTH (siginfo_type))
buf.data (), 0, siginfo_type->length ());
if (bytes_read != siginfo_type->length ())
buf.clear ();
return buf;

View File

@ -252,7 +252,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
case TYPE_CODE_CHAR:
case TYPE_CODE_RANGE:
case TYPE_CODE_ENUM:
if (TYPE_LENGTH (arg_type) < 4)
if (arg_type->length () < 4)
{
arg_type = builtin_type (gdbarch)->builtin_int32;
arg = value_cast (arg_type, arg);
@ -263,7 +263,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* FIXME: Handle structures. */
contents = (gdb_byte *) value_contents (arg).data ();
val = extract_unsigned_integer (contents, TYPE_LENGTH (arg_type),
val = extract_unsigned_integer (contents, arg_type->length (),
byte_order);
/* First num_arg_regs parameters are passed by registers,
@ -272,7 +272,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val);
else
{
write_memory_unsigned_integer (sp, TYPE_LENGTH (arg_type), byte_order,
write_memory_unsigned_integer (sp, arg_type->length (), byte_order,
val);
sp -= 4;
}
@ -298,13 +298,13 @@ lm32_extract_return_value (struct type *type, struct regcache *regcache,
if (type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_UNION
&& type->code () != TYPE_CODE_ARRAY && TYPE_LENGTH (type) <= 4)
&& type->code () != TYPE_CODE_ARRAY && type->length () <= 4)
{
/* Return value is returned in a single register. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, l);
store_unsigned_integer (valbuf, type->length (), byte_order, l);
}
else if ((type->code () == TYPE_CODE_INT) && (TYPE_LENGTH (type) == 8))
else if ((type->code () == TYPE_CODE_INT) && (type->length () == 8))
{
/* 64-bit values are returned in a register pair. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
@ -318,7 +318,7 @@ lm32_extract_return_value (struct type *type, struct regcache *regcache,
in memory. FIXME: Unless they are only 2 regs?. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
return_buffer = l;
read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
read_memory (return_buffer, valbuf, type->length ());
}
}
@ -331,7 +331,7 @@ lm32_store_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
int len = TYPE_LENGTH (type);
int len = type->length ();
if (len <= 4)
{
@ -359,7 +359,7 @@ lm32_return_value (struct gdbarch *gdbarch, struct value *function,
if (code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION
|| code == TYPE_CODE_ARRAY || TYPE_LENGTH (valtype) > 8)
|| code == TYPE_CODE_ARRAY || valtype->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)

View File

@ -567,7 +567,7 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
struct value *arg = args[i];
const gdb_byte *val = value_contents (arg).data ();
struct type *type = check_typedef (value_type (arg));
size_t len = TYPE_LENGTH (type);
size_t len = type->length ();
int align = type_align (type);
enum type_code code = type->code ();
struct type *func_type = check_typedef (value_type (function));
@ -1027,7 +1027,7 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
case TYPE_CODE_COMPLEX:
{
struct type *target_type = check_typedef (type->target_type ());
size_t target_len = TYPE_LENGTH (target_type);
size_t target_len = target_type->length ();
if (target_len < regsize)
{
@ -1143,7 +1143,7 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
{
int regsize = register_size (gdbarch, 0);
enum type_code code = type->code ();
size_t len = TYPE_LENGTH (type);
size_t len = type->length ();
unsigned int fixed_point_members;
unsigned int floating_point_members;
bool first_member_is_fixed_point;

View File

@ -480,7 +480,7 @@ exp : SIZE '(' type ')' %prec UNARY
{
pstate->push_new<long_const_operation>
(parse_m2_type (pstate)->builtin_int,
TYPE_LENGTH ($3));
$3->length ());
}
;

View File

@ -118,12 +118,12 @@ public:
{
type = check_typedef (type);
if (type->code () == TYPE_CODE_ARRAY
&& TYPE_LENGTH (type) > 0
&& TYPE_LENGTH (type->target_type ()) > 0)
&& type->length () > 0
&& type->target_type ()->length () > 0)
{
struct type *elttype = check_typedef (type->target_type ());
if (TYPE_LENGTH (elttype) == 1
if (elttype->length () == 1
&& (elttype->code () == TYPE_CODE_INT
|| elttype->code () == TYPE_CODE_CHAR))
return true;

View File

@ -225,7 +225,7 @@ static void m2_array (struct type *type, struct ui_file *stream,
int show, int level, const struct type_print_options *flags)
{
gdb_printf (stream, "ARRAY [");
if (TYPE_LENGTH (type->target_type ()) > 0
if (type->target_type ()->length () > 0
&& type->bounds ()->high.kind () != PROP_UNDEFINED)
{
if (type->index_type () != 0)
@ -235,8 +235,8 @@ static void m2_array (struct type *type, struct ui_file *stream,
m2_print_bounds (type->index_type (), stream, show, -1, 1);
}
else
gdb_puts (pulongest ((TYPE_LENGTH (type)
/ TYPE_LENGTH (type->target_type ()))),
gdb_puts (pulongest ((type->length ()
/ type->target_type ()->length ())),
stream);
}
gdb_printf (stream, "] OF ");
@ -379,11 +379,11 @@ m2_get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
switch (type->code ())
{
case TYPE_CODE_CHAR:
if (TYPE_LENGTH (type) < sizeof (LONGEST))
if (type->length () < sizeof (LONGEST))
{
if (!type->is_unsigned ())
{
*lowp = -(1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1));
*lowp = -(1 << (type->length () * TARGET_CHAR_BIT - 1));
*highp = -*lowp - 1;
return 0;
}

View File

@ -207,7 +207,7 @@ print_unpacked_pointer (struct type *type,
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
if (TYPE_LENGTH (elttype) == 1
if (elttype->length () == 1
&& elttype->code () == TYPE_CODE_INT
&& (options->format == 0 || options->format == 's')
&& addr != 0)
@ -262,10 +262,10 @@ m2_print_array_contents (struct value *val,
{
struct type *type = check_typedef (value_type (val));
if (TYPE_LENGTH (type) > 0)
if (type->length () > 0)
{
/* For an array of chars, print with string syntax. */
if (TYPE_LENGTH (type) == 1 &&
if (type->length () == 1 &&
((type->code () == TYPE_CODE_INT)
|| ((current_language->la_language == language_m2)
&& (type->code () == TYPE_CODE_CHAR)))
@ -312,12 +312,12 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
switch (type->code ())
{
case TYPE_CODE_ARRAY:
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (type->target_type ()) > 0)
if (type->length () > 0 && type->target_type ()->length () > 0)
{
elttype = check_typedef (type->target_type ());
len = TYPE_LENGTH (type) / TYPE_LENGTH (elttype);
len = type->length () / elttype->length ();
/* For an array of chars, print with string syntax. */
if (TYPE_LENGTH (elttype) == 1 &&
if (elttype->length () == 1 &&
((elttype->code () == TYPE_CODE_INT)
|| ((current_language->la_language == language_m2)
&& (elttype->code () == TYPE_CODE_CHAR)))
@ -443,7 +443,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
break;
case TYPE_CODE_RANGE:
if (TYPE_LENGTH (type) == TYPE_LENGTH (type->target_type ()))
if (type->length () == type->target_type ()->length ())
{
struct value *v = value_cast (type->target_type (), val);
value_print_inner (v, stream, recurse, options);

View File

@ -409,10 +409,10 @@ static void
m32c_find_part (struct m32c_reg *reg, int *offset_p, int *len_p)
{
/* The length of the containing register, of which REG is one part. */
int containing_len = TYPE_LENGTH (reg->rx->type);
int containing_len = reg->rx->type->length ();
/* The length of one "element" in our imaginary array. */
int elt_len = TYPE_LENGTH (reg->type);
int elt_len = reg->type->length ();
/* The offset of REG's "element" from the least significant end of
the containing register. */
@ -429,7 +429,7 @@ m32c_find_part (struct m32c_reg *reg, int *offset_p, int *len_p)
/* Flip the offset around if we're big-endian. */
if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG)
elt_offset = TYPE_LENGTH (reg->rx->type) - elt_offset - elt_len;
elt_offset = reg->rx->type->length () - elt_offset - elt_len;
*offset_p = elt_offset;
*len_p = elt_len;
@ -445,7 +445,7 @@ m32c_part_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
int offset, len;
memset (buf, 0, TYPE_LENGTH (reg->type));
memset (buf, 0, reg->type->length ());
m32c_find_part (reg, &offset, &len);
return cache->cooked_read_part (reg->rx->num, offset, len, buf);
}
@ -474,11 +474,11 @@ m32c_part_write (struct m32c_reg *reg, struct regcache *cache,
static enum register_status
m32c_cat_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
int high_bytes = TYPE_LENGTH (reg->rx->type);
int low_bytes = TYPE_LENGTH (reg->ry->type);
int high_bytes = reg->rx->type->length ();
int low_bytes = reg->ry->type->length ();
enum register_status status;
gdb_assert (TYPE_LENGTH (reg->type) == high_bytes + low_bytes);
gdb_assert (reg->type->length () == high_bytes + low_bytes);
if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG)
{
@ -503,10 +503,10 @@ static enum register_status
m32c_cat_write (struct m32c_reg *reg, struct regcache *cache,
const gdb_byte *buf)
{
int high_bytes = TYPE_LENGTH (reg->rx->type);
int low_bytes = TYPE_LENGTH (reg->ry->type);
int high_bytes = reg->rx->type->length ();
int low_bytes = reg->ry->type->length ();
gdb_assert (TYPE_LENGTH (reg->type) == high_bytes + low_bytes);
gdb_assert (reg->type->length () == high_bytes + low_bytes);
if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG)
{
@ -531,7 +531,7 @@ m32c_r3r2r1r0_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *bu
{
gdbarch *arch = reg->arch;
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (arch);
int len = TYPE_LENGTH (tdep->r0->type);
int len = tdep->r0->type->length ();
enum register_status status;
if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG)
@ -568,7 +568,7 @@ m32c_r3r2r1r0_write (struct m32c_reg *reg, struct regcache *cache,
{
gdbarch *arch = reg->arch;
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (arch);
int len = TYPE_LENGTH (tdep->r0->type);
int len = tdep->r0->type->length ();
if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG)
{
@ -2052,7 +2052,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
subsequent arguments are allocated to registers. */
if (return_method == return_method_struct)
{
int ptr_len = TYPE_LENGTH (tdep->ptr_voyd);
int ptr_len = tdep->ptr_voyd->length ();
sp -= ptr_len;
write_memory_unsigned_integer (sp, ptr_len, byte_order, struct_addr);
}
@ -2063,7 +2063,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value *arg = args[i];
const gdb_byte *arg_bits = value_contents (arg).data ();
struct type *arg_type = value_type (arg);
ULONGEST arg_size = TYPE_LENGTH (arg_type);
ULONGEST arg_size = arg_type->length ();
/* Can it go in r1 or r1l (for m16c) or r0 or r0l (for m32c)? */
if (i == 0
@ -2181,7 +2181,7 @@ m32c_return_value (struct gdbarch *gdbarch,
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum return_value_convention conv;
ULONGEST valtype_len = TYPE_LENGTH (valtype);
ULONGEST valtype_len = valtype->length ();
if (m32c_return_by_passed_buf (valtype))
conv = RETURN_VALUE_STRUCT_CONVENTION;
@ -2198,7 +2198,7 @@ m32c_return_value (struct gdbarch *gdbarch,
gdb_assert (valtype_len <= 8);
/* Anything that fits in r0 is returned there. */
if (valtype_len <= TYPE_LENGTH (tdep->r0->type))
if (valtype_len <= tdep->r0->type->length ())
{
ULONGEST u;
regcache_cooked_read_unsigned (regcache, tdep->r0->num, &u);
@ -2230,7 +2230,7 @@ m32c_return_value (struct gdbarch *gdbarch,
gdb_assert (valtype_len <= 8);
/* Anything that fits in r0 is returned there. */
if (valtype_len <= TYPE_LENGTH (tdep->r0->type))
if (valtype_len <= tdep->r0->type->length ())
{
ULONGEST u = extract_unsigned_integer (writebuf, valtype_len,
byte_order);
@ -2477,7 +2477,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
}
}
store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
store_unsigned_integer (buf, type->length (), byte_order, addr);
}
@ -2491,7 +2491,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
gdb_assert (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type));
ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
ptr = extract_unsigned_integer (buf, type->length (), byte_order);
target_code = type->target_type ()->code ();

View File

@ -247,7 +247,7 @@ m32r_store_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR regval;
int len = TYPE_LENGTH (type);
int len = type->length ();
regval = extract_unsigned_integer (valbuf, len > 4 ? 4 : len, byte_order);
regcache_cooked_write_unsigned (regcache, RET1_REGNUM, regval);
@ -685,14 +685,14 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make sure there's space on the stack. */
for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++)
stack_alloc += ((TYPE_LENGTH (value_type (args[argnum])) + 3) & ~3);
stack_alloc += ((value_type (args[argnum])->length () + 3) & ~3);
sp -= stack_alloc; /* Make room on stack for args. */
for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
{
type = value_type (args[argnum]);
typecode = type->code ();
len = TYPE_LENGTH (type);
len = type->length ();
memset (valbuf, 0, sizeof (valbuf));
@ -758,7 +758,7 @@ m32r_extract_return_value (struct type *type, struct regcache *regcache,
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type);
int len = type->length ();
ULONGEST tmp;
/* By using store_unsigned_integer we avoid having to do
@ -780,7 +780,7 @@ m32r_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (TYPE_LENGTH (valtype) > 8)
if (valtype->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
else
{

View File

@ -1176,16 +1176,16 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
type = value_type (args[0]);
/* First argument is passed in D and X registers. */
if (TYPE_LENGTH (type) <= 4)
if (type->length () <= 4)
{
ULONGEST v;
v = extract_unsigned_integer (value_contents (args[0]).data (),
TYPE_LENGTH (type), byte_order);
type->length (), byte_order);
first_stack_argnum = 1;
regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v);
if (TYPE_LENGTH (type) > 2)
if (type->length () > 2)
{
v >>= 16;
regcache_cooked_write_unsigned (regcache, HARD_X_REGNUM, v);
@ -1197,7 +1197,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
type = value_type (args[argnum]);
if (TYPE_LENGTH (type) & 1)
if (type->length () & 1)
{
static gdb_byte zero = 0;
@ -1205,8 +1205,8 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
write_memory (sp, &zero, 1);
}
val = value_contents (args[argnum]).data ();
sp -= TYPE_LENGTH (type);
write_memory (sp, val, TYPE_LENGTH (type));
sp -= type->length ();
write_memory (sp, val, type->length ());
}
/* Store return address. */
@ -1255,7 +1255,7 @@ m68hc11_store_return_value (struct type *type, struct regcache *regcache,
{
int len;
len = TYPE_LENGTH (type);
len = type->length ();
/* First argument is passed in D and X registers. */
if (len <= 2)
@ -1280,7 +1280,7 @@ m68hc11_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte buf[M68HC11_REG_SIZE];
regcache->raw_read (HARD_D_REGNUM, buf);
switch (TYPE_LENGTH (type))
switch (type->length ())
{
case 1:
memcpy (valbuf, buf + 1, 1);
@ -1315,7 +1315,7 @@ m68hc11_return_value (struct gdbarch *gdbarch, struct value *function,
if (valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION
|| valtype->code () == TYPE_CODE_ARRAY
|| TYPE_LENGTH (valtype) > 4)
|| valtype->length () > 4)
return RETURN_VALUE_STRUCT_CONVENTION;
else
{

View File

@ -41,7 +41,7 @@
int
m68kbsd_fpreg_offset (struct gdbarch *gdbarch, int regnum)
{
int fp_len = TYPE_LENGTH (gdbarch_register_type (gdbarch, regnum));
int fp_len = gdbarch_register_type (gdbarch, regnum)->length ();
if (regnum >= M68K_FPC_REGNUM)
return 8 * fp_len + (regnum - M68K_FPC_REGNUM) * 4;

View File

@ -294,7 +294,7 @@ static void
m68k_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
if (type->code () == TYPE_CODE_PTR && len == 4)
@ -343,7 +343,7 @@ static void
m68k_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
if (type->code () == TYPE_CODE_PTR && len == 4)
{
@ -393,7 +393,7 @@ m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
{
m68k_gdbarch_tdep *tdep = gdbarch_tdep<m68k_gdbarch_tdep> (gdbarch);
enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
int len = type->length ();
gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
|| code == TYPE_CODE_COMPLEX || code == TYPE_CODE_ARRAY);
@ -438,7 +438,7 @@ m68k_return_value (struct gdbarch *gdbarch, struct value *function,
if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
|| code == TYPE_CODE_COMPLEX || code == TYPE_CODE_ARRAY)
&& !m68k_reg_struct_return_p (gdbarch, type))
|| (code == TYPE_CODE_FLT && TYPE_LENGTH (type) == 12))
|| (code == TYPE_CODE_FLT && type->length () == 12))
{
/* The default on m68k is to return structures in static memory.
Consequently a function must return the address where we can
@ -449,7 +449,7 @@ m68k_return_value (struct gdbarch *gdbarch, struct value *function,
ULONGEST addr;
regcache_raw_read_unsigned (regcache, M68K_D0_REGNUM, &addr);
read_memory (addr, readbuf, TYPE_LENGTH (type));
read_memory (addr, readbuf, type->length ());
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
@ -487,7 +487,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
/* GCC may return a `long double' in memory too. */
|| (!tdep->float_return
&& code == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 12))
&& type->length () == 12))
{
/* The System V ABI says that:
@ -509,7 +509,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
regcache_raw_read_unsigned (regcache, tdep->pointer_result_regnum,
&addr);
read_memory (addr, readbuf, TYPE_LENGTH (type));
read_memory (addr, readbuf, type->length ());
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
@ -550,7 +550,7 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = nargs - 1; i >= 0; i--)
{
struct type *value_type = value_enclosing_type (args[i]);
int len = TYPE_LENGTH (value_type);
int len = value_type->length ();
int container_len = (len + 3) & ~3;
int offset;

View File

@ -1041,8 +1041,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
are hopefully rare enough.
Alpha cc -migrate has a sh.value field of zero, we adjust
that too. */
if (TYPE_LENGTH (t) == t->num_fields ()
|| TYPE_LENGTH (t) == 0)
if (t->length () == t->num_fields ()
|| t->length () == 0)
t->set_length (gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT);
for (ext_tsym = ext_sh + external_sym_size;
;
@ -1869,7 +1869,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
dbx seems to ignore it too. */
/* TYPE_TARGET_STUB now takes care of the zero TYPE_LENGTH problem. */
if (TYPE_LENGTH (*tpp) == 0)
if ((*tpp)->length () == 0)
t->set_target_is_stub (true);
*tpp = t;

View File

@ -1131,8 +1131,8 @@ mep_pseudo_cr32_read (struct gdbarch *gdbarch,
int rawnum = mep_pseudo_to_raw[cookednum];
gdb_byte buf64[8];
gdb_assert (TYPE_LENGTH (register_type (gdbarch, rawnum)) == sizeof (buf64));
gdb_assert (TYPE_LENGTH (register_type (gdbarch, cookednum)) == 4);
gdb_assert (register_type (gdbarch, rawnum)->length () == sizeof (buf64));
gdb_assert (register_type (gdbarch, cookednum)->length () == 4);
status = regcache->raw_read (rawnum, buf64);
if (status == REG_VALID)
{
@ -1217,8 +1217,8 @@ mep_pseudo_cr32_write (struct gdbarch *gdbarch,
int rawnum = mep_pseudo_to_raw[cookednum];
gdb_byte buf64[8];
gdb_assert (TYPE_LENGTH (register_type (gdbarch, rawnum)) == sizeof (buf64));
gdb_assert (TYPE_LENGTH (register_type (gdbarch, cookednum)) == 4);
gdb_assert (register_type (gdbarch, rawnum)->length () == sizeof (buf64));
gdb_assert (register_type (gdbarch, cookednum)->length () == 4);
/* Slow, but legible. */
store_unsigned_integer (buf64, 8, byte_order,
extract_unsigned_integer (buf, 4, byte_order));
@ -2075,7 +2075,7 @@ static const struct frame_unwind mep_frame_unwind = {
static int
mep_use_struct_convention (struct type *type)
{
return (TYPE_LENGTH (type) > MEP_GPR_SIZE);
return (type->length () > MEP_GPR_SIZE);
}
@ -2094,15 +2094,15 @@ mep_extract_return_value (struct gdbarch *arch,
/* Return values > MEP_GPR_SIZE bytes are returned in memory,
pointed to by R0. */
gdb_assert (TYPE_LENGTH (type) <= MEP_GPR_SIZE);
gdb_assert (type->length () <= MEP_GPR_SIZE);
if (byte_order == BFD_ENDIAN_BIG)
offset = MEP_GPR_SIZE - TYPE_LENGTH (type);
offset = MEP_GPR_SIZE - type->length ();
else
offset = 0;
/* Return values that do fit in a single register are returned in R0. */
regcache->cooked_read_part (MEP_R0_REGNUM, offset, TYPE_LENGTH (type),
regcache->cooked_read_part (MEP_R0_REGNUM, offset, type->length (),
valbuf);
}
@ -2116,7 +2116,7 @@ mep_store_return_value (struct gdbarch *arch,
int byte_order = gdbarch_byte_order (arch);
/* Values that fit in a single register go in R0. */
if (TYPE_LENGTH (type) <= MEP_GPR_SIZE)
if (type->length () <= MEP_GPR_SIZE)
{
/* Values that don't occupy a full register appear at the least
significant end of the value. This is the offset to where the
@ -2124,11 +2124,11 @@ mep_store_return_value (struct gdbarch *arch,
int offset;
if (byte_order == BFD_ENDIAN_BIG)
offset = MEP_GPR_SIZE - TYPE_LENGTH (type);
offset = MEP_GPR_SIZE - type->length ();
else
offset = 0;
regcache->cooked_write_part (MEP_R0_REGNUM, offset, TYPE_LENGTH (type),
regcache->cooked_write_part (MEP_R0_REGNUM, offset, type->length (),
valbuf);
}
@ -2156,7 +2156,7 @@ mep_return_value (struct gdbarch *gdbarch, struct value *function,
returned in R0. Fetch R0's value and then read the memory
at that address. */
regcache_raw_read_unsigned (regcache, MEP_R0_REGNUM, &addr);
read_memory (addr, readbuf, TYPE_LENGTH (type));
read_memory (addr, readbuf, type->length ());
}
if (writebuf)
{
@ -2228,7 +2228,7 @@ push_large_arguments (CORE_ADDR sp, int argc, struct value **argv,
for (i = 0; i < argc; i++)
{
unsigned arg_len = TYPE_LENGTH (value_type (argv[i]));
unsigned arg_len = value_type (argv[i])->length ();
if (arg_len > MEP_GPR_SIZE)
{
@ -2288,9 +2288,9 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
ULONGEST value;
/* Arguments that fit in a GPR get expanded to fill the GPR. */
if (TYPE_LENGTH (value_type (argv[i])) <= MEP_GPR_SIZE)
if (value_type (argv[i])->length () <= MEP_GPR_SIZE)
value = extract_unsigned_integer (value_contents (argv[i]).data (),
TYPE_LENGTH (value_type (argv[i])),
value_type (argv[i])->length (),
byte_order);
/* Arguments too large to fit in a GPR get copied to the stack,

View File

@ -508,7 +508,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
|| (val_print_scalar_type_p (value_type (arg->val))
&& !value_bytes_available (arg->val,
value_embedded_offset (arg->val),
TYPE_LENGTH (value_type (arg->val))))))
value_type (arg->val)->length ()))))
return;
gdb::optional<ui_out_emit_tuple> tuple_emitter;

View File

@ -516,7 +516,7 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte buf[8];
/* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
switch (TYPE_LENGTH (type))
switch (type->length ())
{
case 1: /* return last byte in the register. */
regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
@ -530,7 +530,7 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
case 8:
regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM + 1, buf+4);
memcpy (valbuf, buf, TYPE_LENGTH (type));
memcpy (valbuf, buf, type->length ());
return;
default:
internal_error (__FILE__, __LINE__,
@ -552,7 +552,7 @@ static void
microblaze_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
gdb_byte buf[8];
memset (buf, 0, sizeof(buf));
@ -588,7 +588,7 @@ microblaze_return_value (struct gdbarch *gdbarch, struct value *function,
static int
microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
{
return (TYPE_LENGTH (type) == 16);
return (type->length () == 16);
}

View File

@ -916,7 +916,7 @@ mips_convert_register_float_case_p (struct gdbarch *gdbarch, int regnum,
return (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
&& register_size (gdbarch, regnum) == 4
&& mips_float_register_p (gdbarch, regnum)
&& type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8);
&& type->code () == TYPE_CODE_FLT && type->length () == 8);
}
/* This predicate tests for the case of a value of less than 8
@ -930,7 +930,7 @@ mips_convert_register_gpreg_case_p (struct gdbarch *gdbarch, int regnum,
return (register_size (gdbarch, regnum) == 8
&& regnum % num_regs > 0 && regnum % num_regs < 32
&& TYPE_LENGTH (type) < 8);
&& type->length () < 8);
}
static int
@ -965,7 +965,7 @@ mips_register_to_value (struct frame_info *frame, int regnum,
}
else if (mips_convert_register_gpreg_case_p (gdbarch, regnum, type))
{
size_t len = TYPE_LENGTH (type);
size_t len = type->length ();
CORE_ADDR offset;
offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 - len : 0;
@ -997,7 +997,7 @@ mips_value_to_register (struct frame_info *frame, int regnum,
else if (mips_convert_register_gpreg_case_p (gdbarch, regnum, type))
{
gdb_byte fill[8];
size_t len = TYPE_LENGTH (type);
size_t len = type->length ();
/* Sign extend values, irrespective of type, that are stored to
a 64-bit general purpose register. (32-bit unsigned values
@ -1103,7 +1103,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
/* Absent registers are still absent. */
rawtype = gdbarch_register_type (gdbarch, rawnum);
if (TYPE_LENGTH (rawtype) == 0)
if (rawtype->length () == 0)
return rawtype;
/* Present the floating point registers however the hardware did;
@ -1121,7 +1121,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
/* Use pointer types for registers if we can. For n32 we can not,
since we do not have a 64-bit pointer type. */
if (mips_abi_regsize (gdbarch)
== TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr))
== builtin_type (gdbarch)->builtin_data_ptr->length())
{
if (rawnum == MIPS_SP_REGNUM
|| rawnum == mips_regnum (gdbarch)->badvaddr)
@ -1130,7 +1130,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type (gdbarch)->builtin_func_ptr;
}
if (mips_abi_regsize (gdbarch) == 4 && TYPE_LENGTH (rawtype) == 8
if (mips_abi_regsize (gdbarch) == 4 && rawtype->length () == 8
&& ((rawnum >= MIPS_ZERO_REGNUM && rawnum <= MIPS_PS_REGNUM)
|| rawnum == mips_regnum (gdbarch)->lo
|| rawnum == mips_regnum (gdbarch)->hi
@ -4453,7 +4453,7 @@ mips_type_needs_double_align (struct type *type)
{
enum type_code typecode = type->code ();
if (typecode == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)
if (typecode == TYPE_CODE_FLT && type->length () == 8)
return 1;
else if (typecode == TYPE_CODE_STRUCT)
{
@ -4558,7 +4558,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
than necessary for EABI, because the first few arguments are
passed in registers, but that's OK. */
for (argnum = 0; argnum < nargs; argnum++)
arg_space += align_up (TYPE_LENGTH (value_type (args[argnum])), abi_regsize);
arg_space += align_up (value_type (args[argnum])->length (),
abi_regsize);
sp -= align_up (arg_space, 16);
if (mips_debug)
@ -4593,7 +4594,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte ref_valbuf[MAX_MIPS_ABI_REGSIZE];
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
if (mips_debug)
@ -4727,7 +4728,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
longword_offset = abi_regsize - len;
else if ((typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION)
&& TYPE_LENGTH (arg_type) < abi_regsize)
&& arg_type->length () < abi_regsize)
longword_offset = abi_regsize - len;
}
@ -4808,7 +4809,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
int fp_return_type = 0;
int offset, regnum, xfer;
if (TYPE_LENGTH (type) > 2 * mips_abi_regsize (gdbarch))
if (type->length () > 2 * mips_abi_regsize (gdbarch))
return RETURN_VALUE_STRUCT_CONVENTION;
/* Floating point type? */
@ -4845,12 +4846,12 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
regnum = MIPS_V0_REGNUM;
}
for (offset = 0;
offset < TYPE_LENGTH (type);
offset < type->length ();
offset += mips_abi_regsize (gdbarch), regnum++)
{
xfer = mips_abi_regsize (gdbarch);
if (offset + xfer > TYPE_LENGTH (type))
xfer = TYPE_LENGTH (type) - offset;
if (offset + xfer > type->length ())
xfer = type->length () - offset;
mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + regnum, xfer,
gdbarch_byte_order (gdbarch), readbuf, writebuf,
@ -4879,7 +4880,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
if (mips_get_fpu_type (gdbarch) != MIPS_FPU_DOUBLE)
return 0;
if (TYPE_LENGTH (arg_type) < offset + MIPS64_REGSIZE)
if (arg_type->length () < offset + MIPS64_REGSIZE)
return 0;
for (i = 0; i < arg_type->num_fields (); i++)
@ -4901,12 +4902,12 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
/* If this field is entirely before the requested offset, go
on to the next one. */
if (pos + TYPE_LENGTH (field_type) <= offset)
if (pos + field_type->length () <= offset)
continue;
/* If this is our special aligned double, we can stop. */
if (field_type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (field_type) == MIPS64_REGSIZE)
&& field_type->length () == MIPS64_REGSIZE)
return 1;
/* This field starts at or before the requested offset, and
@ -4951,7 +4952,8 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
arg_space += align_up (TYPE_LENGTH (value_type (args[argnum])), MIPS64_REGSIZE);
arg_space += align_up (value_type (args[argnum])->length (),
MIPS64_REGSIZE);
sp -= align_up (arg_space, 16);
if (mips_debug)
@ -4983,7 +4985,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
const gdb_byte *val;
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
if (mips_debug)
@ -5153,7 +5155,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_unsigned (regcache, argreg, regval);
if (mips_n32n64_fp_arg_chunk_p (gdbarch, arg_type,
TYPE_LENGTH (arg_type) - len))
arg_type->length () - len))
{
if (mips_debug)
gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
@ -5230,10 +5232,10 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
($f0) and complex type function ($f0 has the
real part, $f2 has the imaginary part.) */
if (TYPE_LENGTH (type) > 2 * MIPS64_REGSIZE)
if (type->length () > 2 * MIPS64_REGSIZE)
return RETURN_VALUE_STRUCT_CONVENTION;
else if ((type->code () == TYPE_CODE_COMPLEX
|| (type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 16))
|| (type->code () == TYPE_CODE_FLT && type->length () == 16))
&& tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A complex value of up to 128 bits in width as well as a 128-bit
@ -5246,15 +5248,15 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0),
TYPE_LENGTH (type) / 2, gdbarch_byte_order (gdbarch),
type->length () / 2, gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0 + 2),
TYPE_LENGTH (type) / 2, gdbarch_byte_order (gdbarch),
readbuf ? readbuf + TYPE_LENGTH (type) / 2 : readbuf,
type->length () / 2, gdbarch_byte_order (gdbarch),
readbuf ? readbuf + type->length () / 2 : readbuf,
(writebuf
? writebuf + TYPE_LENGTH (type) / 2 : writebuf), 0);
? writebuf + type->length () / 2 : writebuf), 0);
return RETURN_VALUE_REGISTER_CONVENTION;
}
else if (type->code () == TYPE_CODE_FLT
@ -5266,7 +5268,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0),
TYPE_LENGTH (type),
type->length (),
gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
return RETURN_VALUE_REGISTER_CONVENTION;
@ -5297,7 +5299,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
if (mips_debug)
gdb_printf (gdb_stderr, "Return float struct+%d\n",
offset);
if (TYPE_LENGTH (type->field (field).type ()) == 16)
if (type->field (field).type ()->length () == 16)
{
/* A 16-byte long double field goes in two consecutive
registers. */
@ -5315,7 +5317,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
else
mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + regnum,
TYPE_LENGTH (type->field (field).type ()),
type->field (field).type ()->length (),
gdbarch_byte_order (gdbarch),
readbuf, writebuf, offset);
}
@ -5331,12 +5333,12 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
offset < TYPE_LENGTH (type);
offset < type->length ();
offset += register_size (gdbarch, regnum), regnum++)
{
int xfer = register_size (gdbarch, regnum);
if (offset + xfer > TYPE_LENGTH (type))
xfer = TYPE_LENGTH (type) - offset;
if (offset + xfer > type->length ())
xfer = type->length () - offset;
if (mips_debug)
gdb_printf (gdb_stderr, "Return struct+%d:%d in $%d\n",
offset, xfer, regnum);
@ -5354,12 +5356,12 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
offset < TYPE_LENGTH (type);
offset < type->length ();
offset += register_size (gdbarch, regnum), regnum++)
{
int xfer = register_size (gdbarch, regnum);
if (offset + xfer > TYPE_LENGTH (type))
xfer = TYPE_LENGTH (type) - offset;
if (offset + xfer > type->length ())
xfer = type->length () - offset;
if (mips_debug)
gdb_printf (gdb_stderr, "Return scalar+%d:%d in $%d\n",
offset, xfer, regnum);
@ -5429,7 +5431,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (mips_type_needs_double_align (arg_type))
arg_space = align_up (arg_space, MIPS32_REGSIZE * 2);
/* Allocate space on the stack. */
arg_space += align_up (TYPE_LENGTH (arg_type), MIPS32_REGSIZE);
arg_space += align_up (arg_type->length (), MIPS32_REGSIZE);
}
sp -= align_up (arg_space, 16);
@ -5463,7 +5465,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
const gdb_byte *val;
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
if (mips_debug)
@ -5713,7 +5715,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
|| type->code () == TYPE_CODE_ARRAY)
return RETURN_VALUE_STRUCT_CONVENTION;
else if (type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 4 && tdep->mips_fpu_type != MIPS_FPU_NONE)
&& type->length () == 4 && tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A single-precision floating-point value. If reading in or copying,
then we get it from/put it to FP0 for standard MIPS code or GPR2
@ -5738,19 +5740,19 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0),
TYPE_LENGTH (type),
type->length (),
gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
if (fval_reg != mips_fval_fpr)
mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + 2,
TYPE_LENGTH (type),
type->length (),
gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
return RETURN_VALUE_REGISTER_CONVENTION;
}
else if (type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 8 && tdep->mips_fpu_type != MIPS_FPU_NONE)
&& type->length () == 8 && tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A double-precision floating-point value. If reading in or copying,
then we get it from/put it to FP1 and FP0 for standard MIPS code or
@ -5867,12 +5869,12 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
offset < TYPE_LENGTH (type);
offset < type->length ();
offset += register_size (gdbarch, regnum), regnum++)
{
int xfer = register_size (gdbarch, regnum);
if (offset + xfer > TYPE_LENGTH (type))
xfer = TYPE_LENGTH (type) - offset;
if (offset + xfer > type->length ())
xfer = type->length () - offset;
if (mips_debug)
gdb_printf (gdb_stderr, "Return struct+%d:%d in $%d\n",
offset, xfer, regnum);
@ -5891,12 +5893,12 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
offset < TYPE_LENGTH (type);
offset < type->length ();
offset += MIPS32_REGSIZE, regnum++)
{
int xfer = MIPS32_REGSIZE;
if (offset + xfer > TYPE_LENGTH (type))
xfer = TYPE_LENGTH (type) - offset;
if (offset + xfer > type->length ())
xfer = type->length () - offset;
if (mips_debug)
gdb_printf (gdb_stderr, "Return scalar+%d:%d in $%d\n",
offset, xfer, regnum);
@ -5950,7 +5952,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *arg_type = check_typedef (value_type (args[argnum]));
/* Allocate space on the stack. */
arg_space += align_up (TYPE_LENGTH (arg_type), MIPS64_REGSIZE);
arg_space += align_up (arg_type->length (), MIPS64_REGSIZE);
}
sp -= align_up (arg_space, 16);
@ -5984,7 +5986,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
const gdb_byte *val;
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
if (mips_debug)
@ -6182,13 +6184,13 @@ mips_o64_return_value (struct gdbarch *gdbarch, struct value *function,
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0),
TYPE_LENGTH (type),
type->length (),
gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
if (fval_reg != mips_fval_fpr)
mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + 2,
TYPE_LENGTH (type),
type->length (),
gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
return RETURN_VALUE_REGISTER_CONVENTION;
@ -6200,12 +6202,12 @@ mips_o64_return_value (struct gdbarch *gdbarch, struct value *function,
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
offset < TYPE_LENGTH (type);
offset < type->length ();
offset += MIPS64_REGSIZE, regnum++)
{
int xfer = MIPS64_REGSIZE;
if (offset + xfer > TYPE_LENGTH (type))
xfer = TYPE_LENGTH (type) - offset;
if (offset + xfer > type->length ())
xfer = type->length () - offset;
if (mips_debug)
gdb_printf (gdb_stderr, "Return scalar+%d:%d in $%d\n",
offset, xfer, regnum);
@ -7968,7 +7970,7 @@ mips_integer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
return extract_signed_integer (buf, TYPE_LENGTH (type), byte_order);
return extract_signed_integer (buf, type->length (), byte_order);
}
/* Dummy virtual frame pointer method. This is no more or less accurate

View File

@ -100,10 +100,10 @@ mn10300_type_align (struct type *type)
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
return TYPE_LENGTH (type);
return type->length ();
case TYPE_CODE_COMPLEX:
return TYPE_LENGTH (type) / 2;
return type->length () / 2;
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
@ -134,7 +134,7 @@ mn10300_use_struct_convention (struct type *type)
{
/* Structures bigger than a pair of words can't be returned in
registers. */
if (TYPE_LENGTH (type) > 8)
if (type->length () > 8)
return 1;
switch (type->code ())
@ -171,7 +171,7 @@ static void
mn10300_store_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, const gdb_byte *valbuf)
{
int len = TYPE_LENGTH (type);
int len = type->length ();
int reg, regsz;
if (type->code () == TYPE_CODE_PTR)
@ -199,7 +199,7 @@ mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, void *valbuf)
{
gdb_byte buf[MN10300_MAX_REGISTER_SIZE];
int len = TYPE_LENGTH (type);
int len = type->length ();
int reg, regsz;
if (type->code () == TYPE_CODE_PTR)
@ -1185,7 +1185,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
regs_used = (return_method == return_method_struct) ? 1 : 0;
for (len = 0, argnum = 0; argnum < nargs; argnum++)
{
arg_len = (TYPE_LENGTH (value_type (args[argnum])) + 3) & ~3;
arg_len = (value_type (args[argnum])->length () + 3) & ~3;
while (regs_used < 2 && arg_len > 0)
{
regs_used++;
@ -1210,7 +1210,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
{
/* FIXME what about structs? Unions? */
if (value_type (*args)->code () == TYPE_CODE_STRUCT
&& TYPE_LENGTH (value_type (*args)) > 8)
&& value_type (*args)->length () > 8)
{
/* Change to pointer-to-type. */
arg_len = push_size;
@ -1221,7 +1221,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
}
else
{
arg_len = TYPE_LENGTH (value_type (*args));
arg_len = value_type (*args)->length ();
val = value_contents (*args).data ();
}

View File

@ -111,7 +111,7 @@ moxie_store_return_value (struct type *type, struct regcache *regcache,
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR regval;
int len = TYPE_LENGTH (type);
int len = type->length ();
/* Things always get returned in RET1_REGNUM, RET2_REGNUM. */
regval = extract_unsigned_integer (valbuf, len > 4 ? 4 : len, byte_order);
@ -457,7 +457,7 @@ moxie_extract_return_value (struct type *type, struct regcache *regcache,
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type);
int len = type->length ();
ULONGEST tmp;
/* By using store_unsigned_integer we avoid having to do
@ -481,7 +481,7 @@ moxie_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (TYPE_LENGTH (valtype) > 8)
if (valtype->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
else
{

View File

@ -569,11 +569,11 @@ msp430_return_value (struct gdbarch *gdbarch,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
LONGEST valtype_len = TYPE_LENGTH (valtype);
LONGEST valtype_len = valtype->length ();
msp430_gdbarch_tdep *tdep = gdbarch_tdep<msp430_gdbarch_tdep> (gdbarch);
int code_model = tdep->code_model;
if (TYPE_LENGTH (valtype) > 8
if (valtype->length () > 8
|| valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION)
return RETURN_VALUE_STRUCT_CONVENTION;
@ -689,7 +689,7 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value *arg = args[i];
const gdb_byte *arg_bits = value_contents_all (arg).data ();
struct type *arg_type = check_typedef (value_type (arg));
ULONGEST arg_size = TYPE_LENGTH (arg_type);
ULONGEST arg_size = arg_type->length ();
int offset;
int current_arg_on_stack;
gdb_byte struct_addr_buf[4];

View File

@ -1453,7 +1453,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (align == 0)
continue;
sp -= TYPE_LENGTH (type);
sp -= type->length ();
sp = align_down (sp, align);
}
@ -1471,7 +1471,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
type = value_type (args[i]);
calling_use_fpr = nds32_check_calling_use_fpr (type);
len = TYPE_LENGTH (type);
len = type->length ();
align = type_align (type);
val = value_contents (args[i]).data ();
@ -1658,7 +1658,7 @@ nds32_extract_return_value (struct gdbarch *gdbarch, struct type *type,
int len;
calling_use_fpr = nds32_check_calling_use_fpr (type);
len = TYPE_LENGTH (type);
len = type->length ();
if (abi_use_fpr && calling_use_fpr)
{
@ -1748,7 +1748,7 @@ nds32_store_return_value (struct gdbarch *gdbarch, struct type *type,
int len;
calling_use_fpr = nds32_check_calling_use_fpr (type);
len = TYPE_LENGTH (type);
len = type->length ();
if (abi_use_fpr && calling_use_fpr)
{
@ -1809,7 +1809,7 @@ nds32_return_value (struct gdbarch *gdbarch, struct value *func_type,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (TYPE_LENGTH (type) > 8)
if (type->length () > 8)
{
return RETURN_VALUE_STRUCT_CONVENTION;
}

View File

@ -410,27 +410,27 @@ nbsd_get_siginfo_type (struct gdbarch *gdbarch)
type *uint32_type = builtin_type (gdbarch)->builtin_uint32;
type *uint64_type = builtin_type (gdbarch)->builtin_uint64;
bool lp64 = TYPE_LENGTH (void_ptr_type) == 8;
bool lp64 = void_ptr_type->length () == 8;
size_t char_bits = gdbarch_addressable_memory_unit_size (gdbarch) * 8;
/* pid_t */
type *pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (int32_type) * char_bits, "pid_t");
int32_type->length () * char_bits, "pid_t");
pid_type->set_target_type (int32_type);
/* uid_t */
type *uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (uint32_type) * char_bits, "uid_t");
uint32_type->length () * char_bits, "uid_t");
uid_type->set_target_type (uint32_type);
/* clock_t */
type *clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (int_type) * char_bits, "clock_t");
int_type->length () * char_bits, "clock_t");
clock_type->set_target_type (int_type);
/* lwpid_t */
type *lwpid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (int32_type) * char_bits,
int32_type->length () * char_bits,
"lwpid_t");
lwpid_type->set_target_type (int32_type);

View File

@ -205,7 +205,7 @@ static void
nios2_extract_return_value (struct gdbarch *gdbarch, struct type *valtype,
struct regcache *regcache, gdb_byte *valbuf)
{
int len = TYPE_LENGTH (valtype);
int len = valtype->length ();
/* Return values of up to 8 bytes are returned in $r2 $r3. */
if (len <= register_size (gdbarch, NIOS2_R2_REGNUM))
@ -226,7 +226,7 @@ static void
nios2_store_return_value (struct gdbarch *gdbarch, struct type *valtype,
struct regcache *regcache, const gdb_byte *valbuf)
{
int len = TYPE_LENGTH (valtype);
int len = valtype->length ();
/* Return values of up to 8 bytes are returned in $r2 $r3. */
if (len <= register_size (gdbarch, NIOS2_R2_REGNUM))
@ -1786,7 +1786,7 @@ nios2_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (TYPE_LENGTH (type) > 8)
if (type->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)
@ -1818,7 +1818,7 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
arg_space += align_up (TYPE_LENGTH (value_type (args[argnum])), 4);
arg_space += align_up (value_type (args[argnum])->length (), 4);
sp -= arg_space;
/* Initialize the register pointer. */
@ -1837,7 +1837,7 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
const gdb_byte *val;
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
int len = arg_type->length ();
val = value_contents (arg).data ();
@ -2255,7 +2255,7 @@ nios2_type_align (struct gdbarch *gdbarch, struct type *type)
case TYPE_CODE_METHODPTR:
case TYPE_CODE_MEMBERPTR:
type = check_typedef (type);
return std::min<ULONGEST> (4, TYPE_LENGTH (type));
return std::min<ULONGEST> (4, type->length ());
default:
return 0;
}

View File

@ -1354,7 +1354,7 @@ objfile_int_type (struct objfile *of, int size_in_bytes, bool unsigned_p)
int_type = (unsigned_p \
? objfile_type (of)->builtin_unsigned_ ## F \
: objfile_type (of)->builtin_ ## F); \
if (int_type != NULL && TYPE_LENGTH (int_type) == size_in_bytes) \
if (int_type != NULL && int_type->length () == size_in_bytes) \
return int_type
TRY_TYPE (char);

View File

@ -55,8 +55,8 @@ lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code,
&& get_array_bounds (type, &lowb, &highb)
&& type->target_type ()->code () == code
&& type->target_type ()->is_unsigned () == flag_unsigned
&& TYPE_LENGTH (type->target_type ()) == el_length
&& TYPE_LENGTH (type) == length
&& type->target_type ()->length () == el_length
&& type->length () == length
&& highb - lowb + 1 == n);
};
const struct language_defn *lang = language_def (language_opencl);
@ -123,7 +123,7 @@ lval_func_read (struct value *v)
struct type *type = check_typedef (value_type (v));
struct type *eltype = check_typedef (value_type (c->val))->target_type ();
LONGEST offset = value_offset (v);
LONGEST elsize = TYPE_LENGTH (eltype);
LONGEST elsize = eltype->length ();
int n, i, j = 0;
LONGEST lowb = 0;
LONGEST highb = 0;
@ -152,7 +152,7 @@ lval_func_write (struct value *v, struct value *fromval)
struct type *type = check_typedef (value_type (v));
struct type *eltype = check_typedef (value_type (c->val))->target_type ();
LONGEST offset = value_offset (v);
LONGEST elsize = TYPE_LENGTH (eltype);
LONGEST elsize = eltype->length ();
int n, i, j = 0;
LONGEST lowb = 0;
LONGEST highb = 0;
@ -198,7 +198,7 @@ lval_func_check_synthetic_pointer (const struct value *v,
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
/* Size of the target type in bits. */
int elsize =
TYPE_LENGTH (check_typedef (value_type (c->val))->target_type ()) * 8;
check_typedef (value_type (c->val))->target_type ()->length () * 8;
int startrest = offset % elsize;
int start = offset / elsize;
int endrest = (offset + length) % elsize;
@ -289,7 +289,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
resulting type is a vector as well. */
struct type *dst_type =
lookup_opencl_vector_type (gdbarch, elm_type->code (),
TYPE_LENGTH (elm_type),
elm_type->length (),
elm_type->is_unsigned (), n);
if (dst_type == NULL)
@ -316,10 +316,10 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
/* Copy src val contents into the destination value. */
for (i = 0; i < n; i++)
memcpy (value_contents_writeable (ret).data ()
+ (i * TYPE_LENGTH (elm_type)),
+ (i * elm_type->length ()),
value_contents (val).data ()
+ (indices[i] * TYPE_LENGTH (elm_type)),
TYPE_LENGTH (elm_type));
+ (indices[i] * elm_type->length ()),
elm_type->length ());
}
}
}
@ -463,7 +463,7 @@ opencl_logical_not (struct type *expect_type, struct expression *exp,
/* Determine the resulting type of the operation and allocate the
value. */
rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
TYPE_LENGTH (eltype), 0,
eltype->length (), 0,
highb - lowb + 1);
ret = allocate_value (rettype);
@ -474,8 +474,8 @@ opencl_logical_not (struct type *expect_type, struct expression *exp,
set) if the value of its operand compares equal to 0. */
int tmp = value_logical_not (value_subscript (arg, i)) ? -1 : 0;
memset ((value_contents_writeable (ret).data ()
+ i * TYPE_LENGTH (eltype)),
tmp, TYPE_LENGTH (eltype));
+ i * eltype->length ()),
tmp, eltype->length ());
}
}
else
@ -556,14 +556,14 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2,
/* Check whether the vector types are compatible. */
if (eltype1->code () != eltype2->code ()
|| TYPE_LENGTH (eltype1) != TYPE_LENGTH (eltype2)
|| eltype1->length () != eltype2->length ()
|| eltype1->is_unsigned () != eltype2->is_unsigned ()
|| lowb1 != lowb2 || highb1 != highb2)
error (_("Cannot perform operation on vectors with different types"));
/* Determine the resulting type of the operation and allocate the value. */
rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
TYPE_LENGTH (eltype1), 0,
eltype1->length (), 0,
highb1 - lowb1 + 1);
ret = allocate_value (rettype);
@ -575,8 +575,8 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2,
int tmp = scalar_relop (value_subscript (val1, i),
value_subscript (val2, i), op) ? -1 : 0;
memset ((value_contents_writeable (ret).data ()
+ i * TYPE_LENGTH (eltype1)),
tmp, TYPE_LENGTH (eltype1));
+ i * eltype1->length ()),
tmp, eltype1->length ());
}
return ret;
@ -820,7 +820,7 @@ Cannot perform conditional operation on incompatible types"));
/* Throw an error if the types of arg2 or arg3 are incompatible. */
if (eltype2->code () != eltype3->code ()
|| TYPE_LENGTH (eltype2) != TYPE_LENGTH (eltype3)
|| eltype2->length () != eltype3->length ()
|| eltype2->is_unsigned () != eltype3->is_unsigned ()
|| lowb2 != lowb3 || highb2 != highb3)
error (_("\
@ -839,8 +839,8 @@ Cannot perform conditional operation on vectors with different sizes"));
tmp = value_logical_not (value_subscript (arg1, i)) ?
value_subscript (arg3, i) : value_subscript (arg2, i);
memcpy (value_contents_writeable (ret).data () +
i * TYPE_LENGTH (eltype2), value_contents_all (tmp).data (),
TYPE_LENGTH (eltype2));
i * eltype2->length (), value_contents_all (tmp).data (),
eltype2->length ());
}
return ret;
@ -899,7 +899,7 @@ public:
tmp->set_name (OCL_STRING(TYPE ## 2)); \
tmp = add (init_vector_type (ELEMENT_TYPE, 3)); \
tmp->set_name (OCL_STRING(TYPE ## 3)); \
tmp->set_length (4 * TYPE_LENGTH (ELEMENT_TYPE)); \
tmp->set_length (4 * (ELEMENT_TYPE)->length ()); \
tmp = add (init_vector_type (ELEMENT_TYPE, 4)); \
tmp->set_name (OCL_STRING(TYPE ## 4)); \
tmp = add (init_vector_type (ELEMENT_TYPE, 8)); \

View File

@ -247,7 +247,7 @@ or1k_return_value (struct gdbarch *gdbarch, struct value *functype,
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code rv_type = valtype->code ();
unsigned int rv_size = TYPE_LENGTH (valtype);
unsigned int rv_size = valtype->length ();
or1k_gdbarch_tdep *tdep = gdbarch_tdep<or1k_gdbarch_tdep> (gdbarch);
int bpw = tdep->bytes_per_word;
@ -663,7 +663,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
if (func_type->has_varargs () && argnum >= func_type->num_fields ())
@ -753,7 +753,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
if ((TYPE_CODE_STRUCT == typecode) || (TYPE_CODE_UNION == typecode)
@ -785,7 +785,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
int len = arg_type->length ();
enum type_code typecode = arg_type->code ();
/* The EABI passes structures that do not fit in a register by
reference. In all other cases, pass the structure by value. */

View File

@ -553,7 +553,7 @@ exp : SIZEOF '(' type ')' %prec UNARY
$3 = check_typedef ($3);
pstate->push_new<long_const_operation>
(parse_type (pstate)->builtin_int,
TYPE_LENGTH ($3)); }
$3->length ()); }
;
exp : SIZEOF '(' exp ')' %prec UNARY

View File

@ -104,7 +104,7 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
if (length_pos)
*length_pos = type->field (0).loc_bitpos () / TARGET_CHAR_BIT;
if (length_size)
*length_size = TYPE_LENGTH (type->field (0).type ());
*length_size = type->field (0).type ()->length ();
if (string_pos)
*string_pos = type->field (1).loc_bitpos () / TARGET_CHAR_BIT;
if (char_type)
@ -124,7 +124,7 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
if (length_pos)
*length_pos = type->field (1).loc_bitpos () / TARGET_CHAR_BIT;
if (length_size)
*length_size = TYPE_LENGTH (type->field (1).type ());
*length_size = type->field (1).type ()->length ();
if (string_pos)
*string_pos = type->field (2).loc_bitpos () / TARGET_CHAR_BIT;
/* FIXME: how can I detect wide chars in GPC ?? */
@ -237,7 +237,7 @@ pascal_language::printstr (struct ui_file *stream, struct type *elttype,
/* Preserve ELTTYPE's original type, just set its LENGTH. */
check_typedef (elttype);
width = TYPE_LENGTH (elttype);
width = elttype->length ();
/* If the string was not truncated due to `set print elements', and
the last byte of it is a null, we don't print that, in traditional C

Some files were not shown because too many files have changed in this diff Show More