gdb: remove TYPE_FIELD_BITPOS
Remove TYPE_FIELD_BITPOS, replace its uses with type::field + field::loc_bitpos. Change-Id: Iccd8d5a77e5352843a837babaa6bd284162e0320
This commit is contained in:
parent
2ad53ea10c
commit
b610c04548
@ -1537,7 +1537,7 @@ desc_bounds (struct value *arr)
|
||||
static int
|
||||
fat_pntr_bounds_bitpos (struct type *type)
|
||||
{
|
||||
return TYPE_FIELD_BITPOS (desc_base_type (type), 1);
|
||||
return desc_base_type (type)->field (1).loc_bitpos ();
|
||||
}
|
||||
|
||||
/* If TYPE is the type of an array-descriptor (fat pointer), the bit
|
||||
@ -1603,7 +1603,7 @@ desc_data (struct value *arr)
|
||||
static int
|
||||
fat_pntr_data_bitpos (struct type *type)
|
||||
{
|
||||
return TYPE_FIELD_BITPOS (desc_base_type (type), 0);
|
||||
return desc_base_type (type)->field (0).loc_bitpos ();
|
||||
}
|
||||
|
||||
/* If TYPE is the type of an array-descriptor (fat pointer), the bit
|
||||
@ -1641,7 +1641,7 @@ desc_one_bound (struct value *bounds, int i, int which)
|
||||
static int
|
||||
desc_bound_bitpos (struct type *type, int i, int which)
|
||||
{
|
||||
return TYPE_FIELD_BITPOS (desc_base_type (type), 2 * i + which - 2);
|
||||
return desc_base_type (type)->field (2 * i + which - 2).loc_bitpos ();
|
||||
}
|
||||
|
||||
/* If BOUNDS is an array-bounds structure type, return the bit field size
|
||||
@ -6555,7 +6555,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
|
||||
packed; in this case we must take the bit-field path. */
|
||||
if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0 || value_bitpos (arg1) != 0)
|
||||
{
|
||||
int bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno);
|
||||
int bit_pos = arg_type->field (fieldno).loc_bitpos ();
|
||||
int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno);
|
||||
|
||||
return ada_value_primitive_packed_val (arg1,
|
||||
@ -6660,7 +6660,7 @@ find_struct_field (const char *name, struct type *type, int offset,
|
||||
int bit_pos = 0, fld_offset = 0;
|
||||
if (byte_offset_p != nullptr || bit_offset_p != nullptr)
|
||||
{
|
||||
bit_pos = TYPE_FIELD_BITPOS (type, i);
|
||||
bit_pos = type->field (i).loc_bitpos ();
|
||||
fld_offset = offset + bit_pos / 8;
|
||||
}
|
||||
|
||||
@ -6716,7 +6716,7 @@ find_struct_field (const char *name, struct type *type, int offset,
|
||||
{
|
||||
if (find_struct_field (name, field_type->field (j).type (),
|
||||
fld_offset
|
||||
+ TYPE_FIELD_BITPOS (field_type, j) / 8,
|
||||
+ field_type->field (j).loc_bitpos () / 8,
|
||||
field_type_p, byte_offset_p,
|
||||
bit_offset_p, bit_size_p, index_p))
|
||||
return 1;
|
||||
@ -6735,7 +6735,7 @@ find_struct_field (const char *name, struct type *type, int offset,
|
||||
int fld_offset = offset;
|
||||
if (byte_offset_p != nullptr || bit_offset_p != nullptr)
|
||||
{
|
||||
int bit_pos = TYPE_FIELD_BITPOS (type, parent_offset);
|
||||
int bit_pos = type->field (parent_offset).loc_bitpos ();
|
||||
fld_offset += bit_pos / 8;
|
||||
}
|
||||
|
||||
@ -6805,7 +6805,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
|
||||
{
|
||||
struct value *v = /* Do not let indent join lines here. */
|
||||
ada_search_struct_field (name, arg,
|
||||
offset + TYPE_FIELD_BITPOS (type, i) / 8,
|
||||
offset + type->field (i).loc_bitpos () / 8,
|
||||
type->field (i).type ());
|
||||
|
||||
if (v != NULL)
|
||||
@ -6817,14 +6817,14 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
|
||||
/* PNH: Do we ever get here? See find_struct_field. */
|
||||
int j;
|
||||
struct type *field_type = ada_check_typedef (type->field (i).type ());
|
||||
int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
|
||||
int var_offset = offset + type->field (i).loc_bitpos () / 8;
|
||||
|
||||
for (j = 0; j < field_type->num_fields (); j += 1)
|
||||
{
|
||||
struct value *v = ada_search_struct_field /* Force line
|
||||
break. */
|
||||
(name, arg,
|
||||
var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8,
|
||||
var_offset + field_type->field (j).loc_bitpos () / 8,
|
||||
field_type->field (j).type ());
|
||||
|
||||
if (v != NULL)
|
||||
@ -6839,7 +6839,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
|
||||
if (parent_offset != -1)
|
||||
{
|
||||
struct value *v = ada_search_struct_field (
|
||||
name, arg, offset + TYPE_FIELD_BITPOS (type, parent_offset) / 8,
|
||||
name, arg, offset + type->field (parent_offset).loc_bitpos () / 8,
|
||||
type->field (parent_offset).type ());
|
||||
|
||||
if (v != NULL)
|
||||
@ -6885,7 +6885,7 @@ ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
|
||||
{
|
||||
struct value *v = /* Do not let indent join lines here. */
|
||||
ada_index_struct_field_1 (index_p, arg,
|
||||
offset + TYPE_FIELD_BITPOS (type, i) / 8,
|
||||
offset + type->field (i).loc_bitpos () / 8,
|
||||
type->field (i).type ());
|
||||
|
||||
if (v != NULL)
|
||||
@ -7525,7 +7525,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||
for (f = 0; f < nfields; f += 1)
|
||||
{
|
||||
off = align_up (off, field_alignment (type, f))
|
||||
+ TYPE_FIELD_BITPOS (type, f);
|
||||
+ type->field (f).loc_bitpos ();
|
||||
rtype->field (f).set_loc_bitpos (off);
|
||||
TYPE_FIELD_BITSIZE (rtype, f) = 0;
|
||||
|
||||
@ -7562,7 +7562,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||
that follow this one. */
|
||||
if (ada_is_aligner_type (field_type))
|
||||
{
|
||||
long field_offset = TYPE_FIELD_BITPOS (type, f);
|
||||
long field_offset = type->field (f).loc_bitpos ();
|
||||
|
||||
field_valaddr = cond_offset_host (field_valaddr, field_offset);
|
||||
field_address = cond_offset_target (field_address, field_offset);
|
||||
@ -7642,7 +7642,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||
{
|
||||
struct type *branch_type;
|
||||
|
||||
off = TYPE_FIELD_BITPOS (rtype, variant_field);
|
||||
off = rtype->field (variant_field).loc_bitpos ();
|
||||
|
||||
if (dval0 == NULL)
|
||||
{
|
||||
@ -7837,10 +7837,10 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
|
||||
branch_type = to_fixed_variant_branch_type
|
||||
(type->field (variant_field).type (),
|
||||
cond_offset_host (valaddr,
|
||||
TYPE_FIELD_BITPOS (type, variant_field)
|
||||
type->field (variant_field).loc_bitpos ()
|
||||
/ TARGET_CHAR_BIT),
|
||||
cond_offset_target (address,
|
||||
TYPE_FIELD_BITPOS (type, variant_field)
|
||||
type->field (variant_field).loc_bitpos ()
|
||||
/ TARGET_CHAR_BIT), dval);
|
||||
if (branch_type == NULL)
|
||||
{
|
||||
@ -8742,10 +8742,9 @@ const gdb_byte *
|
||||
ada_aligned_value_addr (struct type *type, const gdb_byte *valaddr)
|
||||
{
|
||||
if (ada_is_aligner_type (type))
|
||||
return ada_aligned_value_addr (type->field (0).type (),
|
||||
valaddr +
|
||||
TYPE_FIELD_BITPOS (type,
|
||||
0) / TARGET_CHAR_BIT);
|
||||
return ada_aligned_value_addr
|
||||
(type->field (0).type (),
|
||||
valaddr + type->field (0).loc_bitpos () / TARGET_CHAR_BIT);
|
||||
else
|
||||
return valaddr;
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ print_field_values (struct value *value, struct value *outer_value,
|
||||
else
|
||||
{
|
||||
struct value *v;
|
||||
int bit_pos = TYPE_FIELD_BITPOS (type, i);
|
||||
int bit_pos = type->field (i).loc_bitpos ();
|
||||
int bit_size = TYPE_FIELD_BITSIZE (type, i);
|
||||
struct value_print_options opts;
|
||||
|
||||
|
@ -563,7 +563,7 @@ amd64_has_unaligned_fields (struct type *type)
|
||||
|| TYPE_FIELD_PACKED (type, i))
|
||||
continue;
|
||||
|
||||
int bitpos = TYPE_FIELD_BITPOS (type, i);
|
||||
int bitpos = type->field (i).loc_bitpos ();
|
||||
|
||||
if (bitpos % 8 != 0)
|
||||
return true;
|
||||
@ -604,7 +604,7 @@ amd64_classify_aggregate_field (struct type *type, int i,
|
||||
if (field_is_static (&type->field (i)) || bitsize == 0)
|
||||
return;
|
||||
|
||||
int bitpos = bitoffset + TYPE_FIELD_BITPOS (type, i);
|
||||
int bitpos = bitoffset + type->field (i).loc_bitpos ();
|
||||
int pos = bitpos / 64;
|
||||
int endpos = (bitpos + bitsize - 1) / 64;
|
||||
|
||||
|
@ -8127,7 +8127,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
|
||||
}
|
||||
|
||||
/* If bitpos != 0, then we have to care about it. */
|
||||
if (TYPE_FIELD_BITPOS (type, i) != 0)
|
||||
if (type->field (i).loc_bitpos () != 0)
|
||||
{
|
||||
/* Bitfields are not addressable. If the field bitsize is
|
||||
zero, then the field is not packed. Hence it cannot be
|
||||
|
@ -1310,14 +1310,14 @@ gen_primitive_field (struct agent_expr *ax, struct axs_value *value,
|
||||
if (TYPE_FIELD_PACKED (type, fieldno))
|
||||
gen_bitfield_ref (ax, value, type->field (fieldno).type (),
|
||||
(offset * TARGET_CHAR_BIT
|
||||
+ TYPE_FIELD_BITPOS (type, fieldno)),
|
||||
+ type->field (fieldno).loc_bitpos ()),
|
||||
(offset * TARGET_CHAR_BIT
|
||||
+ TYPE_FIELD_BITPOS (type, fieldno)
|
||||
+ type->field (fieldno).loc_bitpos ()
|
||||
+ TYPE_FIELD_BITSIZE (type, fieldno)));
|
||||
else
|
||||
{
|
||||
gen_offset (ax, offset
|
||||
+ TYPE_FIELD_BITPOS (type, fieldno) / TARGET_CHAR_BIT);
|
||||
+ type->field (fieldno).loc_bitpos () / TARGET_CHAR_BIT);
|
||||
value->kind = axs_lvalue_memory;
|
||||
value->type = type->field (fieldno).type ();
|
||||
}
|
||||
|
@ -1192,7 +1192,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
|
||||
/* Make sure we carry our offset when we expand the
|
||||
struct/union. */
|
||||
local_podata.offset_bitpos
|
||||
= podata->offset_bitpos + TYPE_FIELD_BITPOS (type, i);
|
||||
= podata->offset_bitpos + type->field (i).loc_bitpos ();
|
||||
/* We're entering a struct/union. Right now,
|
||||
PODATA->END_BITPOS points right *after* the
|
||||
struct/union. However, when printing the first field
|
||||
@ -1646,11 +1646,11 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
|
||||
stream, show, level + 4,
|
||||
language, &local_flags, podata);
|
||||
fprintf_filtered (stream, " @%s",
|
||||
plongest (TYPE_FIELD_BITPOS (type, i)));
|
||||
plongest (type->field (i).loc_bitpos ()));
|
||||
if (TYPE_FIELD_BITSIZE (type, i) > 1)
|
||||
{
|
||||
fprintf_filtered (stream, "-%s",
|
||||
plongest (TYPE_FIELD_BITPOS (type, i)
|
||||
plongest (type->field (i).loc_bitpos ()
|
||||
+ TYPE_FIELD_BITSIZE (type, i)
|
||||
- 1));
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
|
||||
/* Print vtable entry - we only get here if NOT using
|
||||
-fvtable_thunks. (Otherwise, look under
|
||||
TYPE_CODE_PTR.) */
|
||||
int offset = TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8;
|
||||
int offset = type->field (VTBL_FNADDR_OFFSET).loc_bitpos () / 8;
|
||||
struct type *field_type = type->field (VTBL_FNADDR_OFFSET).type ();
|
||||
const gdb_byte *valaddr = value_contents_for_printing (val).data ();
|
||||
CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);
|
||||
|
@ -115,7 +115,7 @@ convert_struct_or_union (compile_c_instance *context, struct type *type)
|
||||
type->field (i).name (),
|
||||
field_type,
|
||||
bitsize,
|
||||
TYPE_FIELD_BITPOS (type, i));
|
||||
type->field (i).loc_bitpos ());
|
||||
}
|
||||
|
||||
context->plugin ().finish_record_or_union (result, TYPE_LENGTH (type));
|
||||
|
@ -652,7 +652,7 @@ compile_cplus_convert_struct_or_union_members
|
||||
|
||||
instance->plugin ().build_field
|
||||
(field_name, field_type, field_flags, bitsize,
|
||||
TYPE_FIELD_BITPOS (type, i));
|
||||
type->field (i).loc_bitpos ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
|
||||
for (fieldno = 0; fieldno < regs_type->num_fields (); fieldno++)
|
||||
{
|
||||
const char *reg_name = regs_type->field (fieldno).name ();
|
||||
ULONGEST reg_bitpos = TYPE_FIELD_BITPOS (regs_type, fieldno);
|
||||
ULONGEST reg_bitpos = regs_type->field (fieldno).loc_bitpos ();
|
||||
ULONGEST reg_bitsize = TYPE_FIELD_BITSIZE (regs_type, fieldno);
|
||||
ULONGEST reg_offset;
|
||||
struct type *reg_type
|
||||
|
@ -270,11 +270,9 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
|
||||
fputs_styled ("<optimized out or zero length>",
|
||||
metadata_style.style (), stream);
|
||||
}
|
||||
else if (value_bits_synthetic_pointer (val,
|
||||
TYPE_FIELD_BITPOS (type,
|
||||
i),
|
||||
TYPE_FIELD_BITSIZE (type,
|
||||
i)))
|
||||
else if (value_bits_synthetic_pointer
|
||||
(val, type->field (i).loc_bitpos (),
|
||||
TYPE_FIELD_BITSIZE (type, i)))
|
||||
{
|
||||
fputs_styled (_("<synthetic pointer>"),
|
||||
metadata_style.style (), stream);
|
||||
@ -316,7 +314,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
|
||||
}
|
||||
else if (i == vptr_fieldno && type == vptr_basetype)
|
||||
{
|
||||
int i_offset = TYPE_FIELD_BITPOS (type, i) / 8;
|
||||
int i_offset = type->field (i).loc_bitpos () / 8;
|
||||
struct type *i_type = type->field (i).type ();
|
||||
|
||||
if (valprint_check_validity (stream, i_type, i_offset, val))
|
||||
@ -638,7 +636,7 @@ cp_find_class_member (struct type **self_p, int *fieldno,
|
||||
|
||||
for (i = TYPE_N_BASECLASSES (self); i < len; i++)
|
||||
{
|
||||
LONGEST bitpos = TYPE_FIELD_BITPOS (self, i);
|
||||
LONGEST bitpos = self->field (i).loc_bitpos ();
|
||||
|
||||
QUIT;
|
||||
if (offset == bitpos)
|
||||
@ -650,7 +648,7 @@ cp_find_class_member (struct type **self_p, int *fieldno,
|
||||
|
||||
for (i = 0; i < TYPE_N_BASECLASSES (self); i++)
|
||||
{
|
||||
LONGEST bitpos = TYPE_FIELD_BITPOS (self, i);
|
||||
LONGEST bitpos = self->field (i).loc_bitpos ();
|
||||
LONGEST bitsize = 8 * TYPE_LENGTH (self->field (i).type ());
|
||||
|
||||
if (offset >= bitpos && offset < bitpos + bitsize)
|
||||
|
@ -55,7 +55,7 @@ dynamic_array_type (struct type *type,
|
||||
ptr_type = type->field (1).type ();
|
||||
elttype = check_typedef (TYPE_TARGET_TYPE (ptr_type));
|
||||
addr = unpack_pointer (ptr_type,
|
||||
valaddr + TYPE_FIELD_BITPOS (type, 1) / 8
|
||||
valaddr + type->field (1).loc_bitpos () / 8
|
||||
+ embedded_offset);
|
||||
true_type = check_typedef (elttype);
|
||||
|
||||
|
@ -9076,7 +9076,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
|
||||
}
|
||||
++name;
|
||||
|
||||
bit_offset += TYPE_FIELD_BITPOS (field_type, index);
|
||||
bit_offset += field_type->field (index).loc_bitpos ();
|
||||
field_type = field_type->field (index).type ();
|
||||
}
|
||||
|
||||
@ -16530,7 +16530,7 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
|
||||
bounds->num_fields () * sizeof (struct field));
|
||||
|
||||
int last_fieldno = range_fields.size () - 1;
|
||||
int bounds_size = (TYPE_FIELD_BITPOS (bounds, last_fieldno) / 8
|
||||
int bounds_size = (bounds->field (last_fieldno).loc_bitpos () / 8
|
||||
+ TYPE_LENGTH (bounds->field (last_fieldno).type ()));
|
||||
TYPE_LENGTH (bounds) = align_up (bounds_size, max_align);
|
||||
|
||||
|
@ -2321,7 +2321,7 @@ array_operation::evaluate_struct_tuple (struct value *struct_val,
|
||||
val = value_cast (field_type, val);
|
||||
|
||||
bitsize = TYPE_FIELD_BITSIZE (struct_type, fieldno);
|
||||
bitpos = TYPE_FIELD_BITPOS (struct_type, fieldno);
|
||||
bitpos = struct_type->field (fieldno).loc_bitpos ();
|
||||
addr = value_contents_writeable (struct_val).data () + bitpos / 8;
|
||||
if (bitsize)
|
||||
modify_field (struct_type, addr,
|
||||
|
@ -1851,7 +1851,7 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
|
||||
|
||||
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
|
||||
{
|
||||
return {&type->field (i), TYPE_FIELD_BITPOS (type, i)};
|
||||
return {&type->field (i), type->field (i).loc_bitpos ()};
|
||||
}
|
||||
else if (!t_field_name || *t_field_name == '\0')
|
||||
{
|
||||
@ -1859,7 +1859,7 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
|
||||
= lookup_struct_elt (type->field (i).type (), name, 1);
|
||||
if (elt.field != NULL)
|
||||
{
|
||||
elt.offset += TYPE_FIELD_BITPOS (type, i);
|
||||
elt.offset += type->field (i).loc_bitpos ();
|
||||
return elt;
|
||||
}
|
||||
}
|
||||
@ -2464,7 +2464,7 @@ compute_variant_fields_inner (struct type *type,
|
||||
else
|
||||
{
|
||||
CORE_ADDR addr = (addr_stack->addr
|
||||
+ (TYPE_FIELD_BITPOS (type, idx)
|
||||
+ (type->field (idx).loc_bitpos ()
|
||||
/ TARGET_CHAR_BIT));
|
||||
|
||||
LONGEST bitsize = TYPE_FIELD_BITSIZE (type, idx);
|
||||
@ -2475,7 +2475,7 @@ compute_variant_fields_inner (struct type *type,
|
||||
gdb_byte bits[sizeof (ULONGEST)];
|
||||
read_memory (addr, bits, size);
|
||||
|
||||
LONGEST bitpos = (TYPE_FIELD_BITPOS (type, idx)
|
||||
LONGEST bitpos = (type->field (idx).loc_bitpos ()
|
||||
% TARGET_CHAR_BIT);
|
||||
|
||||
discr_value = unpack_bits_as_long (type->field (idx).type (),
|
||||
@ -2615,7 +2615,7 @@ resolve_dynamic_struct (struct type *type,
|
||||
" (invalid location kind)"));
|
||||
|
||||
pinfo.type = check_typedef (resolved_type->field (i).type ());
|
||||
size_t offset = TYPE_FIELD_BITPOS (resolved_type, i) / TARGET_CHAR_BIT;
|
||||
size_t offset = resolved_type->field (i).loc_bitpos () / TARGET_CHAR_BIT;
|
||||
pinfo.valaddr = addr_stack->valaddr;
|
||||
if (!pinfo.valaddr.empty ())
|
||||
pinfo.valaddr = pinfo.valaddr.slice (offset);
|
||||
@ -2628,7 +2628,7 @@ resolve_dynamic_struct (struct type *type,
|
||||
gdb_assert (resolved_type->field (i).loc_kind ()
|
||||
== FIELD_LOC_KIND_BITPOS);
|
||||
|
||||
new_bit_length = TYPE_FIELD_BITPOS (resolved_type, i);
|
||||
new_bit_length = resolved_type->field (i).loc_bitpos ();
|
||||
if (TYPE_FIELD_BITSIZE (resolved_type, i) != 0)
|
||||
new_bit_length += TYPE_FIELD_BITSIZE (resolved_type, i);
|
||||
else
|
||||
@ -5340,7 +5340,7 @@ recursive_dump_type (struct type *type, int spaces)
|
||||
idx, plongest (TYPE_FIELD_ENUMVAL (type, idx)));
|
||||
else
|
||||
printf_filtered ("%*s[%d] bitpos %s bitsize %d type ", spaces + 2, "",
|
||||
idx, plongest (TYPE_FIELD_BITPOS (type, idx)),
|
||||
idx, plongest (type->field (idx).loc_bitpos ()),
|
||||
TYPE_FIELD_BITSIZE (type, idx));
|
||||
gdb_print_host_address (type->field (idx).type (), gdb_stdout);
|
||||
printf_filtered (" name '%s' (",
|
||||
@ -5562,7 +5562,7 @@ copy_type_recursive (struct objfile *objfile,
|
||||
switch (type->field (i).loc_kind ())
|
||||
{
|
||||
case FIELD_LOC_KIND_BITPOS:
|
||||
new_type->field (i).set_loc_bitpos (TYPE_FIELD_BITPOS (type, i));
|
||||
new_type->field (i).set_loc_bitpos (type->field (i).loc_bitpos ());
|
||||
break;
|
||||
case FIELD_LOC_KIND_ENUMVAL:
|
||||
new_type->field (i).set_loc_enumval (TYPE_FIELD_ENUMVAL (type, i));
|
||||
|
@ -2116,7 +2116,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
#define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
|
||||
#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
|
||||
#define TYPE_BASECLASS_NAME(thistype,index) (thistype->field (index).name ())
|
||||
#define TYPE_BASECLASS_BITPOS(thistype,index) TYPE_FIELD_BITPOS(thistype,index)
|
||||
#define TYPE_BASECLASS_BITPOS(thistype,index) (thistype->field (index).loc_bitpos ())
|
||||
#define BASETYPE_VIA_PUBLIC(thistype, index) \
|
||||
((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
|
||||
#define TYPE_CPLUS_DYNAMIC(thistype) TYPE_CPLUS_SPECIFIC (thistype)->is_dynamic
|
||||
@ -2128,7 +2128,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
|
||||
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
|
||||
|
||||
#define TYPE_FIELD_BITPOS(thistype, n) ((thistype)->field (n).loc_bitpos ())
|
||||
#define TYPE_FIELD_ENUMVAL(thistype, n) ((thistype)->field (n).loc_enumval ())
|
||||
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) ((thistype)->field (n).loc_physname ())
|
||||
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) ((thistype)->field (n).loc_physaddr ())
|
||||
|
@ -364,7 +364,7 @@ gnuv2_baseclass_offset (struct type *type, int index,
|
||||
CORE_ADDR addr;
|
||||
|
||||
field_type = check_typedef (type->field (i).type ());
|
||||
field_offset = TYPE_FIELD_BITPOS (type, i) / 8;
|
||||
field_offset = type->field (i).loc_bitpos () / 8;
|
||||
field_length = TYPE_LENGTH (field_type);
|
||||
|
||||
if (!value_bytes_available (val, embedded_offset + field_offset,
|
||||
|
@ -195,7 +195,7 @@ vtable_address_point_offset (struct gdbarch *gdbarch)
|
||||
struct type *vtable_type
|
||||
= (struct type *) gdbarch_data (gdbarch, vtable_type_gdbarch_data);
|
||||
|
||||
return (TYPE_FIELD_BITPOS (vtable_type, vtable_field_virtual_functions)
|
||||
return (vtable_type->field (vtable_field_virtual_functions).loc_bitpos ()
|
||||
/ TARGET_CHAR_BIT);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
|
||||
for (i = low_bound; i <= high_bound; i++)
|
||||
{
|
||||
bitval = value_bit_index (type->field (field).type (),
|
||||
(TYPE_FIELD_BITPOS (type, field) / 8) +
|
||||
(type->field (field).loc_bitpos () / 8) +
|
||||
valaddr + embedded_offset, i);
|
||||
if (bitval < 0)
|
||||
error (_("bit test is out of range"));
|
||||
@ -168,7 +168,7 @@ m2_print_unbounded_array (struct value *value,
|
||||
const gdb_byte *valaddr = value_contents_for_printing (value).data ();
|
||||
|
||||
addr = unpack_pointer (type->field (0).type (),
|
||||
(TYPE_FIELD_BITPOS (type, 0) / 8) +
|
||||
(type->field (0).loc_bitpos () / 8) +
|
||||
valaddr);
|
||||
|
||||
val = value_at_lazy (TYPE_TARGET_TYPE (type->field (0).type ()),
|
||||
|
@ -4858,11 +4858,11 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
|
||||
|
||||
/* We're only looking at normal fields. */
|
||||
if (field_is_static (&arg_type->field (i))
|
||||
|| (TYPE_FIELD_BITPOS (arg_type, i) % 8) != 0)
|
||||
|| (arg_type->field (i).loc_bitpos () % 8) != 0)
|
||||
continue;
|
||||
|
||||
/* If we have gone past the offset, there is no double to pass. */
|
||||
pos = TYPE_FIELD_BITPOS (arg_type, i) / 8;
|
||||
pos = arg_type->field (i).loc_bitpos () / 8;
|
||||
if (pos > offset)
|
||||
return 0;
|
||||
|
||||
|
@ -102,11 +102,11 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
|
||||
&& strcmp (type->field (1).name (), "st") == 0)
|
||||
{
|
||||
if (length_pos)
|
||||
*length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT;
|
||||
*length_pos = type->field (0).loc_bitpos () / TARGET_CHAR_BIT;
|
||||
if (length_size)
|
||||
*length_size = TYPE_LENGTH (type->field (0).type ());
|
||||
if (string_pos)
|
||||
*string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
|
||||
*string_pos = type->field (1).loc_bitpos () / TARGET_CHAR_BIT;
|
||||
if (char_type)
|
||||
*char_type = TYPE_TARGET_TYPE (type->field (1).type ());
|
||||
if (arrayname)
|
||||
@ -122,11 +122,11 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
|
||||
&& strcmp (type->field (1).name (), "length") == 0)
|
||||
{
|
||||
if (length_pos)
|
||||
*length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
|
||||
*length_pos = type->field (1).loc_bitpos () / TARGET_CHAR_BIT;
|
||||
if (length_size)
|
||||
*length_size = TYPE_LENGTH (type->field (1).type ());
|
||||
if (string_pos)
|
||||
*string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT;
|
||||
*string_pos = type->field (2).loc_bitpos () / TARGET_CHAR_BIT;
|
||||
/* FIXME: how can I detect wide chars in GPC ?? */
|
||||
if (char_type)
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ pascal_language::value_print_inner (struct value *val,
|
||||
print_address_demangle
|
||||
(options, gdbarch,
|
||||
extract_unsigned_integer
|
||||
(valaddr + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
|
||||
(valaddr + type->field (VTBL_FNADDR_OFFSET).loc_bitpos () / 8,
|
||||
TYPE_LENGTH (type->field (VTBL_FNADDR_OFFSET).type ()),
|
||||
byte_order),
|
||||
stream, demangle);
|
||||
@ -606,11 +606,9 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
|
||||
fputs_styled ("<optimized out or zero length>",
|
||||
metadata_style.style (), stream);
|
||||
}
|
||||
else if (value_bits_synthetic_pointer (val,
|
||||
TYPE_FIELD_BITPOS (type,
|
||||
i),
|
||||
TYPE_FIELD_BITSIZE (type,
|
||||
i)))
|
||||
else if (value_bits_synthetic_pointer
|
||||
(val, type->field (i).loc_bitpos (),
|
||||
TYPE_FIELD_BITSIZE (type, i)))
|
||||
{
|
||||
fputs_styled (_("<synthetic pointer>"),
|
||||
metadata_style.style (), stream);
|
||||
|
@ -192,7 +192,7 @@ convert_field (struct type *type, int field)
|
||||
if (type->field (field).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK)
|
||||
arg = gdbpy_ref<>::new_reference (Py_None);
|
||||
else
|
||||
arg = gdb_py_object_from_longest (TYPE_FIELD_BITPOS (type, field));
|
||||
arg = gdb_py_object_from_longest (type->field (field).loc_bitpos ());
|
||||
attrstring = "bitpos";
|
||||
}
|
||||
|
||||
|
@ -2548,7 +2548,7 @@ riscv_struct_info::analyse_inner (struct type *type, int offset)
|
||||
struct type *field_type = type->field (i).type ();
|
||||
field_type = check_typedef (field_type);
|
||||
int field_offset
|
||||
= offset + TYPE_FIELD_BITPOS (type, i) / TARGET_CHAR_BIT;
|
||||
= offset + type->field (i).loc_bitpos () / TARGET_CHAR_BIT;
|
||||
|
||||
switch (field_type->code ())
|
||||
{
|
||||
|
@ -686,8 +686,8 @@ rust_print_struct_def (struct type *type, const char *varstring,
|
||||
std::sort (fields.begin (), fields.end (),
|
||||
[&] (int a, int b)
|
||||
{
|
||||
return (TYPE_FIELD_BITPOS (type, a)
|
||||
< TYPE_FIELD_BITPOS (type, b));
|
||||
return (type->field (a).loc_bitpos ()
|
||||
< type->field (b).loc_bitpos ());
|
||||
});
|
||||
|
||||
for (int i : fields)
|
||||
@ -943,7 +943,7 @@ rust_composite_type (struct type *original,
|
||||
|
||||
if (i > 0)
|
||||
TYPE_LENGTH (result)
|
||||
= (TYPE_FIELD_BITPOS (result, i - 1) / TARGET_CHAR_BIT +
|
||||
= (result->field (i - 1).loc_bitpos () / TARGET_CHAR_BIT +
|
||||
TYPE_LENGTH (result->field (i - 1).type ()));
|
||||
return result;
|
||||
}
|
||||
|
@ -1267,7 +1267,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
|
||||
for (i = 0; i < type->num_fields (); i++)
|
||||
{
|
||||
struct type *subtype = check_typedef (type->field (i).type ());
|
||||
int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
|
||||
int subpos = bitpos + type->field (i).loc_bitpos ();
|
||||
|
||||
sparc64_store_floating_fields (regcache, subtype, valbuf,
|
||||
element, subpos);
|
||||
@ -1355,7 +1355,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
|
||||
for (i = 0; i < type->num_fields (); i++)
|
||||
{
|
||||
struct type *subtype = check_typedef (type->field (i).type ());
|
||||
int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
|
||||
int subpos = bitpos + type->field (i).loc_bitpos ();
|
||||
|
||||
sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ print_offset_data::update (struct type *type, unsigned int field_idx,
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int bitpos = TYPE_FIELD_BITPOS (type, field_idx);
|
||||
unsigned int bitpos = type->field (field_idx).loc_bitpos ();
|
||||
unsigned int fieldsize_byte = TYPE_LENGTH (ftype);
|
||||
unsigned int fieldsize_bit = fieldsize_byte * TARGET_CHAR_BIT;
|
||||
|
||||
|
@ -2030,8 +2030,8 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
|
||||
have to add the offset of the union here. */
|
||||
if (field_type->code () == TYPE_CODE_STRUCT
|
||||
|| (field_type->num_fields () > 0
|
||||
&& TYPE_FIELD_BITPOS (field_type, 0) == 0))
|
||||
new_offset += TYPE_FIELD_BITPOS (type, i) / 8;
|
||||
&& field_type->field (0).loc_bitpos () == 0))
|
||||
new_offset += type->field (i).loc_bitpos () / 8;
|
||||
|
||||
search (arg1, new_offset, field_type);
|
||||
}
|
||||
@ -2430,7 +2430,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
|
||||
for (i = TYPE_N_BASECLASSES (t); i < t->num_fields (); i++)
|
||||
{
|
||||
if (!field_is_static (&t->field (i))
|
||||
&& bitpos == TYPE_FIELD_BITPOS (t, i)
|
||||
&& bitpos == t->field (i).loc_bitpos ()
|
||||
&& types_equal (ftype, t->field (i).type ()))
|
||||
return value_primitive_field (*argp, 0, i, t);
|
||||
}
|
||||
@ -3518,7 +3518,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
||||
if (want_address)
|
||||
return value_from_longest
|
||||
(lookup_memberptr_type (t->field (i).type (), domain),
|
||||
offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3));
|
||||
offset + (LONGEST) (t->field (i).loc_bitpos () >> 3));
|
||||
else if (noside != EVAL_NORMAL)
|
||||
return allocate_value (t->field (i).type ());
|
||||
else
|
||||
|
@ -1214,7 +1214,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
|
||||
int. */
|
||||
&& TYPE_FIELD_BITSIZE (type, field) == 1)
|
||||
{
|
||||
if (val & ((ULONGEST)1 << TYPE_FIELD_BITPOS (type, field)))
|
||||
if (val & ((ULONGEST)1 << type->field (field).loc_bitpos ()))
|
||||
fprintf_filtered
|
||||
(stream, " %ps",
|
||||
styled_string (variable_name_style.style (),
|
||||
@ -1223,7 +1223,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
|
||||
else
|
||||
{
|
||||
unsigned field_len = TYPE_FIELD_BITSIZE (type, field);
|
||||
ULONGEST field_val = val >> TYPE_FIELD_BITPOS (type, field);
|
||||
ULONGEST field_val = val >> type->field (field).loc_bitpos ();
|
||||
|
||||
if (field_len < sizeof (ULONGEST) * TARGET_CHAR_BIT)
|
||||
field_val &= ((ULONGEST) 1 << field_len) - 1;
|
||||
|
12
gdb/value.c
12
gdb/value.c
@ -3044,7 +3044,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
|
||||
bit. Assume that the address, offset, and embedded offset
|
||||
are sufficiently aligned. */
|
||||
|
||||
LONGEST bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
|
||||
LONGEST bitpos = arg_type->field (fieldno).loc_bitpos ();
|
||||
LONGEST container_bitsize = TYPE_LENGTH (type) * 8;
|
||||
|
||||
v = allocate_value_lazy (type);
|
||||
@ -3082,7 +3082,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
|
||||
value_address (arg1),
|
||||
arg1);
|
||||
else
|
||||
boffset = TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
|
||||
boffset = arg_type->field (fieldno).loc_bitpos () / 8;
|
||||
|
||||
if (value_lazy (arg1))
|
||||
v = allocate_value_lazy (value_enclosing_type (arg1));
|
||||
@ -3110,7 +3110,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
|
||||
else
|
||||
{
|
||||
/* Plain old data member */
|
||||
offset += (TYPE_FIELD_BITPOS (arg_type, fieldno)
|
||||
offset += (arg_type->field (fieldno).loc_bitpos ()
|
||||
/ (HOST_CHAR_BIT * unit_size));
|
||||
|
||||
/* Lazy register values with offsets are not supported. */
|
||||
@ -3274,7 +3274,7 @@ unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
|
||||
LONGEST embedded_offset, int fieldno,
|
||||
const struct value *val, LONGEST *result)
|
||||
{
|
||||
int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
|
||||
int bitpos = type->field (fieldno).loc_bitpos ();
|
||||
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
|
||||
struct type *field_type = type->field (fieldno).type ();
|
||||
int bit_offset;
|
||||
@ -3297,7 +3297,7 @@ unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
|
||||
LONGEST
|
||||
unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
|
||||
{
|
||||
int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
|
||||
int bitpos = type->field (fieldno).loc_bitpos ();
|
||||
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
|
||||
struct type *field_type = type->field (fieldno).type ();
|
||||
|
||||
@ -3362,7 +3362,7 @@ value_field_bitfield (struct type *type, int fieldno,
|
||||
const gdb_byte *valaddr,
|
||||
LONGEST embedded_offset, const struct value *val)
|
||||
{
|
||||
int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
|
||||
int bitpos = type->field (fieldno).loc_bitpos ();
|
||||
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
|
||||
struct value *res_val = allocate_value (type->field (fieldno).type ());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user