Remove the macro, replace all uses with calls to type::length.
Change-Id: Ib9bdc954576860b21190886534c99103d6a47afb
{
/* 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. */
{
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;
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;
{
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;
if (count == -1)
return count;
- count *= (TYPE_LENGTH (type) / TYPE_LENGTH (target_type));
+ count *= (type->length () / target_type->length ());
return count;
}
}
/* 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;
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 ();
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;
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 */
{
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;
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. */
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. */
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++)
{
/* 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;
/* 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];
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
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++)
{
|| 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. */
/* 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)
/* 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];
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;
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);
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));
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. */
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. */
return
value_from_longest (lookup_pointer_type (bounds_type),
- addr - TYPE_LENGTH (bounds_type));
+ addr - bounds_type->length ());
}
else if (is_thick_pntr (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
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
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
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);
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,
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.
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;
}
}
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,
}
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;
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;
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;
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);
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 ()
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);
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:
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));
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;
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))
/* 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);
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
{
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)
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;
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;
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 (),
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;
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);
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);
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"));
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));
}
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);
}
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;
}
/* 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);
}
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. */
const std::string &str = std::get<0> (m_storage);
const char *encoding;
- switch (TYPE_LENGTH (char_type))
+ switch (char_type->length ())
{
case 1:
{
default:
error (_("unexpected character type size %s"),
- pulongest (TYPE_LENGTH (char_type)));
+ pulongest (char_type->length ()));
}
auto_obstack converted;
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),
/* 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;
}
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. */
/* 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"));
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);
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;
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
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 ");
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)
(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;
}
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);
}
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);
}
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. */
{
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;
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)
{
"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 ())
{
struct type *type)
{
return (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31
- && TYPE_LENGTH (type) == 4);
+ && type->length () == 4);
}
static int
/* 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);
{
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);
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);
/* "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;
/* 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;
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 ();
switch (valtype->code ())
{
case TYPE_CODE_FLT:
- switch (TYPE_LENGTH (valtype))
+ switch (valtype->length ())
{
case 4:
regcache->cooked_read (ALPHA_FP0_REGNUM, raw_buffer);
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. */
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;
}
}
switch (valtype->code ())
{
case TYPE_CODE_FLT:
- switch (TYPE_LENGTH (valtype))
+ switch (valtype->length ())
{
case 4:
alpha_lds (gdbarch, raw_buffer, valbuf);
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. */
/* 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);
{
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;
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
{
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))
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,
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;
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.*/
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))
{
/* 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
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;
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;
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;
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;
{
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);
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. */
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;
{
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
{
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
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);
}
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))
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;
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
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;
}
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;
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);
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");
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");
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),
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;
}
{
/* 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. */
switch (t->code ())
{
case TYPE_CODE_FLT:
- switch (TYPE_LENGTH (t))
+ switch (t->length ())
{
case 4:
if (*base_type == VFP_CPRC_UNKNOWN)
};
*/
- switch (TYPE_LENGTH (t))
+ switch (t->length ())
{
case 8:
if (*base_type == VFP_CPRC_UNKNOWN)
{
/* 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)
base_type);
if (count == -1)
return -1;
- if (TYPE_LENGTH (t) == 0)
+ if (t->length () == 0)
{
gdb_assert (count == 0);
return 0;
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;
return -1;
count += sub_count;
}
- if (TYPE_LENGTH (t) == 0)
+ if (t->length () == 0)
{
gdb_assert (count == 0);
return 0;
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;
}
return -1;
count = (count > sub_count ? count : sub_count);
}
- if (TYPE_LENGTH (t) == 0)
+ if (t->length () == 0)
{
gdb_assert (count == 0);
return 0;
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;
}
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 ();
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;
/* 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;
/* 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];
{
/* 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);
{
/* 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;
/* 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;
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;
|| 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. */
/* 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)
/* 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];
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;
}
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;
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;
{
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);
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);
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? */
{
/* 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));
}
}
{
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))
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);
}
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)
{
/* 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;
"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);
}
}
{
/* 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);
}
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));
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)
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);
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 ()));
}
/* 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);
/* 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);
{
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);
}
}
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."));
/* 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;
}
{
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
{
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);
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;
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);
gdb_byte *readbuf,
const gdb_byte *writebuf)
{
- if (TYPE_LENGTH (type) > 8)
+ if (type->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)
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);
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);
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;
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;
}
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)
type = check_typedef (type->target_type ());
pstate->push_new<long_const_operation>
- (int_type, TYPE_LENGTH (type));
+ (int_type, type->length ());
}
;
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
{
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
{
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));
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))
{
/* 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:
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 (),
/* 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
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;
}
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;
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;
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 (),
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. */
/* 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;
dump_bfd_file (filename.get (), mode, file_format, vaddr,
value_contents (val).data (),
- TYPE_LENGTH (value_type (val)));
+ value_type (val)->length ());
}
}
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);
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)
{
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)
{
" __attribute__((__aligned__("
"__BIGGEST_ALIGNMENT__)))",
regname.c_str (),
- pulongest (TYPE_LENGTH (regtype)));
+ pulongest (regtype->length ()));
}
gdb_puts (";\n", stream);
}
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,
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;
}
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)
{
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. */
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. */
| 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,
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 ();
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
{
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. */
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. */
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;
{
/* 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);
}
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));
}
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);
}
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 (),
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)
{
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.
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;
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? */
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)
{
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)
{
{
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;
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.
{
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
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);
&& 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;
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 ());
== 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++)
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)
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);
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);
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
<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;
}
}
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 ();
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 ();
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;
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;
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
/* 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);
}
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);
{
/* 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
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);
/* 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;
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);
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)
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
/* 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 ();
{
v = allocate_value (type);
memcpy (value_contents_writeable (v).data (), bytes,
- TYPE_LENGTH (type));
+ type->length ());
}
else
v = value_from_longest (type, value);
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
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. */
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)
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;
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
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;
}
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 "
/* 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)
== 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);
}
/* 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 ();
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;
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);
{
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. */
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;
{
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);
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;
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);
{
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;
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;
/* 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;
/* 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)
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
}
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
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;
{
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);
}
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;
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++)
{
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;
}
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
/* 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 *
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 ());
}
}
}
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 *
$3 = check_typedef ($3);
pstate->push_new<long_const_operation>
(parse_f_type (pstate)->builtin_integer,
- TYPE_LENGTH ($3));
+ $3->length ());
}
;
{
const char *encoding;
- switch (TYPE_LENGTH (type))
+ switch (type->length ())
{
case 1:
encoding = target_charset (type->arch ());
/* 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)
/* 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. */
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. */
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
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.
/* 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. */
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. */
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. */
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)
{
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));
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"));
}
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)
{
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));
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,
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);
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
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));
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);
{
const char *type_encoding = get_encoding (elttype);
- if (TYPE_LENGTH (elttype) == 4)
+ if (elttype->length () == 4)
gdb_puts ("4_", stream);
if (!encoding || !*encoding)
/* 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. */
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++;
}
else
return value_contents_eq (val, offset1, val, offset2,
- TYPE_LENGTH (type));
+ type->length ());
}
/* The number of elements printed so far. */
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:
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;
/* 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)
/* __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);
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"));
{
const gdb_byte *contents = value_contents (v).data ();
pattern_buf.insert (pattern_buf.end (), contents,
- contents + TYPE_LENGTH (t));
+ contents + t->length ());
}
if (*s == ',')
{
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
{
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
{
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
{
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);
}
\f
/* See value.h. */
}
/* 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;
}
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;
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;
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
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,
{
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
{
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)
{
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)
{
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)
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)
{
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);
{
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;
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
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
{
{
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)
{
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);
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]);
}
}
{
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,
chain = TYPE_CHAIN (ntype);
while (chain != ntype)
{
- chain->set_length (TYPE_LENGTH (ntype));
+ chain->set_length (ntype->length ());
chain = TYPE_CHAIN (chain);
}
chain = TYPE_CHAIN (ntype);
while (chain != ntype)
{
- chain->set_length (TYPE_LENGTH (ntype));
+ chain->set_length (ntype->length ());
chain = TYPE_CHAIN (chain);
}
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;
}
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);
/* 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);
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));
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:
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;
}
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;
}
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,
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)
}
/* 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;
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;
}
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;
}
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;
}
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);
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);
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
}
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
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;
}
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);
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 ()
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. */
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;
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:
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;
}
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 ()));
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 ())
{
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)
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);
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)
{
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;
#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. */
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;
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))
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. */
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;
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);
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);
}
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))
{
/* 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);
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. */
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
{
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);
}
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));
= 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 ());
}
;
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;
}
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);
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);
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,
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)
/* Ignore exceptions. */
- return scm_from_long (TYPE_LENGTH (type));
+ return scm_from_long (type->length ());
}
/* (type-strip-typedefs <gdb:type>) -> <gdb:type>
try
{
type = check_typedef (type);
- length = TYPE_LENGTH (type);
+ length = type->length ();
contents = value_contents (value).data ();
}
catch (const gdb_exception &except)
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),
/* 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
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. */
{
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)
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)
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
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));
}
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);
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,
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;
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);
}
{
/* 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 ()));
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
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;
}
{
case TYPE_CODE_FLT:
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
return (len == 4 || len == 8 || len == 16);
}
default:
{
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;
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;
}
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. */
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);
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)
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. */
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.
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:
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);
}
}
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 ());
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)
{
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. */
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)
{
{
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
|| 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:
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;
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));
}
{
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);
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);
}
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
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. */
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
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,
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))
{
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;
{
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;
}
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);
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]);
}
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. */
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,
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)
{
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++;
}
}
{
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)
{
{
case TYPE_CODE_FLT:
if (*etp)
- return TYPE_LENGTH (*etp) == TYPE_LENGTH (t);
+ return (*etp)->length () == t->length ();
else
{
*etp = t;
{
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
- if (TYPE_LENGTH (t) > 8)
+ if (t->length () > 8)
return 1;
else
return 0;
{
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++;
arg = args[argno];
type = check_typedef (value_type (arg));
- len = TYPE_LENGTH (type);
+ len = type->length ();
/* Special handling for function parameters. */
if (len == 8
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];
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 ();
}
}
}
/* 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;
{
/* 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
{
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
{
/* 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;
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);
}
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))
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
{
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 (')');
}
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"));
}
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"));
}
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));
/* 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)"
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;
};
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
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: */
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)
{
return ((type->code () == TYPE_CODE_STRUCT)
|| (type->code () == TYPE_CODE_UNION))
- && TYPE_LENGTH (type) > 8;
+ && type->length () > 8;
}
/* Function: extract_return_value
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))
{
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 ());
}
}
/* 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)
i++)
{
type = value_type (args[i]);
- typelen = TYPE_LENGTH (type);
+ typelen = type->length ();
if (typelen <= 4)
{
/* Scalars of up to 4 bytes,
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)
{
/* 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);
/* 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);
#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. */
/* __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);
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;
++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);
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,
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;
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);
/* 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,
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;
}
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);
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 ());
}
}
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)
{
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)
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));
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)
{
{
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;
{
pstate->push_new<long_const_operation>
(parse_m2_type (pstate)->builtin_int,
- TYPE_LENGTH ($3));
+ $3->length ());
}
;
{
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;
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)
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 ");
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;
}
/* 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)
{
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)))
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)))
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);
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. */
/* 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;
{
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);
}
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)
{
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)
{
{
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)
{
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)
{
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);
}
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
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;
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);
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);
}
}
- store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
+ store_unsigned_integer (buf, type->length (), byte_order, addr);
}
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 ();
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);
/* 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));
{
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
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
{
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);
{
type = value_type (args[argnum]);
- if (TYPE_LENGTH (type) & 1)
+ if (type->length () & 1)
{
static gdb_byte zero = 0;
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. */
{
int len;
- len = TYPE_LENGTH (type);
+ len = type->length ();
/* First argument is passed in D and X registers. */
if (len <= 2)
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);
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
{
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;
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)
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)
{
{
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);
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
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;
/* 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:
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;
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;
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;
;
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;
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)
{
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));
static int
mep_use_struct_convention (struct type *type)
{
- return (TYPE_LENGTH (type) > MEP_GPR_SIZE);
+ return (type->length () > MEP_GPR_SIZE);
}
/* 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);
}
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
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);
}
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)
{
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)
{
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,
|| (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;
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);
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__,
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));
static int
microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
{
- return (TYPE_LENGTH (type) == 16);
+ return (type->length () == 16);
}
\f
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
return (register_size (gdbarch, regnum) == 8
&& regnum % num_regs > 0 && regnum % num_regs < 32
- && TYPE_LENGTH (type) < 8);
+ && type->length () < 8);
}
static int
}
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;
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
/* 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;
/* 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)
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
{
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)
{
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)
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)
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;
}
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? */
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,
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++)
/* 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
/* 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)
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)
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",
($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
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
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;
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. */
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);
}
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);
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);
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);
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)
|| 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
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
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);
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);
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);
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)
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;
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);
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
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:
{
/* 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 ())
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)
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)
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++;
{
/* 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;
}
else
{
- arg_len = TYPE_LENGTH (value_type (*args));
+ arg_len = value_type (*args)->length ();
val = value_contents (*args).data ();
}
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);
{
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
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
{
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;
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];
if (align == 0)
continue;
- sp -= TYPE_LENGTH (type);
+ sp -= type->length ();
sp = align_down (sp, align);
}
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 ();
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)
{
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)
{
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;
}
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);
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))
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))
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)
/* 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. */
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 ();
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;
}
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);
&& 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);
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;
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;
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;
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)
/* 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 ());
}
}
}
/* 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);
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
/* 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);
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;
/* 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 (_("\
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;
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)); \
{
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;
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 ())
{
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)
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. */
$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
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)
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 ?? */
/* 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
if (passed_a_ptr)
gdb_printf (stream, "(");
gdb_printf (stream, "array ");
- if (TYPE_LENGTH (type->target_type ()) > 0
+ if (type->target_type ()->length () > 0
&& type->bounds ()->high.kind () != PROP_UNDEFINED)
gdb_printf (stream, "[%s..%s] ",
plongest (type->bounds ()->low.const_val ()),
{
len = high_bound - low_bound + 1;
elttype = check_typedef (type->target_type ());
- eltlen = TYPE_LENGTH (elttype);
+ eltlen = elttype->length ();
/* If 's' format is used, try to print out as string.
If no format is given, print as string if element type
is of TYPE_CODE_CHAR and element size is 1,2 or 4. */
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
/* Extract the address, assume that it is unsigned. */
addr = extract_unsigned_integer (valaddr,
- TYPE_LENGTH (type), byte_order);
+ type->length (), byte_order);
print_address_demangle (options, gdbarch, addr, stream, demangle);
break;
}
/* 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
|| elttype->code () == TYPE_CODE_CHAR))
- || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4)
+ || ((elttype->length () == 2 || elttype->length () == 4)
&& elttype->code () == TYPE_CODE_CHAR))
&& (options->format == 0 || options->format == 's')
&& addr != 0)
(options, gdbarch,
extract_unsigned_integer
(valaddr + type->field (VTBL_FNADDR_OFFSET).loc_bitpos () / 8,
- TYPE_LENGTH (type->field (VTBL_FNADDR_OFFSET).type ()),
+ type->field (VTBL_FNADDR_OFFSET).type ()->length (),
byte_order),
stream, demangle);
}
int bound_info = (get_discrete_bounds (range, &low_bound, &high_bound)
? 0 : -1);
- if (low_bound == 0 && high_bound == -1 && TYPE_LENGTH (type) > 0)
+ if (low_bound == 0 && high_bound == -1 && type->length () > 0)
{
/* If we know the size of the set type, we can figure out the
maximum value. */
bound_info = 0;
- high_bound = TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1;
+ high_bound = type->length () * TARGET_CHAR_BIT - 1;
range->bounds ()->high.set_const_val (high_bound);
}
maybe_bad_bstring:
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 ())
{
CORE_ADDR address= value_address (val);
- 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_value = value_from_contents_and_address (baseclass,
buf.data (),
/* DATA_VALUE is the constant in RIGHT_VAL, but actually has
the same type as the memory region referenced by LEFT_VAL. */
- *len = TYPE_LENGTH (check_typedef (value_type (left_val)));
+ *len = check_typedef (value_type (left_val))->length ();
}
else if (num_accesses_left == 0 && num_accesses_right == 1
&& VALUE_LVAL (right_val) == lval_memory
/* DATA_VALUE is the constant in LEFT_VAL, but actually has
the same type as the memory region referenced by RIGHT_VAL. */
- *len = TYPE_LENGTH (check_typedef (value_type (right_val)));
+ *len = check_typedef (value_type (right_val))->length ();
}
else
return 0;
{
if ((valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION)
- && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
+ && !((valtype->length () == 16 || valtype->length () == 8)
&& valtype->is_vector ()))
return RETURN_VALUE_STRUCT_CONVENTION;
else
#if 0
if ((valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION)
- && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
+ && !((valtype->length () == 16 || valtype->length () == 8)
&& valtype->is_vector ())
- && !(TYPE_LENGTH (valtype) == 1
- || TYPE_LENGTH (valtype) == 2
- || TYPE_LENGTH (valtype) == 4
- || TYPE_LENGTH (valtype) == 8))
+ && !(valtype->length () == 1
+ || valtype->length () == 2
+ || valtype->length () == 4
+ || valtype->length () == 8))
return RETURN_VALUE_STRUCT_CONVENTION;
else
#endif
{
struct value *arg = args[argno];
struct type *type = check_typedef (value_type (arg));
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
const bfd_byte *val = value_contents (arg).data ();
if (type->code () == TYPE_CODE_FLT && len <= 8
/* 32-bit decimal floats are right aligned in the
doubleword. */
- if (TYPE_LENGTH (type) == 4)
+ if (type->length () == 4)
{
memcpy (regval + 4, val, 4);
p = regval;
/* OpenCL vectors shorter than 16 bytes are passed as if
a series of independent scalars. */
struct type *eltype = check_typedef (type->target_type ());
- int i, nelt = TYPE_LENGTH (type) / TYPE_LENGTH (eltype);
+ int i, nelt = type->length () / eltype->length ();
for (i = 0; i < nelt; i++)
{
- const gdb_byte *elval = val + i * TYPE_LENGTH (eltype);
+ const gdb_byte *elval = val + i * eltype->length ();
if (eltype->code () == TYPE_CODE_FLT && !tdep->soft_float)
{
argoffset += len;
}
}
- else if (TYPE_LENGTH (eltype) == 8)
+ else if (eltype->length () == 8)
{
if (greg > 9)
{
argoffset = align_up (argoffset, 8);
if (write_pass)
write_memory (sp + argoffset, elval,
- TYPE_LENGTH (eltype));
+ eltype->length ());
argoffset += 8;
}
else
gdb_assert (valtype->code () == TYPE_CODE_DECFLOAT);
/* 32-bit and 64-bit decimal floats in f1. */
- if (TYPE_LENGTH (valtype) <= 8)
+ if (valtype->length () <= 8)
{
if (writebuf != NULL)
{
const gdb_byte *p;
/* 32-bit decimal float is right aligned in the doubleword. */
- if (TYPE_LENGTH (valtype) == 4)
+ if (valtype->length () == 4)
{
memcpy (regval + 4, writebuf, 4);
p = regval;
regcache->cooked_read (tdep->ppc_fp0_regnum + 1, readbuf);
/* Left align 32-bit decimal float. */
- if (TYPE_LENGTH (valtype) == 4)
+ if (valtype->length () == 4)
memcpy (readbuf, readbuf + 4, 4);
}
}
/* 128-bit decimal floats in f2,f3. */
- else if (TYPE_LENGTH (valtype) == 16)
+ else if (valtype->length () == 16)
{
if (writebuf != NULL || readbuf != NULL)
{
gdb_assert (tdep->wordsize == 4);
if (type->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (type) <= 8
+ && type->length () <= 8
&& !tdep->soft_float)
{
if (readbuf)
return RETURN_VALUE_REGISTER_CONVENTION;
}
if (type->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (type) == 16
+ && type->length () == 16
&& !tdep->soft_float
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (TYPE_LENGTH (type) == 16
+ if (type->length () == 16
&& ((type->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if ((type->code () == TYPE_CODE_INT && TYPE_LENGTH (type) == 8)
- || (type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)
- || (type->code () == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 8
+ if ((type->code () == TYPE_CODE_INT && type->length () == 8)
+ || (type->code () == TYPE_CODE_FLT && type->length () == 8)
+ || (type->code () == TYPE_CODE_DECFLOAT && type->length () == 8
&& tdep->soft_float))
{
if (readbuf)
|| type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
|| type->code () == TYPE_CODE_ENUM)
- && TYPE_LENGTH (type) <= tdep->wordsize)
+ && type->length () <= tdep->wordsize)
{
if (readbuf)
{
ULONGEST regval;
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
®val);
- store_unsigned_integer (readbuf, TYPE_LENGTH (type), byte_order,
+ store_unsigned_integer (readbuf, type->length (), byte_order,
regval);
}
if (writebuf)
scalars in f1..f2 or r3..r10. */
if (type->code () == TYPE_CODE_ARRAY
&& type->is_vector ()
- && TYPE_LENGTH (type) < 16
+ && type->length () < 16
&& opencl_abi)
{
struct type *eltype = check_typedef (type->target_type ());
- int i, nelt = TYPE_LENGTH (type) / TYPE_LENGTH (eltype);
+ int i, nelt = type->length () / eltype->length ();
for (i = 0; i < nelt; i++)
{
- int offset = i * TYPE_LENGTH (eltype);
+ int offset = i * eltype->length ();
if (eltype->code () == TYPE_CODE_FLT)
{
{
regcache_cooked_read_unsigned (regcache, regnum, ®val);
store_unsigned_integer (readbuf + offset,
- TYPE_LENGTH (eltype), byte_order,
+ eltype->length (), byte_order,
regval);
}
}
/* OpenCL vectors >= 16 bytes are returned in v2..v9. */
if (type->code () == TYPE_CODE_ARRAY
&& type->is_vector ()
- && TYPE_LENGTH (type) >= 16
+ && type->length () >= 16
&& opencl_abi)
{
- int n_regs = TYPE_LENGTH (type) / 16;
+ int n_regs = type->length () / 16;
int i;
for (i = 0; i < n_regs; i++)
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (TYPE_LENGTH (type) == 16
+ if (type->length () == 16
&& type->code () == TYPE_CODE_ARRAY
&& type->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (TYPE_LENGTH (type) == 16
+ if (type->length () == 16
&& type->code () == TYPE_CODE_ARRAY
&& type->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_GENERIC)
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (TYPE_LENGTH (type) == 8
+ if (type->length () == 8
&& type->code () == TYPE_CODE_ARRAY
&& type->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_SPE)
regcache->cooked_write (tdep->ppc_ev0_regnum + 3, writebuf);
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (broken_gcc && TYPE_LENGTH (type) <= 8)
+ if (broken_gcc && type->length () <= 8)
{
/* GCC screwed up for structures or unions whose size is less
than or equal to 8 bytes.. Instead of left-aligning, it
right-aligns the data into the buffer formed by r3, r4. */
gdb_byte regvals[PPC_MAX_REGISTER_SIZE * 2];
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int offset = (2 * tdep->wordsize - len) % tdep->wordsize;
if (readbuf)
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (TYPE_LENGTH (type) <= 8)
+ if (type->length () <= 8)
{
if (readbuf)
{
gdb_byte regvals[PPC_MAX_REGISTER_SIZE * 2];
regcache->cooked_read (tdep->ppc_gp0_regnum + 3,
regvals + 0 * tdep->wordsize);
- if (TYPE_LENGTH (type) > tdep->wordsize)
+ if (type->length () > tdep->wordsize)
regcache->cooked_read (tdep->ppc_gp0_regnum + 4,
regvals + 1 * tdep->wordsize);
- memcpy (readbuf, regvals, TYPE_LENGTH (type));
+ memcpy (readbuf, regvals, type->length ());
}
if (writebuf)
{
two "words" into r3/r4. */
gdb_byte regvals[PPC_MAX_REGISTER_SIZE * 2];
memset (regvals, 0, sizeof regvals);
- memcpy (regvals, writebuf, TYPE_LENGTH (type));
+ memcpy (regvals, writebuf, type->length ());
regcache->cooked_write (tdep->ppc_gp0_regnum + 3,
regvals + 0 * tdep->wordsize);
- if (TYPE_LENGTH (type) > tdep->wordsize)
+ if (type->length () > tdep->wordsize)
regcache->cooked_write (tdep->ppc_gp0_regnum + 4,
regvals + 1 * tdep->wordsize);
}
if (!*field_type)
*field_type = type;
if ((*field_type)->code () == type->code ()
- && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type))
+ && (*field_type)->length () == type->length ())
return 1;
break;
if (!*field_type)
*field_type = type;
if ((*field_type)->code () == type->code ()
- && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type))
+ && (*field_type)->length () == type->length ())
return 2;
}
break;
if (!*field_type)
*field_type = type;
if ((*field_type)->code () == type->code ()
- && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type))
+ && (*field_type)->length () == type->length ())
return 1;
}
else
/* There must be no padding. */
if (count == 0)
- return TYPE_LENGTH (type) == 0 ? 0 : -1;
- else if (TYPE_LENGTH (type) != count * TYPE_LENGTH (*field_type))
+ return type->length () == 0 ? 0 : -1;
+ else if (type->length () != count * (*field_type)->length ())
return -1;
return count;
/* There must be no padding. */
if (count == 0)
- return TYPE_LENGTH (type) == 0 ? 0 : -1;
- else if (TYPE_LENGTH (type) != count * TYPE_LENGTH (*field_type))
+ return type->length () == 0 ? 0 : -1;
+ else if (type->length () != count * (*field_type)->length ())
return -1;
return count;
else if (field_type->code () == TYPE_CODE_FLT
|| field_type->code () == TYPE_CODE_DECFLOAT)
- n_regs = (TYPE_LENGTH (field_type) + 7) >> 3;
+ n_regs = (field_type->length () + 7) >> 3;
else
n_regs = 1;
if (tdep->soft_float)
return;
- if (TYPE_LENGTH (type) <= 8
+ if (type->length () <= 8
&& type->code () == TYPE_CODE_FLT)
{
/* Floats and doubles go in f1 .. f13. 32-bit floats are converted
argpos->freg++;
}
- else if (TYPE_LENGTH (type) <= 8
+ else if (type->length () <= 8
&& type->code () == TYPE_CODE_DECFLOAT)
{
/* Floats and doubles go in f1 .. f13. 32-bit decimal floats are
int offset = 0;
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- offset = 8 - TYPE_LENGTH (type);
+ offset = 8 - type->length ();
argpos->regcache->cooked_write_part (regnum, offset,
- TYPE_LENGTH (type), val);
+ type->length (), val);
}
argpos->freg++;
}
- else if (TYPE_LENGTH (type) == 16
+ else if (type->length () == 16
&& type->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
argpos->freg += 2;
}
- else if (TYPE_LENGTH (type) == 16
+ else if (type->length () == 16
&& type->code () == TYPE_CODE_DECFLOAT)
{
/* 128-bit decimal floating-point values are stored in and even/odd
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
if (type->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (type) == 16
+ && type->length () == 16
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ieee_quad))
{
/* IEEE FLOAT128, args in vector registers. */
- ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 16, argpos);
+ ppc64_sysv_abi_push_val (gdbarch, val, type->length (), 16, argpos);
ppc64_sysv_abi_push_vreg (gdbarch, val, argpos);
}
else if (type->code () == TYPE_CODE_FLT
|| type->code () == TYPE_CODE_DECFLOAT)
{
/* Floating-point scalars are passed in floating-point registers. */
- ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 0, argpos);
+ ppc64_sysv_abi_push_val (gdbarch, val, type->length (), 0, argpos);
ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);
}
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC
- && TYPE_LENGTH (type) == 16)
+ && type->length () == 16)
{
/* AltiVec vectors are passed aligned, and in vector registers. */
- ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 16, argpos);
+ ppc64_sysv_abi_push_val (gdbarch, val, type->length (), 16, argpos);
ppc64_sysv_abi_push_vreg (gdbarch, val, argpos);
}
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
- && TYPE_LENGTH (type) >= 16)
+ && type->length () >= 16)
{
/* Non-Altivec vectors are passed by reference. */
/* Copy value onto the stack ... */
CORE_ADDR addr = align_up (argpos->refparam, 16);
if (argpos->regcache)
- write_memory (addr, val, TYPE_LENGTH (type));
- argpos->refparam = align_up (addr + TYPE_LENGTH (type), tdep->wordsize);
+ write_memory (addr, val, type->length ());
+ argpos->refparam = align_up (addr + type->length (), tdep->wordsize);
/* ... and pass a pointer to the copy as parameter. */
ppc64_sysv_abi_push_integer (gdbarch, addr, argpos);
|| type->code () == TYPE_CODE_CHAR
|| type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type))
- && TYPE_LENGTH (type) <= tdep->wordsize)
+ && type->length () <= tdep->wordsize)
{
ULONGEST word = 0;
if (type->code () == TYPE_CODE_FLT) {
/* Handle the case of 128-bit floats for both IEEE and IBM long double
formats. */
- if (TYPE_LENGTH (type) == 16
+ if (type->length () == 16
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ieee_quad))
{
gdbarch))
for (i = 0; i < nelt; i++)
{
- const gdb_byte *elval = val + i * TYPE_LENGTH (eltype);
+ const gdb_byte *elval = val + i * eltype->length ();
if (eltype->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (eltype) == 16
+ && eltype->length () == 16
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ieee_quad))
/* IEEE FLOAT128, args in vector registers. */
else if (eltype->code () == TYPE_CODE_ARRAY
&& eltype->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC
- && TYPE_LENGTH (eltype) == 16)
+ && eltype->length () == 16)
{
ppc64_sysv_abi_push_vreg (gdbarch, elval, argpos);
align = 16;
}
}
- ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), align, argpos);
+ ppc64_sysv_abi_push_val (gdbarch, val, type->length (), align, argpos);
}
}
ppc64_sysv_abi_push_param (gdbarch, eltype, val, &argpos);
ppc64_sysv_abi_push_param (gdbarch, eltype,
- val + TYPE_LENGTH (eltype), &argpos);
+ val + eltype->length (), &argpos);
}
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
&& opencl_abi)
struct type *eltype;
int i, nelt;
- if (TYPE_LENGTH (type) < 16)
+ if (type->length () < 16)
eltype = check_typedef (type->target_type ());
else
eltype = register_type (gdbarch, tdep->ppc_vr0_regnum);
- nelt = TYPE_LENGTH (type) / TYPE_LENGTH (eltype);
+ nelt = type->length () / eltype->length ();
for (i = 0; i < nelt; i++)
{
- const gdb_byte *elval = val + i * TYPE_LENGTH (eltype);
+ const gdb_byte *elval = val + i * eltype->length ();
ppc64_sysv_abi_push_param (gdbarch, eltype, elval, &argpos);
}
|| valtype->code () == TYPE_CODE_BOOL
|| valtype->code () == TYPE_CODE_RANGE
|| is_fixed_point_type (valtype))
- && TYPE_LENGTH (valtype) <= 8)
+ && valtype->length () <= 8)
{
int regnum = tdep->ppc_gp0_regnum + 3 + index;
gdb_mpz unscaled;
unscaled.read (gdb::make_array_view (writebuf,
- TYPE_LENGTH (valtype)),
+ valtype->length ()),
type_byte_order (valtype),
valtype->is_unsigned ());
return_val = unscaled.as_integer<LONGEST> ();
ULONGEST regval;
regcache_cooked_read_unsigned (regcache, regnum, ®val);
- store_unsigned_integer (readbuf, TYPE_LENGTH (valtype),
+ store_unsigned_integer (readbuf, valtype->length (),
gdbarch_byte_order (gdbarch), regval);
}
return 1;
/* Floats and doubles go in f1 .. f13. 32-bit floats are converted
to double first. */
- if (TYPE_LENGTH (valtype) <= 8
+ if (valtype->length () <= 8
&& valtype->code () == TYPE_CODE_FLT)
{
int regnum = tdep->ppc_fp0_regnum + 1 + index;
/* Floats and doubles go in f1 .. f13. 32-bit decimal floats are
placed in the least significant word. */
- if (TYPE_LENGTH (valtype) <= 8
+ if (valtype->length () <= 8
&& valtype->code () == TYPE_CODE_DECFLOAT)
{
int regnum = tdep->ppc_fp0_regnum + 1 + index;
int offset = 0;
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- offset = 8 - TYPE_LENGTH (valtype);
+ offset = 8 - valtype->length ();
if (writebuf != NULL)
- regcache->cooked_write_part (regnum, offset, TYPE_LENGTH (valtype),
+ regcache->cooked_write_part (regnum, offset, valtype->length (),
writebuf);
if (readbuf != NULL)
- regcache->cooked_read_part (regnum, offset, TYPE_LENGTH (valtype),
+ regcache->cooked_read_part (regnum, offset, valtype->length (),
readbuf);
return 1;
}
/* IBM long double stored in two consecutive FPRs. */
- if (TYPE_LENGTH (valtype) == 16
+ if (valtype->length () == 16
&& valtype->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
/* 128-bit decimal floating-point values are stored in an even/odd
pair of FPRs, with the even FPR holding the most significant half. */
- if (TYPE_LENGTH (valtype) == 16
+ if (valtype->length () == 16
&& valtype->code () == TYPE_CODE_DECFLOAT)
{
int regnum = tdep->ppc_fp0_regnum + 2 + 2 * index;
/* AltiVec vectors are returned in VRs starting at v2.
IEEE FLOAT 128-bit are stored in vector register. */
- if (TYPE_LENGTH (valtype) == 16
+ if (valtype->length () == 16
&& ((valtype->code () == TYPE_CODE_ARRAY
&& valtype->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
}
/* Short vectors are returned in GPRs starting at r3. */
- if (TYPE_LENGTH (valtype) <= 8
+ if (valtype->length () <= 8
&& valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector ())
{
int regnum = tdep->ppc_gp0_regnum + 3 + index;
int offset = 0;
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- offset = 8 - TYPE_LENGTH (valtype);
+ offset = 8 - valtype->length ();
if (writebuf != NULL)
- regcache->cooked_write_part (regnum, offset, TYPE_LENGTH (valtype),
+ regcache->cooked_write_part (regnum, offset, valtype->length (),
writebuf);
if (readbuf != NULL)
- regcache->cooked_read_part (regnum, offset, TYPE_LENGTH (valtype),
+ regcache->cooked_read_part (regnum, offset, valtype->length (),
readbuf);
return 1;
}
gdb_assert (ok);
if (readbuf)
- readbuf += TYPE_LENGTH (eltype);
+ readbuf += eltype->length ();
if (writebuf)
- writebuf += TYPE_LENGTH (eltype);
+ writebuf += eltype->length ();
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
if (valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector ()
&& opencl_abi)
{
- if (TYPE_LENGTH (valtype) < 16)
+ if (valtype->length () < 16)
eltype = check_typedef (valtype->target_type ());
else
eltype = register_type (gdbarch, tdep->ppc_vr0_regnum);
- nelt = TYPE_LENGTH (valtype) / TYPE_LENGTH (eltype);
+ nelt = valtype->length () / eltype->length ();
for (int i = 0; i < nelt; i++)
{
ok = ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcache,
gdb_assert (ok);
if (readbuf)
- readbuf += TYPE_LENGTH (eltype);
+ readbuf += eltype->length ();
if (writebuf)
- writebuf += TYPE_LENGTH (eltype);
+ writebuf += eltype->length ();
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
/* Small character arrays are returned, right justified, in r3. */
if (valtype->code () == TYPE_CODE_ARRAY
&& !valtype->is_vector ()
- && TYPE_LENGTH (valtype) <= 8
+ && valtype->length () <= 8
&& valtype->target_type ()->code () == TYPE_CODE_INT
- && TYPE_LENGTH (valtype->target_type ()) == 1)
+ && valtype->target_type ()->length () == 1)
{
int regnum = tdep->ppc_gp0_regnum + 3;
- int offset = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype));
+ int offset = (register_size (gdbarch, regnum) - valtype->length ());
if (writebuf != NULL)
- regcache->cooked_write_part (regnum, offset, TYPE_LENGTH (valtype),
+ regcache->cooked_write_part (regnum, offset, valtype->length (),
writebuf);
if (readbuf != NULL)
- regcache->cooked_read_part (regnum, offset, TYPE_LENGTH (valtype),
+ regcache->cooked_read_part (regnum, offset, valtype->length (),
readbuf);
return RETURN_VALUE_REGISTER_CONVENTION;
}
|| (eltype->code () == TYPE_CODE_ARRAY
&& eltype->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC
- && TYPE_LENGTH (eltype) == 16)))
+ && eltype->length () == 16)))
{
for (int i = 0; i < nelt; i++)
{
gdb_assert (ok);
if (readbuf)
- readbuf += TYPE_LENGTH (eltype);
+ readbuf += eltype->length ();
if (writebuf)
- writebuf += TYPE_LENGTH (eltype);
+ writebuf += eltype->length ();
}
return RETURN_VALUE_REGISTER_CONVENTION;
/* In the ELFv2 ABI, aggregate types of up to 16 bytes are
returned in registers r3:r4. */
if (tdep->elf_abi == POWERPC_ELF_V2
- && TYPE_LENGTH (valtype) <= 16
+ && valtype->length () <= 16
&& (valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION
|| (valtype->code () == TYPE_CODE_ARRAY
&& !valtype->is_vector ())))
{
- int n_regs = ((TYPE_LENGTH (valtype) + tdep->wordsize - 1)
+ int n_regs = ((valtype->length () + tdep->wordsize - 1)
/ tdep->wordsize);
for (int i = 0; i < n_regs; i++)
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
int regnum = tdep->ppc_gp0_regnum + 3 + i;
int offset = i * tdep->wordsize;
- int len = TYPE_LENGTH (valtype) - offset;
+ int len = valtype->length () - offset;
if (len > tdep->wordsize)
len = tdep->wordsize;
struct ui_file *stream)
{
struct type *type = check_typedef (value_type (val));
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
if (VALUE_LVAL (val) == lval_memory)
next_address = value_address (val) + len;
struct gdbarch *gdbarch = type->arch ();
const struct builtin_type *builtin = builtin_type (gdbarch);
- if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_float))
+ if (type->length () == builtin->builtin_float->length ())
type = builtin->builtin_float;
- else if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_double))
+ else if (type->length () == builtin->builtin_double->length ())
type = builtin->builtin_double;
- else if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_long_double))
+ else if (type->length () == builtin->builtin_long_double->length ())
type = builtin->builtin_long_double;
return type;
int size, struct ui_file *stream)
{
struct gdbarch *gdbarch = type->arch ();
- unsigned int len = TYPE_LENGTH (type);
+ unsigned int len = type->length ();
enum bfd_endian byte_order = type_byte_order (type);
/* String printing should go through val_print_scalar_formatted. */
/* If the value is a pointer, and pointers and addresses are not the
same, then at this point, the value's length (in target bytes) is
- gdbarch_addr_bit/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */
+ gdbarch_addr_bit/TARGET_CHAR_BIT, not type->length (). */
if (type->code () == TYPE_CODE_PTR)
len = gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT;
if (options->format != 'c'
&& (options->format != 'd' || type->is_unsigned ()))
{
- if (len < TYPE_LENGTH (type) && byte_order == BFD_ENDIAN_BIG)
- valaddr += TYPE_LENGTH (type) - len;
+ if (len < type->length () && byte_order == BFD_ENDIAN_BIG)
+ valaddr += type->length () - len;
}
/* Allow LEN == 0, and in this case, don't assume that VALADDR is
|| type->bit_size_differs_p ())
{
val_long.emplace (unpack_long (type, valaddr));
- converted_bytes.resize (TYPE_LENGTH (type));
- store_signed_integer (converted_bytes.data (), TYPE_LENGTH (type),
+ converted_bytes.resize (type->length ());
+ store_signed_integer (converted_bytes.data (), type->length (),
byte_order, *val_long);
valaddr = converted_bytes.data ();
}
else if (format == 's')
{
next_address = find_string_backward (gdbarch, addr, count,
- TYPE_LENGTH (val_type),
+ val_type->length (),
&opts, &count);
}
else
{
- next_address = addr - count * TYPE_LENGTH (val_type);
+ next_address = addr - count * val_type->length ();
}
/* The following call to print_formatted updates next_address in every
iteration. In backward case, we store the start address here
and update next_address with it before exiting the function. */
addr_rewound = (format == 's'
- ? next_address - TYPE_LENGTH (val_type)
+ ? next_address - val_type->length ()
: next_address);
need_to_update_next_address = 1;
}
&& VALUE_LVAL (value) == lval_internalvar
&& c_is_string_type_p (value_type (value)))
{
- size_t len = TYPE_LENGTH (value_type (value));
+ size_t len = value_type (value)->length ();
/* Copy the internal var value to TEM_STR and append a terminating null
character. This protects against corrupted C-style strings that lack
struct gdbarch *gdbarch = value_type (value)->arch ();
struct type *wctype = lookup_typename (current_language,
"wchar_t", NULL, 0);
- int wcwidth = TYPE_LENGTH (wctype);
+ int wcwidth = wctype->length ();
if (VALUE_LVAL (value) == lval_internalvar
&& c_is_string_type_p (value_type (value)))
{
str = value_contents (value).data ();
- len = TYPE_LENGTH (value_type (value));
+ len = value_type (value)->length ();
}
else
{
const gdb_byte *bytes;
valtype = value_type (val_args[i]);
- if (TYPE_LENGTH (valtype) != TYPE_LENGTH (wctype)
+ if (valtype->length () != wctype->length ()
|| valtype->code () != TYPE_CODE_INT)
error (_("expected wchar_t argument for %%lc"));
convert_between_encodings (target_wide_charset (gdbarch),
host_charset (),
- bytes, TYPE_LENGTH (valtype),
- TYPE_LENGTH (valtype),
+ bytes, valtype->length (),
+ valtype->length (),
&output, translit_char);
obstack_grow_str0 (&output, "");
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
void *ptr;
- gdb_assert (sizeof (ptr) == TYPE_LENGTH (ptr_type));
+ gdb_assert (sizeof (ptr) == ptr_type->length ());
gdbarch_address_to_pointer (target_gdbarch (), ptr_type,
(gdb_byte *) &ptr, addr);
return ptr;
different. */
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
- if (sizeof (void *) != TYPE_LENGTH (ptr_type))
+ if (sizeof (void *) != ptr_type->length ())
return 0;
/* Other tests here??? */
{
struct value *val = value_object_to_value (handle_obj);
bytes = value_contents_all (val).data ();
- bytes_len = TYPE_LENGTH (value_type (val));
+ bytes_len = value_type (val)->length ();
}
else
{
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_python_initialized)
if (size_varies)
Py_RETURN_NONE;
- return gdb_py_object_from_longest (TYPE_LENGTH (type)).release ();
+ return gdb_py_object_from_longest (type->length ()).release ();
}
/* Return the alignment of the type represented by SELF, in bytes. */
return NULL;
}
data_size = register_size (pending_frame->gdbarch, regnum);
- if (data_size != TYPE_LENGTH (value_type (value)))
+ if (data_size != value_type (value)->length ())
{
PyErr_Format (
PyExc_ValueError,
"The value of the register returned by the Python "
"sniffer has unexpected size: %u instead of %u.",
- (unsigned) TYPE_LENGTH (value_type (value)),
+ (unsigned) value_type (value)->length (),
(unsigned) data_size);
return NULL;
}
/* `value' validation was done before, just assert. */
gdb_assert (value != NULL);
- gdb_assert (data_size == TYPE_LENGTH (value_type (value)));
+ gdb_assert (data_size == value_type (value)->length ());
cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
memcpy (cached_frame->reg[i].data,
return nullptr;
}
- if (TYPE_LENGTH (type) > py_buf.len)
+ if (type->length () > py_buf.len)
{
PyErr_SetString (PyExc_ValueError,
_("Size of type is larger than that of buffer object."));
encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
return PyUnicode_Decode ((const char *) buffer.get (),
- length * TYPE_LENGTH (char_type),
+ length * char_type->length (),
encoding, errors);
}
if (!object_msym.minsym)
return 0;
- object_size = TYPE_LENGTH (builtin_type_void_data_ptr);
+ object_size = builtin_type_void_data_ptr->length ();
object_addr = (object_msym.value_address ()
+ (cpu - 1) * object_size);
buf_size = object_size;
= GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
{
- descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
+ descr->sizeof_register[i] = descr->register_type[i]->length ();
descr->register_offset[i] = offset;
offset += descr->sizeof_register[i];
}
for (; i < descr->nr_cooked_registers; i++)
{
- descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
+ descr->sizeof_register[i] = descr->register_type[i]->length ();
descr->register_offset[i] = offset;
offset += descr->sizeof_register[i];
}
if (cooked_read (regnum,
value_contents_raw (result).data ()) == REG_UNAVAILABLE)
mark_value_bytes_unavailable (result, 0,
- TYPE_LENGTH (value_type (result)));
+ value_type (result)->length ());
return result;
}
int flen = riscv_isa_flen (gdbarch);
if (flen == 8
&& type->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (type) == flen
+ && type->length () == flen
&& (strcmp (type->name (), "builtin_type_ieee_double") == 0
|| strcmp (type->name (), "double") == 0))
type = riscv_fpreg_d_type (gdbarch);
|| regnum == RISCV_GP_REGNUM
|| regnum == RISCV_TP_REGNUM)
&& type->code () == TYPE_CODE_INT
- && TYPE_LENGTH (type) == xlen)
+ && type->length () == xlen)
{
/* This spots the case where some interesting registers are defined
as simple integers of the expected size, we force these registers
if (print_raw_format)
{
gdb_printf (file, "\t(raw ");
- print_hex_chars (file, valaddr, TYPE_LENGTH (regtype), byte_order,
+ print_hex_chars (file, valaddr, regtype->length (), byte_order,
true);
gdb_printf (file, ")");
}
{
type = check_typedef (type);
if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
- return std::min (TYPE_LENGTH (type), (ULONGEST) BIGGEST_ALIGNMENT);
+ return std::min (type->length (), (ULONGEST) BIGGEST_ALIGNMENT);
/* Anything else will be aligned by the generic code. */
return 0;
except we use the type of the complex field instead of the
type from AINFO, and the first location might be at a non-zero
offset. */
- if (TYPE_LENGTH (sinfo.field_type (0)) <= (2 * cinfo->flen)
+ if (sinfo.field_type (0)->length () <= (2 * cinfo->flen)
&& riscv_arg_regs_available (&cinfo->float_regs) >= 2
&& !ainfo->is_unnamed)
{
bool result;
- int len = TYPE_LENGTH (sinfo.field_type (0)) / 2;
+ int len = sinfo.field_type (0)->length () / 2;
int offset = sinfo.field_offset (0);
result = riscv_assign_reg_location (&ainfo->argloc[0],
except we use the type of the first scalar field instead of
the type from AINFO. Also the location might be at a non-zero
offset. */
- if (TYPE_LENGTH (sinfo.field_type (0)) > cinfo->flen
+ if (sinfo.field_type (0)->length () > cinfo->flen
|| ainfo->is_unnamed)
riscv_call_arg_scalar_int (ainfo, cinfo);
else
{
int offset = sinfo.field_offset (0);
- int len = TYPE_LENGTH (sinfo.field_type (0));
+ int len = sinfo.field_type (0)->length ();
if (!riscv_assign_reg_location (&ainfo->argloc[0],
&cinfo->float_regs,
if (sinfo.number_of_fields () == 2
&& sinfo.field_type(0)->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (sinfo.field_type (0)) <= cinfo->flen
+ && sinfo.field_type (0)->length () <= cinfo->flen
&& sinfo.field_type(1)->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (sinfo.field_type (1)) <= cinfo->flen
+ && sinfo.field_type (1)->length () <= cinfo->flen
&& riscv_arg_regs_available (&cinfo->float_regs) >= 2)
{
- int len0 = TYPE_LENGTH (sinfo.field_type (0));
+ int len0 = sinfo.field_type (0)->length ();
int offset = sinfo.field_offset (0);
if (!riscv_assign_reg_location (&ainfo->argloc[0],
&cinfo->float_regs, len0, offset))
error (_("failed during argument setup"));
- int len1 = TYPE_LENGTH (sinfo.field_type (1));
+ int len1 = sinfo.field_type (1)->length ();
offset = sinfo.field_offset (1);
- gdb_assert (len1 <= (TYPE_LENGTH (ainfo->type)
- - TYPE_LENGTH (sinfo.field_type (0))));
+ gdb_assert (len1 <= (ainfo->type->length ()
+ - sinfo.field_type (0)->length ()));
if (!riscv_assign_reg_location (&ainfo->argloc[1],
&cinfo->float_regs,
if (sinfo.number_of_fields () == 2
&& riscv_arg_regs_available (&cinfo->int_regs) >= 1
&& (sinfo.field_type(0)->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (sinfo.field_type (0)) <= cinfo->flen
+ && sinfo.field_type (0)->length () <= cinfo->flen
&& is_integral_type (sinfo.field_type (1))
- && TYPE_LENGTH (sinfo.field_type (1)) <= cinfo->xlen))
+ && sinfo.field_type (1)->length () <= cinfo->xlen))
{
- int len0 = TYPE_LENGTH (sinfo.field_type (0));
+ int len0 = sinfo.field_type (0)->length ();
int offset = sinfo.field_offset (0);
if (!riscv_assign_reg_location (&ainfo->argloc[0],
&cinfo->float_regs, len0, offset))
error (_("failed during argument setup"));
- int len1 = TYPE_LENGTH (sinfo.field_type (1));
+ int len1 = sinfo.field_type (1)->length ();
offset = sinfo.field_offset (1);
gdb_assert (len1 <= cinfo->xlen);
if (!riscv_assign_reg_location (&ainfo->argloc[1],
if (sinfo.number_of_fields () == 2
&& riscv_arg_regs_available (&cinfo->int_regs) >= 1
&& (is_integral_type (sinfo.field_type (0))
- && TYPE_LENGTH (sinfo.field_type (0)) <= cinfo->xlen
+ && sinfo.field_type (0)->length () <= cinfo->xlen
&& sinfo.field_type(1)->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (sinfo.field_type (1)) <= cinfo->flen))
+ && sinfo.field_type (1)->length () <= cinfo->flen))
{
- int len0 = TYPE_LENGTH (sinfo.field_type (0));
- int len1 = TYPE_LENGTH (sinfo.field_type (1));
+ int len0 = sinfo.field_type (0)->length ();
+ int len1 = sinfo.field_type (1)->length ();
gdb_assert (len0 <= cinfo->xlen);
gdb_assert (len1 <= cinfo->flen);
struct type *type, bool is_unnamed)
{
ainfo->type = type;
- ainfo->length = TYPE_LENGTH (ainfo->type);
+ ainfo->length = ainfo->type->length ();
ainfo->align = type_align (ainfo->type);
ainfo->is_unnamed = is_unnamed;
ainfo->contents = nullptr;
gdb_mpz unscaled;
unscaled.read (gdb::make_array_view (writebuf,
- TYPE_LENGTH (arg_type)),
+ arg_type->length ()),
type_byte_order (arg_type),
arg_type->is_unsigned ());
abi_val = allocate_value (info.type);
old_readbuf = readbuf;
readbuf = value_contents_raw (abi_val).data ();
}
- arg_len = TYPE_LENGTH (info.type);
+ arg_len = info.type->length ();
switch (info.argloc[0].loc_type)
{
else
arg_val = value_cast (arg_type, abi_val);
memcpy (old_readbuf, value_contents_raw (arg_val).data (),
- TYPE_LENGTH (arg_type));
+ arg_type->length ());
}
}
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
+ store_unsigned_integer (buf, type->length (), byte_order,
addr & 0xffffff);
}
{
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 code address? */
if (type->target_type ()->code () == TYPE_CODE_FUNC
|| type->target_type ()->code () == TYPE_CODE_METHOD
|| TYPE_CODE_SPACE (type->target_type ())
- || TYPE_LENGTH (type) == 4)
+ || type->length () == 4)
return rl78_make_instruction_address (addr);
else
return rl78_make_data_address (addr);
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- ULONGEST valtype_len = TYPE_LENGTH (valtype);
+ ULONGEST valtype_len = valtype->length ();
rl78_gdbarch_tdep *tdep = gdbarch_tdep<rl78_gdbarch_tdep> (gdbarch);
int is_g10 = tdep->elf_flags & E_FLAG_RL78_G10;
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 + 1) & ~1;
sp -= container_len;
arg = args[argno];
type = check_typedef (value_type (arg));
- len = TYPE_LENGTH (type);
+ len = type->length ();
if (type->code () == TYPE_CODE_FLT)
{
for (; jj < nargs; ++jj)
{
struct value *val = args[jj];
- space += ((TYPE_LENGTH (value_type (val))) + 3) & -4;
+ space += ((value_type (val)->length ()) + 3) & -4;
}
/* Add location required for the rest of the parameters. */
arg = args[argno];
type = check_typedef (value_type (arg));
- len = TYPE_LENGTH (type);
+ len = type->length ();
/* Float types should be passed in fpr's, as well as in the
/* AltiVec extension: Functions that declare a vector data type as a
return value place that return value in VR2. */
if (valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector ()
- && TYPE_LENGTH (valtype) == 16)
+ && valtype->length () == 16)
{
if (readbuf)
regcache->cooked_read (tdep->ppc_vr0_regnum + 2, readbuf);
complex*8 and complex*16 are returned in FPR1:FPR2, and
complex*32 is returned in FPR1:FPR4. */
if (valtype->code () == TYPE_CODE_FLT
- && (TYPE_LENGTH (valtype) == 4 || TYPE_LENGTH (valtype) == 8))
+ && (valtype->length () == 4 || valtype->length () == 8))
{
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
gdb_byte regval[8];
lengths less than or equal to 32 bits, must be returned right
justified in GPR3 with signed values sign extended and unsigned
values zero extended, as necessary. */
- if (TYPE_LENGTH (valtype) <= tdep->wordsize)
+ if (valtype->length () <= tdep->wordsize)
{
if (readbuf)
{
/* For reading we don't have to worry about sign extension. */
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
®val);
- store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), byte_order,
+ store_unsigned_integer (readbuf, valtype->length (), byte_order,
regval);
}
if (writebuf)
/* Eight-byte non-floating-point scalar values must be returned in
GPR3:GPR4. */
- if (TYPE_LENGTH (valtype) == 8)
+ if (valtype->length () == 8)
{
gdb_assert (valtype->code () != TYPE_CODE_FLT);
gdb_assert (tdep->wordsize == 4);
arg = args[argno];
type = check_typedef (value_type (arg));
- len = TYPE_LENGTH (type);
+ len = type->length ();
if (type->code () == TYPE_CODE_FLT)
{
{
struct value *val = args[jj];
- space += align_up (TYPE_LENGTH (value_type (val)), 4);
+ space += align_up (value_type (val)->length (), 4);
}
/* Add location required for the rest of the parameters. */
arg = args[argno];
type = check_typedef (value_type (arg));
- len = TYPE_LENGTH (type);
+ len = type->length ();
/* Float types should be passed in fpr's, as well as in the
/* AltiVec extension: Functions that declare a vector data type as a
return value place that return value in VR2. */
if (valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector ()
- && TYPE_LENGTH (valtype) == 16)
+ && valtype->length () == 16)
{
if (readbuf)
regcache->cooked_read (tdep->ppc_vr0_regnum + 2, readbuf);
complex*8 and complex*16 are returned in FPR1:FPR2, and
complex*32 is returned in FPR1:FPR4. */
if (valtype->code () == TYPE_CODE_FLT
- && (TYPE_LENGTH (valtype) == 4 || TYPE_LENGTH (valtype) == 8))
+ && (valtype->length () == 4 || valtype->length () == 8))
{
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
gdb_byte regval[8];
lengths less than or equal to 32 bits, must be returned right
justified in GPR3 with signed values sign extended and unsigned
values zero extended, as necessary. */
- if (TYPE_LENGTH (valtype) <= tdep->wordsize)
+ if (valtype->length () <= tdep->wordsize)
{
if (readbuf)
{
/* For reading we don't have to worry about sign extension. */
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
®val);
- store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), byte_order,
+ store_unsigned_integer (readbuf, valtype->length (), byte_order,
regval);
}
if (writebuf)
/* Eight-byte non-floating-point scalar values must be returned in
GPR3:GPR4. */
- if (TYPE_LENGTH (valtype) == 8)
+ if (valtype->length () == 8)
{
gdb_assert (valtype->code () != TYPE_CODE_FLT);
gdb_assert (tdep->wordsize == 4);
&& regnum >= tdep->ppc_fp0_regnum
&& regnum < tdep->ppc_fp0_regnum + ppc_num_fprs
&& type->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (type)
- != TYPE_LENGTH (builtin_type (gdbarch)->builtin_double));
+ && (type->length ()
+ != builtin_type (gdbarch)->builtin_double->length ()));
}
static int
{
return (type->code () == TYPE_CODE_INT
&& type->is_unsigned ()
- && TYPE_LENGTH (type) == 1);
+ && type->length () == 1);
}
/* Return true if TYPE is a Rust character type. */
rust_chartype_p (struct type *type)
{
return (type->code () == TYPE_CODE_CHAR
- && TYPE_LENGTH (type) == 4
+ && type->length () == 4
&& type->is_unsigned ());
}
gdb_assert (rust_enum_p (type));
gdb::array_view<const gdb_byte> view
(value_contents_for_printing (val).data (),
- TYPE_LENGTH (value_type (val)));
+ value_type (val)->length ());
type = resolve_dynamic_type (type, view, value_address (val));
if (rust_empty_enum_p (type))
case TYPE_CODE_INT:
/* Recognize the unit type. */
- if (type->is_unsigned () && TYPE_LENGTH (type) == 0
+ if (type->is_unsigned () && type->length () == 0
&& type->name () != NULL && strcmp (type->name (), "()") == 0)
{
gdb_puts ("()", stream);
struct field *field = &result->field (i);
field->set_loc_bitpos (bitpos);
- bitpos += TYPE_LENGTH (type1) * TARGET_CHAR_BIT;
+ bitpos += type1->length () * TARGET_CHAR_BIT;
field->set_name (field1);
field->set_type (type1);
if (i > 0)
result->set_length (result->field (i - 1).loc_bitpos () / TARGET_CHAR_BIT
- + TYPE_LENGTH (result->field (i - 1).type ()));
+ + result->field (i - 1).type ()->length ());
return result;
}
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (range_type, lval_memory);
- addrval = value_allocate_space_in_inferior (TYPE_LENGTH (range_type));
+ addrval = value_allocate_space_in_inferior (range_type->length ());
addr = value_as_long (addrval);
result = value_at_lazy (range_type, addr);
slice = rust_slice_type (new_name, value_type (result), usize);
- addrval = value_allocate_space_in_inferior (TYPE_LENGTH (slice));
+ addrval = value_allocate_space_in_inferior (slice->length ());
addr = value_as_long (addrval);
tem = value_at_lazy (slice, addr);
if (noside == EVAL_NORMAL)
{
- addrval = value_allocate_space_in_inferior (TYPE_LENGTH (type));
+ addrval = value_allocate_space_in_inferior (type->length ());
addr = value_as_long (addrval);
result = value_at_lazy (type, addr);
}
add (arch_integer_type (gdbarch, 64, 0, "i64"));
add (arch_integer_type (gdbarch, 64, 1, "u64"));
- unsigned int length = 8 * TYPE_LENGTH (builtin->builtin_data_ptr);
+ unsigned int length = 8 * builtin->builtin_data_ptr->length ();
add (arch_integer_type (gdbarch, length, 0, "isize"));
struct type *usize_type
= add (arch_integer_type (gdbarch, length, 1, "usize"));
gdb_assert (return_type->code () == TYPE_CODE_STRUCT
|| func_type->code () == TYPE_CODE_UNION);
- if (TYPE_LENGTH (return_type) > 16
- || TYPE_LENGTH (return_type) % 4 != 0)
+ if (return_type->length () > 16
+ || return_type->length () % 4 != 0)
{
if (write_pass)
regcache_cooked_write_unsigned (regcache, RX_R15_REGNUM,
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 ();
if (i == 0 && struct_addr != 0
&& return_method != return_method_struct
{
struct type *p_arg_type =
func_type->field (i).type ();
- p_arg_size = TYPE_LENGTH (p_arg_type);
+ p_arg_size = p_arg_type->length ();
}
sp_off = align_up (sp_off, p_arg_size);
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- ULONGEST valtype_len = TYPE_LENGTH (valtype);
+ ULONGEST valtype_len = valtype->length ();
- if (TYPE_LENGTH (valtype) > 16
+ if (valtype->length () > 16
|| ((valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION)
- && TYPE_LENGTH (valtype) % 4 != 0))
+ && valtype->length () % 4 != 0))
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)
{
int reg = -1;
- switch (TYPE_LENGTH (type))
+ switch (type->length ())
{
case 0: /* Nothing to do */
return;
if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ARRAY
- || TYPE_LENGTH (type) > 4)
+ || type->length () > 4)
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)
{
t = check_typedef (t);
- if (TYPE_LENGTH (t) > 8)
+ if (t->length () > 8)
{
switch (t->code ())
{
check_typedef (type);
if ((regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM
- && TYPE_LENGTH (type) < 8)
+ && type->length () < 8)
|| regnum_is_vxr_full (tdep, regnum)
|| (regnum >= S390_V16_REGNUM && regnum <= S390_V31_REGNUM))
set_value_offset (value, 0);
if (inner == NULL)
break;
inner = check_typedef (inner);
- if (TYPE_LENGTH (inner) < min_size)
+ if (inner->length () < min_size)
break;
type = inner;
}
{
/* Note that long double as well as complex types are intentionally
excluded. */
- if (TYPE_LENGTH (type) > 8)
+ if (type->length () > 8)
return 0;
/* A struct containing just a float or double is passed like a float
static int
s390_function_arg_vector (struct type *type)
{
- if (TYPE_LENGTH (type) > 16)
+ if (type->length () > 16)
return 0;
/* Structs containing just a vector are passed like a vector. */
- type = s390_effective_inner_type (type, TYPE_LENGTH (type));
+ type = s390_effective_inner_type (type, type->length ());
return type->code () == TYPE_CODE_ARRAY && type->is_vector ();
}
{
enum type_code code = type->code ();
- if (TYPE_LENGTH (type) > 8)
+ if (type->length () > 8)
return 0;
if (code == TYPE_CODE_INT
return 1;
return ((code == TYPE_CODE_UNION || code == TYPE_CODE_STRUCT)
- && is_power_of_two (TYPE_LENGTH (type)));
+ && is_power_of_two (type->length ()));
}
/* Argument passing state: Internal data structure passed to helper
enum bfd_endian byte_order, int is_unnamed)
{
struct type *type = check_typedef (value_type (arg));
- unsigned int length = TYPE_LENGTH (type);
+ unsigned int length = type->length ();
int write_mode = as->regcache != NULL;
if (s390_function_arg_float (type))
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
- int length = TYPE_LENGTH (type);
+ int length = type->length ();
int code = type->code ();
if (code == TYPE_CODE_FLT || code == TYPE_CODE_DECFLOAT)
{
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
rvc = (tdep->vector_abi == S390_VECTOR_ABI_128
- && TYPE_LENGTH (type) <= 16 && type->is_vector ())
+ && type->length () <= 16 && type->is_vector ())
? RETURN_VALUE_REGISTER_CONVENTION
: RETURN_VALUE_STRUCT_CONVENTION;
break;
}
default:
- rvc = TYPE_LENGTH (type) <= 8
+ rvc = type->length () <= 8
? RETURN_VALUE_REGISTER_CONVENTION
: RETURN_VALUE_STRUCT_CONVENTION;
}
{
LONGEST pswa = value_as_long (val);
- if (TYPE_LENGTH (type) == 4)
+ if (type->length () == 4)
return value_from_pointer (type, pswa & 0x7fffffff);
else
return value_from_pointer (type, pswa);
{
LONGEST pswm = value_as_long (val);
- if (TYPE_LENGTH (type) == 4)
+ if (type->length () == 4)
return value_from_longest (type, (pswm >> 12) & 3);
else
return value_from_longest (type, (pswm >> 44) & 3);
static int
sh_use_struct_convention (int renesas_abi, struct type *type)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int nelem = type->num_fields ();
/* The Renesas ABI returns aggregate types always on stack. */
/* If the first field in the aggregate has the same length as the entire
aggregate type, the type is returned in registers. */
- if (TYPE_LENGTH (type->field (0).type ()) == len)
+ if (type->field (0).type ()->length () == len)
return 0;
/* If the size of the aggregate is 8 bytes and the first field is
of size 4 bytes its alignment is equal to long long's alignment,
so it's returned in registers. */
- if (len == 8 && TYPE_LENGTH (type->field (0).type ()) == 4)
+ if (len == 8 && type->field (0).type ()->length () == 4)
return 0;
/* Otherwise use struct convention. */
sh_use_struct_convention_nofpu (int renesas_abi, struct type *type)
{
/* The Renesas ABI returns long longs/doubles etc. always on stack. */
- if (renesas_abi && type->num_fields () == 0 && TYPE_LENGTH (type) >= 8)
+ if (renesas_abi && type->num_fields () == 0 && type->length () >= 8)
return 1;
return sh_use_struct_convention (renesas_abi, type);
}
{
int stack_alloc = 0;
while (nargs-- > 0)
- stack_alloc += ((TYPE_LENGTH (value_type (args[nargs])) + 3) & ~3);
+ stack_alloc += ((value_type (args[nargs])->length () + 3) & ~3);
return stack_alloc;
}
for (argnum = 0; argnum < nargs; argnum++)
{
type = value_type (args[argnum]);
- len = TYPE_LENGTH (type);
+ len = type->length ();
val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
/* Some decisions have to be made how various types are handled.
and then proceeds as normal by writing the second 32 bits
into the next register. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE
- && TYPE_LENGTH (type) == 2 * reg_size)
+ && type->length () == 2 * reg_size)
{
regcache_cooked_write_unsigned (regcache, flt_argreg + 1,
regval);
for (argnum = 0; argnum < nargs; argnum++)
{
type = value_type (args[argnum]);
- len = TYPE_LENGTH (type);
+ len = type->length ();
val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
/* Some decisions have to be made how various types are handled.
{
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)
{
struct gdbarch *gdbarch = regcache->arch ();
if (sh_treat_as_flt_p (type))
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int i, regnum = gdbarch_fp0_regnum (gdbarch);
for (i = 0; i < len; i += 4)
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
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)
{
struct gdbarch *gdbarch = regcache->arch ();
if (sh_treat_as_flt_p (type))
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int i, regnum = gdbarch_fp0_regnum (gdbarch);
for (i = 0; i < len; i += 4)
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
/* The structure has 4 fields: version (4 bytes), count (4 bytes),
info (pointer) and notifier (pointer). */
- len = 4 + 4 + 2 * TYPE_LENGTH (ptr_type);
+ len = 4 + 4 + 2 * ptr_type->length ();
gdb_assert (len <= sizeof (buf));
memset (&info->all_image, 0, sizeof (info->all_image));
info->all_image.count = extract_unsigned_integer (buf + 4, 4, byte_order);
info->all_image.info = extract_typed_address (buf + 8, ptr_type);
info->all_image.notifier = extract_typed_address
- (buf + 8 + TYPE_LENGTH (ptr_type), ptr_type);
+ (buf + 8 + ptr_type->length (), ptr_type);
}
/* Link map info to include in an allocated so_list entry. */
{
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
enum bfd_endian byte_order = type_byte_order (ptr_type);
- int ptr_len = TYPE_LENGTH (ptr_type);
+ int ptr_len = ptr_type->length ();
unsigned int image_info_size;
struct so_list *head = NULL;
struct so_list *tail = NULL;
darwin_read_exec_load_addr_from_dyld (struct darwin_info *info)
{
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
- int ptr_len = TYPE_LENGTH (ptr_type);
+ int ptr_len = ptr_type->length ();
unsigned int image_info_size = ptr_len * 3;
int i;
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
/* Sanity check. */
- if (TYPE_LENGTH (ptr_type) > sizeof (buf))
+ if (ptr_type->length () > sizeof (buf))
return;
len = target_read (current_inferior ()->top_target (),
TARGET_OBJECT_DARWIN_DYLD_INFO,
- NULL, buf, 0, TYPE_LENGTH (ptr_type));
+ NULL, buf, 0, ptr_type->length ());
if (len <= 0)
return;
{
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
gdb_byte *pbuf;
- int pbuf_size = TYPE_LENGTH (ptr_type);
+ int pbuf_size = ptr_type->length ();
pbuf = (gdb_byte *) alloca (pbuf_size);
/* DT_MIPS_RLD_MAP contains a pointer to the address
{
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
gdb_byte *pbuf;
- int pbuf_size = TYPE_LENGTH (ptr_type);
+ int pbuf_size = ptr_type->length ();
pbuf = (gdb_byte *) alloca (pbuf_size);
/* DT_MIPS_RLD_MAP_REL contains an offset from the address of the
CORE_ADDR lm, l_name;
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
- int l_name_size = TYPE_LENGTH (ptr_type);
+ int l_name_size = ptr_type->length ();
gdb::byte_vector l_name_buf (l_name_size);
struct svr4_info *info = get_svr4_info (current_program_space);
symfile_add_flags add_flags = 0;
static int
sparc_integral_or_pointer_p (const struct type *type)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
switch (type->code ())
{
{
case TYPE_CODE_FLT:
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
return (len == 4 || len == 8 || len == 16);
}
default:
{
case TYPE_CODE_COMPLEX:
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
return (len == 8 || len == 16 || len == 32);
}
default:
return true;
/* Integer vectors are returned by memory if the vector size
is greater than 8 bytes long. */
- return (TYPE_LENGTH (type) > 8);
+ return (type->length () > 8);
}
if (sparc_floating_p (type))
{
/* Floating point types are passed by register for size 4 and
8 bytes, and by memory for size 16 bytes. */
- return (TYPE_LENGTH (type) == 16);
+ return (type->length () == 16);
}
/* Other than that, only aggregates of all sizes get returned by
return true;
/* Integer vectors are passed by memory if the vector size
is greater than 8 bytes long. */
- return (TYPE_LENGTH (type) > 8);
+ return (type->length () > 8);
}
/* Floats are passed by register for size 4 and 8 bytes, and by memory
for size 16 bytes. */
if (sparc_floating_p (type))
- return (TYPE_LENGTH (type) == 16);
+ return (type->length () == 16);
/* Complex floats and aggregates of all sizes are passed by memory. */
if (sparc_complex_floating_p (type) || sparc_structure_or_union_p (type))
/* This is an UNIMP instruction. */
store_unsigned_integer (buf, 4, byte_order,
- TYPE_LENGTH (value_type) & 0x1fff);
+ value_type->length () & 0x1fff);
write_memory (sp - 8, buf, 4);
return sp - 8;
}
for (i = 0; i < nargs; i++)
{
struct type *type = value_type (args[i]);
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
if (sparc_arg_by_memory_p (type))
{
{
const bfd_byte *valbuf = value_contents (args[i]).data ();
struct type *type = value_type (args[i]);
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_byte buf[4];
if (len < 4)
{
type = check_typedef (type->target_type ());
if (sparc_structure_or_union_p (type)
- || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16))
+ || (sparc_floating_p (type) && type->length () == 16))
return 1;
}
sparc32_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_byte buf[32];
gdb_assert (!sparc_structure_return_p (type));
sparc32_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[32];
gdb_assert (!sparc_structure_return_p (type));
{
regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp);
addr = read_memory_unsigned_integer (sp + 64, 4, byte_order);
- read_memory (addr, readbuf, TYPE_LENGTH (type));
+ read_memory (addr, readbuf, type->length ());
}
if (writebuf)
{
regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp);
addr = read_memory_unsigned_integer (sp + 64, 4, byte_order);
- write_memory (addr, writebuf, TYPE_LENGTH (type));
+ write_memory (addr, writebuf, type->length ());
}
return RETURN_VALUE_ABI_PRESERVES_ADDRESS;
sparc32_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
{
return (sparc_structure_or_union_p (type)
- || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16)
+ || (sparc_floating_p (type) && type->length () == 16)
|| sparc_complex_floating_p (type));
}
case TYPE_CODE_ENUM:
case TYPE_CODE_RANGE:
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_assert (len == 1 || len == 2 || len == 4 || len == 8);
}
return 1;
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_assert (len == 8);
}
return 1;
{
case TYPE_CODE_FLT:
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_assert (len == 4 || len == 8 || len == 16);
}
return 1;
{
case TYPE_CODE_COMPLEX:
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_assert (len == 8 || len == 16 || len == 32);
}
return 1;
if (sparc64_floating_p (t))
return 1;
}
- if (sparc64_floating_p (type) && TYPE_LENGTH (type) == 16)
+ if (sparc64_floating_p (type) && type->length () == 16)
return 1;
if (sparc64_structure_or_union_p (type))
const gdb_byte *valbuf, int element, int bitpos)
{
struct gdbarch *gdbarch = regcache->arch ();
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_assert (element < 16);
{
struct type *subtype = check_typedef (type->field (0).type ());
- if (sparc64_floating_p (subtype) && TYPE_LENGTH (subtype) == 4)
+ if (sparc64_floating_p (subtype) && subtype->length () == 4)
regcache->cooked_write (SPARC_F1_REGNUM, valbuf);
}
}
if (type->code () == TYPE_CODE_ARRAY)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int regnum = SPARC_F0_REGNUM + bitpos / 32;
valbuf += bitpos / 8;
}
else if (sparc64_floating_p (type))
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int regnum;
if (len == 16)
for (i = 0; i < nargs; i++)
{
struct type *type = value_type (args[i]);
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
if (sparc64_structure_or_union_p (type)
|| (sparc64_complex_floating_p (type) && len == 32))
{
const gdb_byte *valbuf = value_contents (args[i]).data ();
struct type *type = value_type (args[i]);
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int regnum = -1;
gdb_byte buf[16];
sparc64_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_byte buf[32];
int i;
sparc64_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[16];
int i;
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- if (TYPE_LENGTH (type) > 32)
+ if (type->length () > 32)
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)
dbl_type = objfile_type (objfile)->builtin_double;
dbl_valu
= (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
- TYPE_LENGTH (dbl_type));
+ dbl_type->length ());
target_float_from_string (dbl_valu, dbl_type, std::string (p));
{
/* If PCC says a parameter is a short or a char, it is
really an int. */
- if (TYPE_LENGTH (sym->type ())
+ if (sym->type ()->length ()
< gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT
&& sym->type ()->code () == TYPE_CODE_INT)
{
FIELD_BITSIZE (fip->list->field) = 0;
}
if ((FIELD_BITSIZE (fip->list->field)
- == TARGET_CHAR_BIT * TYPE_LENGTH (field_type)
+ == TARGET_CHAR_BIT * field_type->length ()
|| (field_type->code () == TYPE_CODE_ENUM
&& FIELD_BITSIZE (fip->list->field)
== gdbarch_int_bit (gdbarch))
while (ntype != type)
{
- if (TYPE_LENGTH(ntype) == 0)
- ntype->set_length (TYPE_LENGTH (type));
+ if (ntype->length () == 0)
+ ntype->set_length (type->length ());
else
complain_about_struct_wipeout (ntype);
ntype = TYPE_CHAIN (ntype);
if (value_lazy (entryval))
value_fetch_lazy (entryval);
- if (value_contents_eq (val, 0, entryval, 0, TYPE_LENGTH (type)))
+ if (value_contents_eq (val, 0, entryval, 0, type->length ()))
{
/* Initialize it just to avoid a GCC false warning. */
struct value *val_deref = NULL, *entryval_deref;
if (val != val_deref
&& value_contents_eq (val_deref, 0,
entryval_deref, 0,
- TYPE_LENGTH (type_deref)))
+ type_deref->length ()))
val_equal = 1;
}
catch (const gdb_exception_error &except)
case LOC_REF_ARG:
{
long current_offset = sym->value_longest ();
- int arg_size = TYPE_LENGTH (sym->type ());
+ int arg_size = sym->type ()->length ();
/* Compute address of next argument by adding the size of
this argument and rounding to an int boundary. */
ULONGEST value;
/* Swallow errors. */
- if (target_read_memory (address, bytes, TYPE_LENGTH (type)) != 0)
+ if (target_read_memory (address, bytes, type->length ()) != 0)
{
warning (_("Could not read the value of a SystemTap semaphore."));
return;
}
enum bfd_endian byte_order = type_byte_order (type);
- value = extract_unsigned_integer (bytes, TYPE_LENGTH (type), byte_order);
+ value = extract_unsigned_integer (bytes, type->length (), byte_order);
/* Note that we explicitly don't worry about overflow or
underflow. */
if (set)
else
--value;
- store_unsigned_integer (bytes, TYPE_LENGTH (type), byte_order, value);
+ store_unsigned_integer (bytes, type->length (), byte_order, value);
- if (target_write_memory (address, bytes, TYPE_LENGTH (type)) != 0)
+ if (target_write_memory (address, bytes, type->length ()) != 0)
warning (_("Could not write the value of a SystemTap semaphore."));
}
struct type *type = check_typedef (symbol->type ());
gdb_printf (outfile, "const %s hex bytes:",
- pulongest (TYPE_LENGTH (type)));
- for (i = 0; i < TYPE_LENGTH (type); i++)
+ pulongest (type->length ()));
+ for (i = 0; i < type->length (); i++)
gdb_printf (outfile, " %02x",
(unsigned) symbol->value_bytes ()[i]);
}
const T *from, gdb_byte *to) const
{
/* Ensure possible padding bytes in the target buffer are zeroed out. */
- memset (to, 0, TYPE_LENGTH (type));
+ memset (to, 0, type->length ());
to_target (floatformat_from_type (type), from, to);
}
const gdb_mpfr &from, gdb_byte *to) const
{
/* Ensure possible padding bytes in the target buffer are zeroed out. */
- memset (to, 0, TYPE_LENGTH (type));
+ memset (to, 0, type->length ());
to_target (floatformat_from_type (type), from, to);
}
{
gdb_assert (type->code () == TYPE_CODE_DECFLOAT);
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int i;
#if WORDS_BIGENDIAN
{
gdb_assert (type->code () == TYPE_CODE_DECFLOAT);
- switch (TYPE_LENGTH (type))
+ switch (type->length ())
{
case 4:
decContextDefault (ctx, DEC_INIT_DECIMAL32);
set_decnumber_context (&set, type);
- switch (TYPE_LENGTH (type))
+ switch (type->length ())
{
case 4:
decimal32FromNumber ((decimal32 *) dec, from, &set);
gdb_byte dec[16];
match_endianness (addr, type, dec);
- switch (TYPE_LENGTH (type))
+ switch (type->length ())
{
case 4:
decimal32ToNumber ((decimal32 *) dec, to);
std::string result;
result.resize (MAX_DECIMAL_STRING);
- switch (TYPE_LENGTH (type))
+ switch (type->length ())
{
case 4:
decimal32ToString ((decimal32 *) dec, &result[0]);
set_decnumber_context (&set, type);
- switch (TYPE_LENGTH (type))
+ switch (type->length ())
{
case 4:
decimal32FromString ((decimal32 *) dec, string.c_str (), &set);
decimal_to_number (y, type_y, &number2);
/* Perform the comparison in the larger of the two sizes. */
- type_result = TYPE_LENGTH (type_x) > TYPE_LENGTH (type_y) ? type_x : type_y;
+ type_result = type_x->length () > type_y->length () ? type_x : type_y;
set_decnumber_context (&set, type_result);
decNumberCompare (&result, &number1, &number2, &set);
return floatformat_from_type (type1) == floatformat_from_type (type2);
case TYPE_CODE_DECFLOAT:
- return (TYPE_LENGTH (type1) == TYPE_LENGTH (type2)
+ return (type1->length () == type2->length ()
&& (type_byte_order (type1)
== type_byte_order (type2)));
return floatformat_totalsize_bytes (floatformat_from_type (type));
case TYPE_CODE_DECFLOAT:
- return TYPE_LENGTH (type);
+ return type->length ();
default:
gdb_assert_not_reached ("unexpected type code");
/* The floating-point formats match, so we simply copy the data, ensuring
possible padding bytes in the target buffer are zeroed out. */
- memset (to, 0, TYPE_LENGTH (to_type));
+ memset (to, 0, to_type->length ());
memcpy (to, from, target_float_format_length (to_type));
}
tic6x_extract_return_value (struct type *valtype, struct regcache *regcache,
enum bfd_endian byte_order, gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (valtype);
+ int len = valtype->length ();
/* pointer types are returned in register A4,
up to 32-bit types in A4
tic6x_store_return_value (struct type *valtype, struct regcache *regcache,
enum bfd_endian byte_order, const gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (valtype);
+ int len = valtype->length ();
/* return values of up to 8 bytes are returned in A5:A4 */
}
}
- if (TYPE_LENGTH (type) > 8)
+ if (type->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)
static int
tic6x_arg_type_alignment (struct type *type)
{
- int len = TYPE_LENGTH (check_typedef (type));
+ int len = check_typedef (type)->length ();
enum type_code typecode = check_typedef (type)->code ();
if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
{
- int len = align_up (TYPE_LENGTH (value_type (args[argnum])), 4);
+ int len = align_up (value_type (args[argnum])->length (), 4);
if (argnum >= 10 - argreg)
references_offset += len;
stack_offset += len;
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 ();
val = value_contents (arg).data ();
/* Only scalars which fit in R0 - R9 can be returned in registers.
Otherwise, they are returned via a pointer passed in R0. */
return (!tilegx_type_is_scalar (type)
- && (TYPE_LENGTH (type) > (1 + TILEGX_R9_REGNUM - TILEGX_R0_REGNUM)
+ && (type->length () > (1 + TILEGX_R9_REGNUM - TILEGX_R0_REGNUM)
* tilegx_reg_size));
}
tilegx_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int i, regnum = TILEGX_R0_REGNUM;
for (i = 0; i < len; i += tilegx_reg_size)
tilegx_store_return_value (struct type *type, struct regcache *regcache,
const void *valbuf)
{
- if (TYPE_LENGTH (type) < tilegx_reg_size)
+ if (type->length () < tilegx_reg_size)
{
/* Add leading zeros to the (little-endian) value. */
gdb_byte buf[tilegx_reg_size] = { 0 };
- memcpy (buf, valbuf, TYPE_LENGTH (type));
+ memcpy (buf, valbuf, type->length ());
regcache->raw_write (TILEGX_R0_REGNUM, buf);
}
else
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int i, regnum = TILEGX_R0_REGNUM;
for (i = 0; i < len; i += tilegx_reg_size)
for (i = 0; i < nargs && argreg <= TILEGX_R9_REGNUM; i++)
{
const gdb_byte *val;
- typelen = TYPE_LENGTH (value_enclosing_type (args[i]));
+ typelen = value_enclosing_type (args[i])->length ();
if (typelen > (TILEGX_R9_REGNUM - argreg + 1) * tilegx_reg_size)
break;
{
const gdb_byte *contents = value_contents (args[j]).data ();
- typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
+ typelen = value_enclosing_type (args[j])->length ();
slacklen = align_up (typelen, 8) - typelen;
gdb::byte_vector val (typelen + slacklen);
memcpy (val.data (), contents, typelen);
bfd_signed_vma offset;
int treat_as_expr = 0;
- len = TYPE_LENGTH (check_typedef (sym->type ()));
+ len = check_typedef (sym->type ())->length ();
switch (sym->aclass ())
{
default:
check_typedef (type);
collect->add_memrange (target_gdbarch (),
memrange_absolute, addr,
- TYPE_LENGTH (type),
+ type->length (),
tloc->address);
collect->append_exp (std::string (exp_start,
action_exp));
case LOC_CONST_BYTES:
gdb_printf ("constant bytes: ");
if (sym->type ())
- for (j = 0; j < TYPE_LENGTH (sym->type ()); j++)
+ for (j = 0; j < sym->type ()->length (); j++)
gdb_printf (" %02x", (unsigned) sym->value_bytes ()[j]);
break;
case LOC_STATIC:
{
struct type *t = check_typedef (sym->type ());
- gdb_printf (", length %s.\n", pulongest (TYPE_LENGTH (t)));
+ gdb_printf (", length %s.\n", pulongest (t->length ()));
}
}
if (block->function ())
print their sizes. */
gdb_printf (stream, "/* %6s */",
(print_in_hex ?
- hex_string_custom (TYPE_LENGTH (ftype), 4) :
- pulongest (TYPE_LENGTH (ftype))));
+ hex_string_custom (ftype->length (), 4) :
+ pulongest (ftype->length ())));
return;
}
unsigned int bitpos = type->field (field_idx).loc_bitpos ();
- unsigned int fieldsize_byte = TYPE_LENGTH (ftype);
+ unsigned int fieldsize_byte = ftype->length ();
unsigned int fieldsize_bit = fieldsize_byte * TARGET_CHAR_BIT;
maybe_print_hole (stream, bitpos, "hole");
print_offset_data::finish (struct type *type, int level,
struct ui_file *stream)
{
- unsigned int bitpos = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
+ unsigned int bitpos = type->length () * TARGET_CHAR_BIT;
maybe_print_hole (stream, bitpos, "padding");
gdb_puts ("\n", stream);
print_spaces (level + 4 + print_offset_data::indentation, stream);
gdb_printf (stream, "/* total size (bytes): %4s */\n",
- pulongest (TYPE_LENGTH (type)));
+ pulongest (type->length ()));
}
\f
std::string small_img = type->fixed_point_scaling_factor ().str ();
gdb_printf (stream, "%s-byte fixed point (small = %s)",
- pulongest (TYPE_LENGTH (type)), small_img.c_str ());
+ pulongest (type->length ()), small_img.c_str ());
}
/* Dump details of a type specified either directly or indirectly.
if (tdep->abi == V850_ABI_RH850)
{
- if (v850_type_is_scalar (type) && TYPE_LENGTH(type) <= 8)
+ if (v850_type_is_scalar (type) && type->length () <= 8)
return 0;
/* Structs are never returned in registers for this ABI. */
return 1;
}
/* 1. The value is greater than 8 bytes -> returned by copying. */
- if (TYPE_LENGTH (type) > 8)
+ if (type->length () > 8)
return 1;
/* 2. The value is a single basic type -> returned in register. */
&& type->num_fields () == 1)
{
fld_type = type->field (0).type ();
- if (v850_type_is_scalar (fld_type) && TYPE_LENGTH (fld_type) >= 4)
+ if (v850_type_is_scalar (fld_type) && fld_type->length () >= 4)
return 0;
if (fld_type->code () == TYPE_CODE_ARRAY)
{
tgt_type = fld_type->target_type ();
- if (v850_type_is_scalar (tgt_type) && TYPE_LENGTH (tgt_type) >= 4)
+ if (v850_type_is_scalar (tgt_type) && tgt_type->length () >= 4)
return 0;
}
}
register. */
if (type->code () == TYPE_CODE_STRUCT
&& v850_type_is_scalar (type->field (0).type ())
- && TYPE_LENGTH (type->field (0).type ()) == 4)
+ && type->field (0).type ()->length () == 4)
{
for (i = 1; i < type->num_fields (); ++i)
{
if (fld_type->code () == TYPE_CODE_ARRAY)
{
tgt_type = fld_type->target_type ();
- if (TYPE_LENGTH (tgt_type) > 0
- && TYPE_LENGTH (fld_type) / TYPE_LENGTH (tgt_type) > 2)
+ if (tgt_type->length () > 0
+ && fld_type->length () / tgt_type->length () > 2)
return 1;
}
}
type = check_typedef (type);
if (v850_type_is_scalar (type))
- return (TYPE_LENGTH (type) == 8);
+ return (type->length () == 8);
else
{
int i;
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
- arg_space += ((TYPE_LENGTH (value_type (args[argnum])) + 3) & ~3);
+ arg_space += ((value_type (args[argnum])->length () + 3) & ~3);
sp -= arg_space + stack_offset;
argreg = E_ARG0_REGNUM;
if (!v850_type_is_scalar (value_type (*args))
&& tdep->abi == V850_ABI_GCC
- && TYPE_LENGTH (value_type (*args)) > E_MAX_RETTYPE_SIZE_IN_REGS)
+ && value_type (*args)->length () > E_MAX_RETTYPE_SIZE_IN_REGS)
{
store_unsigned_integer (valbuf, 4, byte_order,
value_address (*args));
}
else
{
- len = TYPE_LENGTH (value_type (*args));
+ len = value_type (*args)->length ();
val = (gdb_byte *) value_contents (*args).data ();
}
{
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 <= v850_reg_size)
{
{
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 <= v850_reg_size)
regcache_cooked_write_unsigned
gdb_assert (type1->code () == TYPE_CODE_PTR);
gdb_assert (type2->code () == TYPE_CODE_PTR);
- if (TYPE_LENGTH (check_typedef (type1->target_type ()))
- != TYPE_LENGTH (check_typedef (type2->target_type ())))
+ if (check_typedef (type1->target_type ())->length ()
+ != check_typedef (type2->target_type ())->length ())
error (_("First argument of `-' is a pointer and "
"second argument is neither\n"
"an integer nor a pointer of the same type."));
if (is_floating_type (type1))
{
*eff_type_x = type1;
- memcpy (x, value_contents (arg1).data (), TYPE_LENGTH (type1));
+ memcpy (x, value_contents (arg1).data (), type1->length ());
}
else if (is_integral_type (type1))
{
if (is_floating_type (type2))
{
*eff_type_y = type2;
- memcpy (y, value_contents (arg2).data (), TYPE_LENGTH (type2));
+ memcpy (y, value_contents (arg2).data (), type2->length ());
}
else if (is_integral_type (type2))
{
result_type = type2;
else if (!is_floating_type (type2))
result_type = type1;
- else if (TYPE_LENGTH (type2) > TYPE_LENGTH (type1))
+ else if (type2->length () > type1->length ())
result_type = type2;
else
result_type = type1;
else
{
/* Integer types. */
- if (TYPE_LENGTH (type1) > TYPE_LENGTH (type2))
+ if (type1->length () > type2->length ())
result_type = type1;
- else if (TYPE_LENGTH (type2) > TYPE_LENGTH (type1))
+ else if (type2->length () > type1->length ())
result_type = type2;
else if (type1->is_unsigned ())
result_type = type1;
type_length_bits (type *type)
{
int unit_size = gdbarch_addressable_memory_unit_size (type->arch ());
- return unit_size * 8 * TYPE_LENGTH (type);
+ return unit_size * 8 * type->length ();
}
/* Check whether the RHS value of a shift is valid in C/C++ semantics.
struct type *eff_type_v1, *eff_type_v2;
gdb::byte_vector v1, v2;
- v1.resize (TYPE_LENGTH (result_type));
- v2.resize (TYPE_LENGTH (result_type));
+ v1.resize (result_type->length ());
+ v2.resize (result_type->length ());
value_args_as_target_float (arg1, arg2,
v1.data (), &eff_type_v1,
val = allocate_value (result_type);
store_signed_integer (value_contents_raw (val).data (),
- TYPE_LENGTH (result_type),
+ result_type->length (),
type_byte_order (result_type),
v);
}
val = allocate_value (result_type);
store_unsigned_integer (value_contents_raw (val).data (),
- TYPE_LENGTH (value_type (val)),
+ value_type (val)->length (),
type_byte_order (result_type),
v);
}
val = allocate_value (result_type);
store_signed_integer (value_contents_raw (val).data (),
- TYPE_LENGTH (value_type (val)),
+ value_type (val)->length (),
type_byte_order (result_type),
v);
}
/* If we reduced the length of the scalar then check we didn't loose any
important bits. */
- if (TYPE_LENGTH (eltype) < TYPE_LENGTH (scalar_type)
+ if (eltype->length () < scalar_type->length ()
&& !value_equal (elval, scalar_value))
error (_("conversion of scalar to vector involves truncation"));
value *val = allocate_value (vector_type);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
- int elt_len = TYPE_LENGTH (eltype);
+ int elt_len = eltype->length ();
for (i = 0; i < high_bound - low_bound + 1; i++)
/* Duplicate the contents of elval into the destination vector. */
eltype1 = check_typedef (type1->target_type ());
eltype2 = check_typedef (type2->target_type ());
- elsize = TYPE_LENGTH (eltype1);
+ elsize = eltype1->length ();
if (eltype1->code () != eltype2->code ()
- || elsize != TYPE_LENGTH (eltype2)
+ || elsize != eltype2->length ()
|| eltype1->is_unsigned () != eltype2->is_unsigned ()
|| low_bound1 != low_bound2 || high_bound1 != high_bound2)
error (_("Cannot perform operation on vectors with different types"));
if (is_floating_value (arg1))
return target_float_is_zero (value_contents (arg1).data (), type1);
- len = TYPE_LENGTH (type1);
+ len = type1->length ();
p = value_contents (arg1).data ();
while (--len >= 0)
static int
value_strcmp (struct value *arg1, struct value *arg2)
{
- int len1 = TYPE_LENGTH (value_type (arg1));
- int len2 = TYPE_LENGTH (value_type (arg2));
+ int len1 = value_type (arg1)->length ();
+ int len2 = value_type (arg2)->length ();
const gdb_byte *s1 = value_contents (arg1).data ();
const gdb_byte *s2 = value_contents (arg2).data ();
int i, len = len1 < len2 ? len1 : len2;
{
struct type *eff_type_v1, *eff_type_v2;
gdb::byte_vector v1, v2;
- v1.resize (std::max (TYPE_LENGTH (type1), TYPE_LENGTH (type2)));
- v2.resize (std::max (TYPE_LENGTH (type1), TYPE_LENGTH (type2)));
+ v1.resize (std::max (type1->length (), type2->length ()));
+ v2.resize (std::max (type1->length (), type2->length ()));
value_args_as_target_float (arg1, arg2,
v1.data (), &eff_type_v1,
return (CORE_ADDR) value_as_long (arg1) == value_as_address (arg2);
else if (code1 == code2
- && ((len = (int) TYPE_LENGTH (type1))
- == (int) TYPE_LENGTH (type2)))
+ && ((len = (int) type1->length ())
+ == (int) type2->length ()))
{
p1 = value_contents (arg1).data ();
p2 = value_contents (arg2).data ();
type2 = check_typedef (value_type (arg2));
return (type1->code () == type2->code ()
- && TYPE_LENGTH (type1) == TYPE_LENGTH (type2)
+ && type1->length () == type2->length ()
&& memcmp (value_contents (arg1).data (),
value_contents (arg2).data (),
- TYPE_LENGTH (type1)) == 0);
+ type1->length ()) == 0);
}
/* Simulate the C operator < by returning 1
{
struct type *eff_type_v1, *eff_type_v2;
gdb::byte_vector v1, v2;
- v1.resize (std::max (TYPE_LENGTH (type1), TYPE_LENGTH (type2)));
- v2.resize (std::max (TYPE_LENGTH (type1), TYPE_LENGTH (type2)));
+ v1.resize (std::max (type1->length (), type2->length ()));
+ v2.resize (std::max (type1->length (), type2->length ()));
value_args_as_target_float (arg1, arg2,
v1.data (), &eff_type_v1,
error (_("Could not determine the vector bounds"));
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
- int elt_len = TYPE_LENGTH (eltype);
+ int elt_len = eltype->length ();
for (i = 0; i < high_bound - low_bound + 1; i++)
{
val = allocate_value (type);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
- int elt_len = TYPE_LENGTH (eltype);
+ int elt_len = eltype->length ();
for (i = 0; i < high_bound - low_bound + 1; i++)
{
if (code1 == TYPE_CODE_ARRAY)
{
struct type *element_type = type->target_type ();
- unsigned element_length = TYPE_LENGTH (check_typedef (element_type));
+ unsigned element_length = check_typedef (element_type)->length ();
if (element_length > 0 && type->bounds ()->high.kind () == PROP_UNDEFINED)
{
struct type *range_type = type->index_type ();
- int val_length = TYPE_LENGTH (type2);
+ int val_length = type2->length ();
LONGEST low_bound, high_bound, new_length;
if (!get_discrete_bounds (range_type, &low_bound, &high_bound))
|| code2 == TYPE_CODE_ENUM
|| code2 == TYPE_CODE_RANGE))
{
- /* TYPE_LENGTH (type) is the length of a pointer, but we really
+ /* type->length () is the length of a pointer, but we really
want the length of an address! -- we are really dealing with
addresses (i.e., gdb representations) not pointers (i.e.,
target representations) here.
}
else if (code1 == TYPE_CODE_ARRAY && type->is_vector ()
&& code2 == TYPE_CODE_ARRAY && type2->is_vector ()
- && TYPE_LENGTH (type) != TYPE_LENGTH (type2))
+ && type->length () != type2->length ())
error (_("Cannot convert between vector values of different sizes"));
else if (code1 == TYPE_CODE_ARRAY && type->is_vector () && scalar
- && TYPE_LENGTH (type) != TYPE_LENGTH (type2))
+ && type->length () != type2->length ())
error (_("can only cast scalar to vector of same size"));
else if (code1 == TYPE_CODE_VOID)
{
return value_zero (to_type, not_lval);
}
- else if (TYPE_LENGTH (type) == TYPE_LENGTH (type2))
+ else if (type->length () == type2->length ())
{
if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
return value_cast_pointers (to_type, arg2, 0);
if (class_types_same_p (desired_type, TYPE_BASECLASS (search_type, i)))
{
if (address + embedded_offset + offset >= arg_addr
- && address + embedded_offset + offset < arg_addr + TYPE_LENGTH (arg_type))
+ && address + embedded_offset + offset < arg_addr + arg_type->length ())
{
++result_count;
if (!*result)
val = allocate_value (type);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
- int elt_len = TYPE_LENGTH (eltype);
+ int elt_len = eltype->length ();
for (i = 0; i < high_bound - low_bound + 1; i++)
{
containing type (e.g. short or int) then do so. This
is safer for volatile bitfields mapped to hardware
registers. */
- if (changed_len < TYPE_LENGTH (type)
- && TYPE_LENGTH (type) <= (int) sizeof (LONGEST)
- && ((LONGEST) changed_addr % TYPE_LENGTH (type)) == 0)
- changed_len = TYPE_LENGTH (type);
+ if (changed_len < type->length ()
+ && type->length () <= (int) sizeof (LONGEST)
+ && ((LONGEST) changed_addr % type->length ()) == 0)
+ changed_len = type->length ();
if (changed_len > (int) sizeof (LONGEST))
error (_("Can't handle bitfields which "
if (!value_must_coerce_to_target (val))
return val;
- length = TYPE_LENGTH (check_typedef (value_type (val)));
+ length = check_typedef (value_type (val))->length ();
addr = allocate_space_in_inferior (length);
write_memory (addr, value_contents (val).data (), length);
return value_at_lazy (value_type (val), addr);
if (TYPE_IS_REFERENCE (type))
{
if (value_bits_synthetic_pointer (arg1, value_embedded_offset (arg1),
- TARGET_CHAR_BIT * TYPE_LENGTH (type)))
+ TARGET_CHAR_BIT * type->length ()))
arg1 = coerce_ref (arg1);
else
{
{
struct value *val;
int lowbound = current_language->string_lower_bound ();
- ssize_t highbound = len / TYPE_LENGTH (char_type);
+ ssize_t highbound = len / char_type->length ();
struct type *stringtype
= lookup_array_range_type (char_type, lowbound, highbound + lowbound - 1);
{
struct value *val;
int lowbound = current_language->string_lower_bound ();
- ssize_t highbound = len / TYPE_LENGTH (char_type);
+ ssize_t highbound = len / char_type->length ();
struct type *stringtype
= lookup_string_range_type (char_type, lowbound, highbound + lowbound - 1);
boffset += value_embedded_offset (arg1) + offset;
if (boffset < 0
- || boffset >= TYPE_LENGTH (value_enclosing_type (arg1)))
+ || boffset >= value_enclosing_type (arg1)->length ())
{
CORE_ADDR base_addr;
v2 = value_at_lazy (basetype, base_addr);
if (target_read_memory (base_addr,
value_contents_raw (v2).data (),
- TYPE_LENGTH (value_type (v2))) != 0)
+ value_type (v2)->length ()) != 0)
error (_("virtual baseclass botch"));
}
else
clobbered by the user program. Make sure that it
still points to a valid memory location. */
- if (offset < 0 || offset >= TYPE_LENGTH (type))
+ if (offset < 0 || offset >= type->length ())
{
CORE_ADDR address;
- gdb::byte_vector tmp (TYPE_LENGTH (baseclass));
+ gdb::byte_vector tmp (baseclass->length ());
address = value_address (*arg1p);
if (target_read_memory (address + offset,
- tmp.data (), TYPE_LENGTH (baseclass)) != 0)
+ tmp.data (), baseclass->length ()) != 0)
error (_("virtual baseclass botch"));
base_val = value_from_contents_and_address (baseclass,
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 (argp)))
+ && real_type->length () < value_enclosing_type (argp)->length ())
return argp;
/* If we have the full object, but for some reason the enclosing
{
struct type *element_type = array_type->target_type ();
LONGEST offset
- = (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type));
+ = (lowbound - lowerbound) * check_typedef (element_type)->length ();
slice_type = create_array_type (NULL,
element_type,
arg1 = value_cast (real_type, arg1);
arg2 = value_cast (real_type, arg2);
- int len = TYPE_LENGTH (real_type);
+ int len = real_type->length ();
copy (value_contents (arg1),
value_contents_raw (val).slice (0, len));
gdb_assert (type->code () == TYPE_CODE_COMPLEX);
return value_from_component (value, ttype,
- TYPE_LENGTH (check_typedef (ttype)));
+ check_typedef (ttype)->length ());
}
/* Cast a value into the appropriate complex data type. */
struct type *val_real_type = value_type (val)->target_type ();
struct value *re_val = allocate_value (val_real_type);
struct value *im_val = allocate_value (val_real_type);
- int len = TYPE_LENGTH (val_real_type);
+ int len = val_real_type->length ();
copy (value_contents (val).slice (0, len),
value_contents_raw (re_val));
{
if (value_bits_any_optimized_out (val,
TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * TYPE_LENGTH (type)))
+ TARGET_CHAR_BIT * type->length ()))
{
val_print_optimized_out (val, stream);
return 0;
}
if (value_bits_synthetic_pointer (val, TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * TYPE_LENGTH (type)))
+ TARGET_CHAR_BIT * type->length ()))
{
const int is_ref = type->code () == TYPE_CODE_REF;
int ref_is_addressable = 0;
return is_ref;
}
- if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type)))
+ if (!value_bytes_available (val, embedded_offset, type->length ()))
{
val_print_unavailable (stream);
return 0;
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;
const int value_is_synthetic
= value_bits_synthetic_pointer (original_value,
TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * TYPE_LENGTH (type));
+ TARGET_CHAR_BIT * type->length ());
const int must_coerce_ref = ((options->addressprint && value_is_synthetic)
|| options->deref_ref);
const int type_is_defined = elttype->code () != TYPE_CODE_UNDEF;
const gdb_byte *valaddr = value_contents_for_printing (val).data ();
gdb_mpf f;
- f.read_fixed_point (gdb::make_array_view (valaddr, TYPE_LENGTH (type)),
+ f.read_fixed_point (gdb::make_array_view (valaddr, type->length ()),
type_byte_order (type), type->is_unsigned (),
type->fixed_point_scaling_factor ());
- const char *fmt = TYPE_LENGTH (type) < 4 ? "%.11Fg" : "%.17Fg";
+ const char *fmt = type->length () < 4 ? "%.11Fg" : "%.17Fg";
std::string str = gmp_string_printf (fmt, f.val);
gdb_printf (stream, "%s", str.c_str ());
}
/* A scalar object that does not have all bits available can't be
printed, because all bits contribute to its representation. */
if (value_bits_any_optimized_out (val, 0,
- TARGET_CHAR_BIT * TYPE_LENGTH (type)))
+ TARGET_CHAR_BIT * type->length ()))
val_print_optimized_out (val, stream);
- else if (!value_bytes_available (val, 0, TYPE_LENGTH (type)))
+ else if (!value_bytes_available (val, 0, type->length ()))
val_print_unavailable (stream);
else
print_scalar_formatted (valaddr, type, options, size, stream);
gdb_byte *c_buf;
int need_escape = 0;
- c_buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
+ c_buf = (gdb_byte *) alloca (type->length ());
pack_long (c_buf, type, c);
- wchar_iterator iter (c_buf, TYPE_LENGTH (type), encoding, TYPE_LENGTH (type));
+ wchar_iterator iter (c_buf, type->length (), encoding, type->length ());
/* This holds the printable form of the wchar_t data. */
auto_obstack wchar_buf;
{
for (i = 0; i < num_chars; ++i)
print_wchar (chars[i], buf, buflen,
- TYPE_LENGTH (type), byte_order,
+ type->length (), byte_order,
&wchar_buf, quoter, &need_escape);
}
}
/* This handles the NUM_CHARS == 0 case as well. */
if (print_escape)
- print_wchar (gdb_WEOF, buf, buflen, TYPE_LENGTH (type),
+ print_wchar (gdb_WEOF, buf, buflen, type->length (),
byte_order, &wchar_buf, quoter, &need_escape);
}
{
enum bfd_endian byte_order = type_byte_order (type);
unsigned int i;
- int width = TYPE_LENGTH (type);
+ int width = type->length ();
int finished = 0;
struct converted_character *last;
gdb::unique_xmalloc_ptr<gdb_byte> buffer; /* Dynamically growable fetch buffer. */
struct gdbarch *gdbarch = elttype->arch ();
enum bfd_endian byte_order = type_byte_order (elttype);
- int width = TYPE_LENGTH (elttype);
+ int width = elttype->length ();
/* First we need to figure out the limit on the number of characters we are
going to attempt to fetch and print. This is actually pretty simple. If
If TYPE represents some aggregate type (e.g., a structure), return 1.
Otherwise, any of the bytes starting at OFFSET and extending for
- TYPE_LENGTH(TYPE) bytes are invalid, print a message to STREAM and
+ TYPE->length () bytes are invalid, print a message to STREAM and
return 0. The checking is done using FUNCS.
Otherwise, return 1. */
if (t.offset == 0
&& t.length == (TARGET_CHAR_BIT
- * TYPE_LENGTH (value_enclosing_type (value))))
+ * value_enclosing_type (value)->length ()))
return 1;
}
/* We shouldn't be trying to compare past the end of the values. */
gdb_assert (offset1 + length
- <= TYPE_LENGTH (val1->enclosing_type) * TARGET_CHAR_BIT);
+ <= val1->enclosing_type->length () * TARGET_CHAR_BIT);
gdb_assert (offset2 + length
- <= TYPE_LENGTH (val2->enclosing_type) * TARGET_CHAR_BIT);
+ <= val2->enclosing_type->length () * TARGET_CHAR_BIT);
memset (&rp1, 0, sizeof (rp1));
memset (&rp2, 0, sizeof (rp2));
static void
check_type_length_before_alloc (const struct type *type)
{
- ULONGEST length = TYPE_LENGTH (type);
+ ULONGEST length = type->length ();
if (max_value_size > -1 && length > max_value_size)
{
{
check_type_length_before_alloc (val->enclosing_type);
val->contents.reset
- ((gdb_byte *) xzalloc (TYPE_LENGTH (val->enclosing_type)));
+ ((gdb_byte *) xzalloc (val->enclosing_type->length ()));
}
}
{
struct value *retval = allocate_value_lazy (type);
- mark_value_bytes_optimized_out (retval, 0, TYPE_LENGTH (type));
+ mark_value_bytes_optimized_out (retval, 0, type->length ());
set_value_lazy (retval, 0);
return retval;
}
allocate_value_contents (value);
- ULONGEST length = TYPE_LENGTH (value_type (value));
+ ULONGEST length = value_type (value)->length ();
return gdb::make_array_view
(value->contents.get () + value->embedded_offset * unit_size, length);
}
{
allocate_value_contents (value);
- ULONGEST length = TYPE_LENGTH (value_enclosing_type (value));
+ ULONGEST length = value_enclosing_type (value)->length ();
return gdb::make_array_view (value->contents.get (), length);
}
if (value->lazy)
value_fetch_lazy (value);
- ULONGEST length = TYPE_LENGTH (value_enclosing_type (value));
+ ULONGEST length = value_enclosing_type (value)->length ();
return gdb::make_array_view (value->contents.get (), length);
}
{
gdb_assert (!value->lazy);
- ULONGEST length = TYPE_LENGTH (value_enclosing_type (value));
+ ULONGEST length = value_enclosing_type (value)->length ();
return gdb::make_array_view (value->contents.get (), length);
}
if (!value_lazy (val) && !value_entirely_optimized_out (val))
{
gdb_assert (arg->contents != nullptr);
- ULONGEST length = TYPE_LENGTH (value_enclosing_type (arg));
+ ULONGEST length = value_enclosing_type (arg)->length ();
const auto &arg_view
= gdb::make_array_view (arg->contents.get (), length);
copy (arg_view, value_contents_all_raw (val));
{
gdb_assert (VALUE_LVAL (v) == not_lval);
- write_memory (addr, value_contents_raw (v).data (), TYPE_LENGTH (value_type (v)));
+ write_memory (addr, value_contents_raw (v).data (), value_type (v)->length ());
v->lval = lval_memory;
v->location.address = addr;
}
value_as_long (newval), bitpos, bitsize);
else
memcpy (addr + offset * unit_size, value_contents (newval).data (),
- TYPE_LENGTH (value_type (newval)));
+ value_type (newval)->length ());
break;
default:
enum bfd_endian byte_order = type_byte_order (type);
enum type_code code = type->code ();
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int nosign = type->is_unsigned ();
switch (code)
void
set_value_enclosing_type (struct value *val, struct type *new_encl_type)
{
- if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val)))
+ if (new_encl_type->length () > value_enclosing_type (val)->length ())
{
check_type_length_before_alloc (new_encl_type);
val->contents
.reset ((gdb_byte *) xrealloc (val->contents.release (),
- TYPE_LENGTH (new_encl_type)));
+ new_encl_type->length ()));
}
val->enclosing_type = new_encl_type;
are sufficiently aligned. */
LONGEST bitpos = arg_type->field (fieldno).loc_bitpos ();
- LONGEST container_bitsize = TYPE_LENGTH (type) * 8;
+ LONGEST container_bitsize = type->length () * 8;
v = allocate_value_lazy (type);
v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno);
if ((bitpos % container_bitsize) + v->bitsize <= container_bitsize
- && TYPE_LENGTH (type) <= (int) sizeof (LONGEST))
+ && type->length () <= (int) sizeof (LONGEST))
v->bitpos = bitpos % container_bitsize;
else
v->bitpos = bitpos % 8;
{
v = allocate_value (value_enclosing_type (arg1));
value_contents_copy_raw (v, 0, arg1, 0,
- TYPE_LENGTH (value_enclosing_type (arg1)));
+ value_enclosing_type (arg1)->length ());
}
v->type = type;
v->offset = value_offset (arg1);
bytes_read = ((bitpos % 8) + bitsize + 7) / 8;
else
{
- bytes_read = TYPE_LENGTH (field_type);
+ bytes_read = field_type->length ();
bitsize = 8 * bytes_read;
}
num = unpack_bits_as_long (field_type, valaddr + embedded_offset,
bitpos, bitsize);
store_signed_integer (value_contents_raw (dest_val).data (),
- TYPE_LENGTH (field_type), byte_order, num);
+ field_type->length (), byte_order, num);
}
/* Now copy the optimized out / unavailability ranges to the right
bits. */
src_bit_offset = embedded_offset * TARGET_CHAR_BIT + bitpos;
if (byte_order == BFD_ENDIAN_BIG)
- dst_bit_offset = TYPE_LENGTH (field_type) * TARGET_CHAR_BIT - bitsize;
+ dst_bit_offset = field_type->length () * TARGET_CHAR_BIT - bitsize;
else
dst_bit_offset = 0;
value_ranges_copy_adjusted (dest_val, dst_bit_offset,
LONGEST len;
type = check_typedef (type);
- len = TYPE_LENGTH (type);
+ len = type->length ();
switch (type->code ())
{
enum bfd_endian byte_order;
type = check_typedef (type);
- len = TYPE_LENGTH (type);
+ len = type->length ();
byte_order = type_byte_order (type);
switch (type->code ())
{
gdb::array_view<const gdb_byte> view;
if (valaddr != nullptr)
- view = gdb::make_array_view (valaddr, TYPE_LENGTH (type));
+ view = gdb::make_array_view (valaddr, type->length ());
struct type *resolved_type = resolve_dynamic_type (type, view, address);
struct type *resolved_type_no_typedef = check_typedef (resolved_type);
struct value *v;
struct value *result;
result = allocate_value (type);
- memcpy (value_contents_raw (result).data (), contents, TYPE_LENGTH (type));
+ memcpy (value_contents_raw (result).data (), contents, type->length ());
return result;
}
CORE_ADDR addr = value_address (val);
struct type *type = check_typedef (value_enclosing_type (val));
- if (TYPE_LENGTH (type))
+ if (type->length ())
read_value_memory (val, 0, value_stack (val),
addr, value_contents_all_raw (val).data (),
type_length_units (type));
example, to compare a complete object value with itself, including
its enclosing type chunk, you'd do:
- int len = TYPE_LENGTH (check_typedef (value_enclosing_type (val)));
+ int len = check_typedef (value_enclosing_type (val))->length ();
value_contents_eq (val, 0, val, 0, len);
Returns true iff the set of available/valid contents match.
/* Push arguments in reverse order. */
for (i = nargs - 1; i >= 0; i--)
{
- int len = TYPE_LENGTH (value_enclosing_type (args[i]));
+ int len = value_enclosing_type (args[i])->length ();
sp -= (len + 3) & ~3;
count += (len + 3) / 4;
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_byte buf[8];
if (type->code () == TYPE_CODE_STRUCT
seh_type->set_name (xstrdup ("seh"));
seh_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
- TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT,
+ void_ptr_type->length () * TARGET_CHAR_BIT,
NULL);
seh_ptr_type->set_target_type (seh_type);
append_composite_type_field (peb_ldr_type, "entry_in_progress",
void_ptr_type);
peb_ldr_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
- TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT,
+ void_ptr_type->length () * TARGET_CHAR_BIT,
NULL);
peb_ldr_ptr_type->set_target_type (peb_ldr_type);
append_composite_type_field (uni_str_type, "maximum_length", word_type);
append_composite_type_field_aligned (uni_str_type, "buffer",
wchar_ptr_type,
- TYPE_LENGTH (wchar_ptr_type));
+ wchar_ptr_type->length ());
/* struct _RTL_USER_PROCESS_PARAMETERS */
rupp_type = arch_composite_type (gdbarch, "rtl_user_process_parameters",
append_composite_type_field (rupp_type, "console_flags", dword32_type);
append_composite_type_field_aligned (rupp_type, "standard_input",
void_ptr_type,
- TYPE_LENGTH (void_ptr_type));
+ void_ptr_type->length ());
append_composite_type_field (rupp_type, "standard_output", void_ptr_type);
append_composite_type_field (rupp_type, "standard_error", void_ptr_type);
append_composite_type_field (rupp_type, "current_directory", uni_str_type);
append_composite_type_field (rupp_type, "show_window_flags", dword32_type);
append_composite_type_field_aligned (rupp_type, "window_title",
uni_str_type,
- TYPE_LENGTH (void_ptr_type));
+ void_ptr_type->length ());
append_composite_type_field (rupp_type, "desktop_info", uni_str_type);
append_composite_type_field (rupp_type, "shell_info", uni_str_type);
append_composite_type_field (rupp_type, "runtime_data", uni_str_type);
append_composite_type_field (peb_type, "process_heap", void_ptr_type);
append_composite_type_field (peb_type, "fast_peb_lock", void_ptr_type);
peb_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
- TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT,
+ void_ptr_type->length () * TARGET_CHAR_BIT,
NULL);
peb_ptr_type->set_target_type (peb_type);
append_composite_type_field (tib_type, "last_error_number", dword_ptr_type);
tib_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
- TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT,
+ void_ptr_type->length () * TARGET_CHAR_BIT,
NULL);
tib_ptr_type->set_target_type (tib_type);
append_composite_type_field (siginfo_type, "NumberParameters", dword_type);
/* The 64-bit variant needs some padding. */
append_composite_type_field_aligned (siginfo_type, "",
- para_type, TYPE_LENGTH (ulongptr_type));
+ para_type, ulongptr_type->length ());
windows_gdbarch_data->siginfo_type = siginfo_type;
xstormy16_use_struct_convention (struct type *type)
{
return !xstormy16_type_is_scalar (type)
- || TYPE_LENGTH (type) > E_MAX_RETTYPE_SIZE_IN_REGS;
+ || type->length () > E_MAX_RETTYPE_SIZE_IN_REGS;
}
/* Function: xstormy16_extract_return_value
xstormy16_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int i, regnum = E_1ST_ARG_REGNUM;
for (i = 0; i < len; i += xstormy16_reg_size)
xstormy16_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
- if (TYPE_LENGTH (type) == 1)
+ if (type->length () == 1)
{
/* Add leading zeros to the value. */
gdb_byte buf[xstormy16_reg_size];
}
else
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int i, regnum = E_1ST_ARG_REGNUM;
for (i = 0; i < len; i += xstormy16_reg_size)
would fit in the remaining unused registers. */
for (i = 0; i < nargs && argreg <= E_LST_ARG_REGNUM; i++)
{
- typelen = TYPE_LENGTH (value_enclosing_type (args[i]));
+ typelen = value_enclosing_type (args[i])->length ();
if (typelen > E_MAX_RETTYPE_SIZE (argreg))
break;
{
const gdb_byte *bytes = value_contents (args[j]).data ();
- typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
+ typelen = value_enclosing_type (args[j])->length ();
slacklen = typelen & 1;
gdb::byte_vector val (typelen + slacklen);
memcpy (val.data (), bytes, typelen);
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)
{
if (addr2)
addr = addr2;
}
- store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
+ store_unsigned_integer (buf, type->length (), byte_order, addr);
}
static struct xstormy16_frame_cache *
{
struct gdbarch *gdbarch = regcache->arch ();
bfd_byte *valbuf = (bfd_byte *) dst;
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
ULONGEST pc, wb;
int callsize, areg;
int offset = 0;
unsigned int areg;
ULONGEST pc, wb;
int callsize;
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
int offset = 0;
DEBUGTRACE ("xtensa_store_return_value (...)\n");
if (len > (callsize > 8 ? 8 : 16))
internal_error (__FILE__, __LINE__,
_("unimplemented for this length: %s"),
- pulongest (TYPE_LENGTH (type)));
+ pulongest (type->length ()));
areg = arreg_number (gdbarch,
tdep->a0_base + 2 + callsize, wb);
int struct_return = ((valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION
|| valtype->code () == TYPE_CODE_ARRAY)
- && TYPE_LENGTH (valtype) > 16);
+ && valtype->length () > 16);
if (struct_return)
return RETURN_VALUE_STRUCT_CONVENTION;
struct type *arg_type = check_typedef (value_type (arg));
gdb_printf (gdb_stdlog, "%2d: %s %3s ", i,
host_address_to_string (arg),
- pulongest (TYPE_LENGTH (arg_type)));
+ pulongest (arg_type->length ()));
switch (arg_type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_ENUM:
/* Cast argument to long if necessary as the mask does it too. */
- if (TYPE_LENGTH (arg_type)
- < TYPE_LENGTH (builtin_type (gdbarch)->builtin_long))
+ if (arg_type->length ()
+ < builtin_type (gdbarch)->builtin_long->length ())
{
arg_type = builtin_type (gdbarch)->builtin_long;
arg = value_cast (arg_type, arg);
}
/* Aligment is equal to the type length for the basic types. */
- info->align = TYPE_LENGTH (arg_type);
+ info->align = arg_type->length ();
break;
case TYPE_CODE_FLT:
/* Align doubles correctly. */
- if (TYPE_LENGTH (arg_type)
- == TYPE_LENGTH (builtin_type (gdbarch)->builtin_double))
- info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_double);
+ if (arg_type->length ()
+ == builtin_type (gdbarch)->builtin_double->length ())
+ info->align = builtin_type (gdbarch)->builtin_double->length ();
else
- info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long);
+ info->align = builtin_type (gdbarch)->builtin_long->length ();
break;
case TYPE_CODE_STRUCT:
default:
- info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long);
+ info->align = builtin_type (gdbarch)->builtin_long->length ();
break;
}
- info->length = TYPE_LENGTH (arg_type);
+ info->length = arg_type->length ();
info->contents = value_contents (arg).data ();
/* Align size and onstack_size. */
gdb_byte *readbuf, const gdb_byte *writebuf)
{
/* Byte are returned in L, word in HL, dword in DEHL. */
- int len = TYPE_LENGTH (valtype);
+ int len = valtype->length ();
if ((valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION