gdb: rename get_type_arch to type::arch

... and update all users.

gdb/ChangeLog:

	* gdbtypes.h (get_type_arch): Rename to...
	(struct type) <arch>: ... this, update all users.

Change-Id: I0e3ef938a0afe798ac0da74a9976bbd1d082fc6f
This commit is contained in:
Simon Marchi 2021-01-28 10:12:10 -05:00
parent 6ac373717c
commit 8ee511afd8
30 changed files with 101 additions and 110 deletions

View File

@ -1,3 +1,8 @@
2021-01-28 Simon Marchi <simon.marchi@polymtl.ca>
* gdbtypes.h (get_type_arch): Rename to...
(struct type) <arch>: ... this, update all users.
2021-01-28 Simon Marchi <simon.marchi@polymtl.ca>
* gdbtypes.h (struct type) <arch>: Rename to...

View File

@ -4525,13 +4525,12 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
static CORE_ADDR
value_pointer (struct value *value, struct type *type)
{
struct gdbarch *gdbarch = get_type_arch (type);
unsigned len = TYPE_LENGTH (type);
gdb_byte *buf = (gdb_byte *) alloca (len);
CORE_ADDR addr;
addr = value_address (value);
gdbarch_address_to_pointer (gdbarch, type, buf, addr);
gdbarch_address_to_pointer (type->arch (), type, buf, addr);
addr = extract_unsigned_integer (buf, len, type_byte_order (type));
return addr;
}
@ -11234,7 +11233,7 @@ ada_is_system_address_type (struct type *type)
static struct type *
ada_scaling_type (struct type *type)
{
return builtin_type (get_type_arch (type))->builtin_long_double;
return builtin_type (type->arch ())->builtin_long_double;
}
/* Assuming that TYPE is the representation of an Ada fixed-point

View File

@ -788,7 +788,7 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
so we have to work-around this deficiency by handling
System.Address values as a special case. */
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
CORE_ADDR addr = extract_typed_address (valaddr, ptr_type);

View File

@ -1982,7 +1982,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
;
*tmp = loc;
loc->gdbarch = get_type_arch (value_type (v));
loc->gdbarch = value_type (v)->arch ();
loc->pspace = frame_pspace;
loc->address = address_significant (loc->gdbarch, addr);

View File

@ -149,7 +149,7 @@ c_emit_char (int c, struct type *type,
{
const char *encoding;
classify_type (type, get_type_arch (type), &encoding);
classify_type (type, type->arch (), &encoding);
generic_emit_char (c, type, stream, quoter, encoding);
}
@ -161,7 +161,7 @@ language_defn::printchar (int c, struct type *type,
{
c_string_type str_type;
str_type = classify_type (type, get_type_arch (type), NULL);
str_type = classify_type (type, type->arch (), NULL);
switch (str_type)
{
case C_CHAR:
@ -199,7 +199,7 @@ c_printstr (struct ui_file *stream, struct type *type,
const char *type_encoding;
const char *encoding;
str_type = (classify_type (type, get_type_arch (type), &type_encoding)
str_type = (classify_type (type, type->arch (), &type_encoding)
& ~C_CHAR);
switch (str_type)
{
@ -279,7 +279,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
if (! c_textual_element_type (element_type, 0))
goto error;
classify_type (element_type, get_type_arch (element_type), charset);
classify_type (element_type, element_type->arch (), charset);
width = TYPE_LENGTH (element_type);
/* If the string lives in GDB's memory instead of the inferior's,

View File

@ -528,7 +528,7 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
}
address_space_id
= address_space_type_instance_flags_to_name (get_type_arch (type),
= address_space_type_instance_flags_to_name (type->arch (),
type->instance_flags ());
if (address_space_id)
{

View File

@ -144,7 +144,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
const struct value_print_options *options)
{
int want_space = 0;
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
if (elttype->code () == TYPE_CODE_FUNC)
{
@ -333,7 +333,6 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
}
struct type *type = check_typedef (value_type (val));
struct gdbarch *arch = get_type_arch (type);
const gdb_byte *valaddr = value_contents_for_printing (val);
if (options->vtblprint && cp_is_vtbl_ptr_type (type))
@ -344,7 +343,7 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
TYPE_CODE_STRUCT.) */
CORE_ADDR addr = extract_typed_address (valaddr, type);
print_function_pointer_address (options, arch, addr, stream);
print_function_pointer_address (options, type->arch (), addr, stream);
}
else
{
@ -373,13 +372,12 @@ 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.) */
struct gdbarch *gdbarch = get_type_arch (type);
int offset = TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8;
struct type *field_type = type->field (VTBL_FNADDR_OFFSET).type ();
const gdb_byte *valaddr = value_contents_for_printing (val);
CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);
print_function_pointer_address (options, gdbarch, addr, stream);
print_function_pointer_address (options, type->arch (), addr, stream);
}
else
cp_print_value_fields (val, stream, recurse, options, NULL, 0);

View File

@ -324,7 +324,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
i_offset += value_embedded_offset (val);
addr = extract_typed_address (valaddr + i_offset, i_type);
print_function_pointer_address (opts,
get_type_arch (type),
type->arch (),
addr, stream);
}
}

View File

@ -52,8 +52,8 @@ class fortran_array_offset_calculator
m_stride = type_length_units (elt_type);
else
{
struct gdbarch *arch = get_type_arch (elt_type);
int unit_size = gdbarch_addressable_memory_unit_size (arch);
int unit_size
= gdbarch_addressable_memory_unit_size (elt_type->arch ());
m_stride /= (unit_size * 8);
}
};

View File

@ -82,7 +82,7 @@ f_language::get_encoding (struct type *type)
switch (TYPE_LENGTH (type))
{
case 1:
encoding = target_charset (get_type_arch (type));
encoding = target_charset (type->arch ());
break;
case 4:
if (type_byte_order (type) == BFD_ENDIAN_BIG)
@ -1416,8 +1416,8 @@ fortran_adjust_dynamic_array_base_address_hack (struct type *type,
stride = type_length_units (elt_type);
else
{
struct gdbarch *arch = get_type_arch (elt_type);
int unit_size = gdbarch_addressable_memory_unit_size (arch);
int unit_size
= gdbarch_addressable_memory_unit_size (elt_type->arch ());
stride /= (unit_size * 8);
}

View File

@ -242,8 +242,8 @@ f_language::f_type_print_varspec_suffix (struct type *type,
fprintf_filtered (stream, ") ");
fprintf_filtered (stream, "(");
if (nfields == 0 && type->is_prototyped ())
print_type (builtin_f_type (get_type_arch (type))->builtin_void,
"", stream, -1, 0, 0);
print_type (builtin_f_type (type->arch ())->builtin_void,
"", stream, -1, 0, 0);
else
for (i = 0; i < nfields; i++)
{
@ -342,8 +342,7 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
case TYPE_CODE_VOID:
{
gdbarch *gdbarch = get_type_arch (type);
struct type *void_type = builtin_f_type (gdbarch)->builtin_void;
struct type *void_type = builtin_f_type (type->arch ())->builtin_void;
fprintf_filtered (stream, "%*s%s", level, "", void_type->name ());
}
break;

View File

@ -218,7 +218,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
const struct value_print_options *options) const
{
struct type *type = check_typedef (value_type (val));
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
int printed_field = 0; /* Number of fields printed. */
struct type *elttype;
CORE_ADDR addr;

View File

@ -158,7 +158,7 @@ extract_typed_address (const gdb_byte *buf, struct type *type)
_("extract_typed_address: "
"type is not a pointer or reference"));
return gdbarch_pointer_to_address (get_type_arch (type), type, buf);
return gdbarch_pointer_to_address (type->arch (), type, buf);
}
/* All 'store' functions accept a host-format integer and store a
@ -211,7 +211,7 @@ store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
_("store_typed_address: "
"type is not a pointer or reference"));
gdbarch_address_to_pointer (get_type_arch (type), type, buf, addr);
gdbarch_address_to_pointer (type->arch (), type, buf, addr);
}
/* Copy a value from SOURCE of size SOURCE_SIZE bytes to DEST of size DEST_SIZE

View File

@ -232,24 +232,23 @@ alloc_type_copy (const struct type *type)
return alloc_type_arch (type->arch_owner ());
}
/* If TYPE is gdbarch-associated, return that architecture.
If TYPE is objfile-associated, return that objfile's architecture. */
/* See gdbtypes.h. */
struct gdbarch *
get_type_arch (const struct type *type)
gdbarch *
type::arch () const
{
struct gdbarch *arch;
if (type->is_objfile_owned ())
arch = type->objfile_owner ()->arch ();
if (this->is_objfile_owned ())
arch = this->objfile_owner ()->arch ();
else
arch = type->arch_owner ();
arch = this->arch_owner ();
/* The ARCH can be NULL if TYPE is associated with neither an objfile nor
a gdbarch, however, this is very rare, and even then, in most cases
that get_type_arch is called, we assume that a non-NULL value is
that type::arch is called, we assume that a non-NULL value is
returned. */
gdb_assert (arch != NULL);
gdb_assert (arch != nullptr);
return arch;
}
@ -273,8 +272,7 @@ get_target_type (struct type *type)
unsigned int
type_length_units (struct type *type)
{
struct gdbarch *arch = get_type_arch (type);
int unit_size = gdbarch_addressable_memory_unit_size (arch);
int unit_size = gdbarch_addressable_memory_unit_size (type->arch ());
return TYPE_LENGTH (type) / unit_size;
}
@ -291,7 +289,7 @@ alloc_type_instance (struct type *oldtype)
/* Allocate the structure. */
if (!oldtype->is_objfile_owned ())
type = GDBARCH_OBSTACK_ZALLOC (get_type_arch (oldtype), struct type);
type = GDBARCH_OBSTACK_ZALLOC (oldtype->arch_owner (), struct type);
else
type = OBSTACK_ZALLOC (&oldtype->objfile_owner ()->objfile_obstack,
struct type);
@ -371,8 +369,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
/* FIXME! Assumes the machine has only one representation for pointers! */
TYPE_LENGTH (ntype)
= gdbarch_ptr_bit (get_type_arch (type)) / TARGET_CHAR_BIT;
TYPE_LENGTH (ntype) = gdbarch_ptr_bit (type->arch ()) / TARGET_CHAR_BIT;
ntype->set_code (TYPE_CODE_PTR);
/* Mark pointers as unsigned. The target converts between pointers
@ -455,8 +452,7 @@ make_reference_type (struct type *type, struct type **typeptr,
references, and that it matches the (only) representation for
pointers! */
TYPE_LENGTH (ntype) =
gdbarch_ptr_bit (get_type_arch (type)) / TARGET_CHAR_BIT;
TYPE_LENGTH (ntype) = gdbarch_ptr_bit (type->arch ()) / TARGET_CHAR_BIT;
ntype->set_code (refcode);
*reftype = ntype;
@ -1617,8 +1613,7 @@ smash_to_memberptr_type (struct type *type, struct type *self_type,
set_type_self_type (type, self_type);
/* Assume that a data member pointer is the same size as a normal
pointer. */
TYPE_LENGTH (type)
= gdbarch_ptr_bit (get_type_arch (to_type)) / TARGET_CHAR_BIT;
TYPE_LENGTH (type) = gdbarch_ptr_bit (to_type->arch ()) / TARGET_CHAR_BIT;
}
/* Smash TYPE to be a type of pointer to methods type TO_TYPE.
@ -2228,7 +2223,7 @@ resolve_dynamic_range (struct type *dyn_range_type,
I really don't think this is going to work with current GDB, the
array indexing code in GDB seems to be pretty heavily tied to byte
offsets right now. Assuming 8 bits in a byte. */
struct gdbarch *gdbarch = get_type_arch (dyn_range_type);
struct gdbarch *gdbarch = dyn_range_type->arch ();
int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
if (!byte_stride_p && (value % (unit_size * 8)) != 0)
error (_("bit strides that are not a multiple of the byte size "
@ -2903,7 +2898,7 @@ check_typedef (struct type *type)
if (sym)
TYPE_TARGET_TYPE (type) = SYMBOL_TYPE (sym);
else /* TYPE_CODE_UNDEF */
TYPE_TARGET_TYPE (type) = alloc_type_arch (get_type_arch (type));
TYPE_TARGET_TYPE (type) = alloc_type_arch (type->arch ());
}
type = TYPE_TARGET_TYPE (type);
@ -3071,7 +3066,7 @@ safe_parse_type (struct gdbarch *gdbarch, const char *p, int length)
static void
check_stub_method (struct type *type, int method_id, int signature_id)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
struct fn_field *f;
char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
char *demangled_name = gdb_demangle (mangled_name,
@ -3510,8 +3505,7 @@ type_align (struct type *type)
return raw_align;
/* Allow the architecture to provide an alignment. */
struct gdbarch *arch = get_type_arch (type);
ULONGEST align = gdbarch_type_align (arch, type);
ULONGEST align = gdbarch_type_align (type->arch (), type);
if (align != 0)
return align;
@ -3878,7 +3872,7 @@ is_unique_ancestor (struct type *base, struct value *val)
enum bfd_endian
type_byte_order (const struct type *type)
{
bfd_endian byteorder = gdbarch_byte_order (get_type_arch (type));
bfd_endian byteorder = gdbarch_byte_order (type->arch ());
if (type->endianity_is_not_default ())
{
if (byteorder == BFD_ENDIAN_BIG)
@ -5505,7 +5499,7 @@ copy_type_recursive (struct objfile *objfile,
if (*slot != NULL)
return ((struct type_pair *) *slot)->newobj;
new_type = alloc_type_arch (get_type_arch (type));
new_type = alloc_type_arch (type->arch ());
/* We must add the new type to the hash table immediately, in case
we encounter this type again during a recursive call below. */
@ -5518,7 +5512,7 @@ copy_type_recursive (struct objfile *objfile,
copy the entire thing and then update specific fields as needed. */
*TYPE_MAIN_TYPE (new_type) = *TYPE_MAIN_TYPE (type);
new_type->set_owner (get_type_arch (type));
new_type->set_owner (type->arch ());
if (type->name ())
new_type->set_name (xstrdup (type->name ()));
@ -5844,10 +5838,8 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
void
append_flags_type_flag (struct type *type, int bitpos, const char *name)
{
struct gdbarch *gdbarch = get_type_arch (type);
append_flags_type_field (type, bitpos, 1,
builtin_type (gdbarch)->builtin_bool,
builtin_type (type->arch ())->builtin_bool,
name);
}

View File

@ -1282,6 +1282,13 @@ struct type
return this->main_type->m_owner.gdbarch;
}
/* Return the type's architecture. For types owned by an
architecture, that architecture is returned. For types owned by an
objfile, that objfile's architecture is returned.
The return value is always non-nullptr. */
gdbarch *arch () const;
/* * Return true if this is an integer type whose logical (bit) size
differs from its storage size; false otherwise. Always return
false for non-integer (i.e., non-TYPE_SPECIFIC_INT) types. */
@ -2258,12 +2265,6 @@ extern struct type *alloc_type (struct objfile *);
extern struct type *alloc_type_arch (struct gdbarch *);
extern struct type *alloc_type_copy (const struct type *);
/* * Return the type's architecture. For types owned by an
architecture, that architecture is returned. For types owned by an
objfile, that objfile's architecture is returned. */
extern struct gdbarch *get_type_arch (const struct type *);
/* * This returns the target type (or NULL) of TYPE, also skipping
past typedefs. */
@ -2661,9 +2662,9 @@ extern bool is_fixed_point_type (struct type *type);
extern void allocate_fixed_point_type_info (struct type *type);
/* * When the type includes explicit byte ordering, return that.
Otherwise, the byte ordering from gdbarch_byte_order for
get_type_arch is returned. */
Otherwise, the byte ordering from gdbarch_byte_order for
the type's arch is returned. */
extern enum bfd_endian type_byte_order (const struct type *type);
/* A flag to enable printing of debugging information of C++

View File

@ -308,7 +308,7 @@ gnuv3_rtti_type (struct value *value,
return NULL;
/* Determine architecture. */
gdbarch = get_type_arch (values_type);
gdbarch = values_type->arch ();
if (using_enc_p)
*using_enc_p = 0;
@ -422,7 +422,7 @@ gnuv3_virtual_fn_field (struct value **value_p,
error (_("Only classes can have virtual functions."));
/* Determine architecture. */
gdbarch = get_type_arch (values_type);
gdbarch = values_type->arch ();
/* Cast our value to the base class which defines this virtual
function. This takes care of any necessary `this'
@ -454,7 +454,7 @@ gnuv3_baseclass_offset (struct type *type, int index,
long int cur_base_offset, base_offset;
/* Determine architecture. */
gdbarch = get_type_arch (type);
gdbarch = type->arch ();
ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
/* If it isn't a virtual base, this is easy. The offset is in the
@ -611,7 +611,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
struct ui_file *stream)
{
struct type *self_type = TYPE_SELF_TYPE (type);
struct gdbarch *gdbarch = get_type_arch (self_type);
struct gdbarch *gdbarch = self_type->arch ();
CORE_ADDR ptr_value;
LONGEST adjustment;
int vbit;
@ -691,9 +691,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
static int
gnuv3_method_ptr_size (struct type *type)
{
struct gdbarch *gdbarch = get_type_arch (type);
return 2 * TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
return 2 * TYPE_LENGTH (builtin_type (type->arch ())->builtin_data_ptr);
}
/* GNU v3 implementation of cplus_make_method_ptr. */
@ -702,7 +700,7 @@ static void
gnuv3_make_method_ptr (struct type *type, gdb_byte *contents,
CORE_ADDR value, int is_virtual)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
enum bfd_endian byte_order = type_byte_order (type);
@ -745,7 +743,7 @@ gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
method_type = TYPE_TARGET_TYPE (check_typedef (value_type (method_ptr)));
/* Extract the pointer to member. */
gdbarch = get_type_arch (self_type);
gdbarch = self_type->arch ();
vbit = gnuv3_decode_method_ptr (gdbarch, contents, &ptr_value, &adjustment);
/* First convert THIS to match the containing type of the pointer to
@ -978,7 +976,7 @@ gnuv3_print_vtable (struct value *value)
type = check_typedef (value_type (value));
}
gdbarch = get_type_arch (type);
gdbarch = type->arch ();
vtable = NULL;
if (type->code () == TYPE_CODE_STRUCT)
@ -1107,7 +1105,7 @@ gnuv3_get_typeid (struct value *value)
/* Ignore top-level cv-qualifiers. */
type = make_cv_type (0, 0, type, NULL);
gdbarch = get_type_arch (type);
gdbarch = type->arch ();
type_name = type_to_string (type);
if (type_name.empty ())
@ -1161,7 +1159,7 @@ gnuv3_get_typeid (struct value *value)
static std::string
gnuv3_get_typename_from_type_info (struct value *type_info_ptr)
{
struct gdbarch *gdbarch = get_type_arch (value_type (type_info_ptr));
struct gdbarch *gdbarch = value_type (type_info_ptr)->arch ();
struct bound_minimal_symbol typeinfo_sym;
CORE_ADDR addr;
const char *symname;

View File

@ -43,7 +43,7 @@ print_go_string (struct type *type,
struct value *val,
const struct value_print_options *options)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
struct type *elt_ptr_type = type->field (0).type ();
struct type *elt_type = TYPE_TARGET_TYPE (elt_ptr_type);
LONGEST length;

View File

@ -949,7 +949,7 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
const struct language_defn *language)
{
struct type *type = value_type (value);
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
SCM exception = SCM_BOOL_F;
SCM printer = SCM_BOOL_F;
SCM val_obj = SCM_BOOL_F;

View File

@ -671,7 +671,7 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
struct value *index
= vlscm_convert_value_from_scheme (FUNC_NAME, SCM_ARG2, index_scm,
&except_scm,
get_type_arch (type),
type->arch (),
current_language);
if (index == NULL)
return except_scm;

View File

@ -251,7 +251,7 @@ find_function_addr (struct value *function,
struct type **function_type)
{
struct type *ftype = check_typedef (value_type (function));
struct gdbarch *gdbarch = get_type_arch (ftype);
struct gdbarch *gdbarch = ftype->arch ();
struct type *value_type = NULL;
/* Initialize it just to avoid a GCC false warning. */
CORE_ADDR funaddr = 0;

View File

@ -186,7 +186,7 @@ print_unpacked_pointer (struct type *type,
const struct value_print_options *options,
struct ui_file *stream)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
int want_space = 0;
@ -228,7 +228,7 @@ print_variable_at_address (struct type *type,
int recurse,
const struct value_print_options *options)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
CORE_ADDR addr = unpack_pointer (type, valaddr);
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));

View File

@ -70,7 +70,7 @@ pascal_language::value_print_inner (struct value *val,
{
struct type *type = check_typedef (value_type (val));
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
enum bfd_endian byte_order = type_byte_order (type);
unsigned int i = 0; /* Number of characters printed */
unsigned len;

View File

@ -304,7 +304,7 @@ print_formatted (struct value *val, int size,
/* We often wrap here if there are long symbolic names. */
wrap_here (" ");
next_address = (value_address (val)
+ gdb_print_insn (get_type_arch (type),
+ gdb_print_insn (type->arch (),
value_address (val), stream,
&branch_delay_insns));
return;
@ -331,7 +331,7 @@ print_formatted (struct value *val, int size,
static struct type *
float_type_from_length (struct type *type)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
const struct builtin_type *builtin = builtin_type (gdbarch);
if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_float))
@ -353,7 +353,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
const struct value_print_options *options,
int size, struct ui_file *stream)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
unsigned int len = TYPE_LENGTH (type);
enum bfd_endian byte_order = type_byte_order (type);
@ -2370,7 +2370,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
{
const gdb_byte *str;
size_t len;
struct gdbarch *gdbarch = get_type_arch (value_type (value));
struct gdbarch *gdbarch = value_type (value)->arch ();
struct type *wctype = lookup_typename (current_language,
"wchar_t", NULL, 0);
int wcwidth = TYPE_LENGTH (wctype);
@ -2438,7 +2438,7 @@ printf_floating (struct ui_file *stream, const char *format,
{
/* Parameter data. */
struct type *param_type = value_type (value);
struct gdbarch *gdbarch = get_type_arch (param_type);
struct gdbarch *gdbarch = param_type->arch ();
/* Determine target type corresponding to the format string. */
struct type *fmt_type;
@ -2644,8 +2644,7 @@ ui_printf (const char *arg, struct ui_file *stream)
break;
case wide_char_arg:
{
struct gdbarch *gdbarch
= get_type_arch (value_type (val_args[i]));
struct gdbarch *gdbarch = value_type (val_args[i])->arch ();
struct type *wctype = lookup_typename (current_language,
"wchar_t", NULL, 0);
struct type *valtype;

View File

@ -564,7 +564,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
const struct language_defn *language)
{
struct type *type = value_type (value);
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
enum string_repr_result print_result;
if (value_lazy (value))

View File

@ -516,7 +516,7 @@ rust_language::value_print_inner
that. */
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
CORE_ADDR addr = value_as_address (val);
struct gdbarch *arch = get_type_arch (type);
struct gdbarch *arch = type->arch ();
if (opts.addressprint)
{
@ -1919,7 +1919,7 @@ rust_language::emitchar (int ch, struct type *chtype,
{
if (!rust_chartype_p (chtype))
generic_emit_char (ch, chtype, stream, quoter,
target_charset (get_type_arch (chtype)));
target_charset (chtype->arch ()));
else if (ch == '\\' || ch == quoter)
fprintf_filtered (stream, "\\%c", ch);
else if (ch == '\n')

View File

@ -202,7 +202,7 @@ value_subscripted_rvalue (struct value *array, LONGEST index, LONGEST lowerbound
LONGEST stride = array_type->bit_stride ();
if (stride != 0)
{
struct gdbarch *arch = get_type_arch (elt_type);
struct gdbarch *arch = elt_type->arch ();
int unit_size = gdbarch_addressable_memory_unit_size (arch);
elt_size = stride / (unit_size * 8);
}
@ -539,7 +539,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
struct value *
value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
{
struct gdbarch *gdbarch = get_type_arch (value_type (arg1));
struct gdbarch *gdbarch = value_type (arg1)->arch ();
char *ptr;
char tstr[13], mangle_tstr[13];
int static_memfuncp, nargs;
@ -900,7 +900,7 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
struct type *type2 = check_typedef (value_type (arg2));
const struct language_defn *language = current_language;
struct gdbarch *gdbarch = get_type_arch (type1);
struct gdbarch *gdbarch = type1->arch ();
struct value *val;
gdb_mpq v1, v2, res;
@ -1967,7 +1967,7 @@ value_complement (struct value *arg1)
int
value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
LONGEST low_bound, high_bound;
LONGEST word;
unsigned rel_index;

View File

@ -590,7 +590,7 @@ value_cast (struct type *type, struct value *arg2)
otherwise occur when dealing with a target having two byte
pointers and four byte addresses. */
int addr_bit = gdbarch_addr_bit (get_type_arch (type2));
int addr_bit = gdbarch_addr_bit (type2->arch ());
LONGEST longest = value_as_long (arg2);
if (addr_bit < sizeof (LONGEST) * HOST_CHAR_BIT)
@ -1100,7 +1100,7 @@ value_assign (struct value *toval, struct value *fromval)
{
case lval_internalvar:
set_internalvar (VALUE_INTERNALVAR (toval), fromval);
return value_of_internalvar (get_type_arch (type),
return value_of_internalvar (type->arch (),
VALUE_INTERNALVAR (toval));
case lval_internalvar_component:

View File

@ -408,7 +408,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
CORE_ADDR address, struct ui_file *stream,
const struct value_print_options *options)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
if (elttype->code () == TYPE_CODE_FUNC)
{
@ -483,7 +483,7 @@ static void
print_ref_address (struct type *type, const gdb_byte *address_buffer,
int embedded_offset, struct ui_file *stream)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
if (address_buffer != NULL)
{
@ -673,7 +673,7 @@ generic_val_print_enum (struct type *type,
const struct value_print_options *options)
{
LONGEST val;
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
gdb_assert (!options->format);
@ -694,7 +694,7 @@ generic_val_print_func (struct type *type,
struct value *original_value,
const struct value_print_options *options)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
gdb_assert (!options->format);
@ -1182,7 +1182,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
+ embedded_offset);
ULONGEST val = unpack_long (type, valaddr);
int field, nfields = type->num_fields ();
struct gdbarch *gdbarch = get_type_arch (type);
struct gdbarch *gdbarch = type->arch ();
struct type *bool_type = builtin_type (gdbarch)->builtin_bool;
fputs_filtered ("[", stream);
@ -2713,7 +2713,7 @@ val_print_string (struct type *elttype, const char *encoding,
unsigned int fetchlimit; /* Maximum number of chars to print. */
int bytes_read;
gdb::unique_xmalloc_ptr<gdb_byte> buffer; /* Dynamically growable fetch buffer. */
struct gdbarch *gdbarch = get_type_arch (elttype);
struct gdbarch *gdbarch = elttype->arch ();
enum bfd_endian byte_order = type_byte_order (elttype);
int width = TYPE_LENGTH (elttype);

View File

@ -363,7 +363,7 @@ struct value
struct gdbarch *
get_value_arch (const struct value *value)
{
return get_type_arch (value_type (value));
return value_type (value)->arch ();
}
int
@ -2674,7 +2674,7 @@ value_as_long (struct value *val)
CORE_ADDR
value_as_address (struct value *val)
{
struct gdbarch *gdbarch = get_type_arch (value_type (val));
struct gdbarch *gdbarch = value_type (val)->arch ();
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */

View File

@ -2207,7 +2207,7 @@ varobj_value_get_print_value (struct value *value,
thevalue = std::string (s.get ());
len = thevalue.size ();
gdbarch = get_type_arch (value_type (value));
gdbarch = value_type (value)->arch ();
type = builtin_type (gdbarch)->builtin_char;
if (!string_print)