type_allocator alloc (gdbarch);
tdep->void_type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
tdep->func_void_type = make_function_type (tdep->void_type, NULL);
- tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL,
+ tdep->pc_type = init_pointer_type (alloc, 4 * TARGET_CHAR_BIT, NULL,
tdep->func_void_type);
set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
case DW_ATE_address:
/* Turn DW_ATE_address into a void * pointer. */
type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL);
- type = init_pointer_type (objfile, bits, name, type);
+ type = init_pointer_type (alloc, bits, name, type);
break;
case DW_ATE_boolean:
type = init_boolean_type (alloc, bits, 1, name);
type_allocator alloc (gdbarch);
void_type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
func_void_type = make_function_type (void_type, NULL);
- tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL,
+ tdep->pc_type = init_pointer_type (alloc, 4 * TARGET_CHAR_BIT, NULL,
func_void_type);
tdep->pc_type->set_instance_flags (tdep->pc_type->instance_flags ()
| TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1);
return TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type;
}
-/* Allocate a TYPE_CODE_PTR type structure associated with OBJFILE.
- BIT is the pointer type size in bits. NAME is the type name.
- TARGET_TYPE is the pointer target type. Always sets the pointer type's
- TYPE_UNSIGNED flag. */
+/* See gdbtypes.h. */
struct type *
-init_pointer_type (struct objfile *objfile,
+init_pointer_type (type_allocator &alloc,
int bit, const char *name, struct type *target_type)
{
struct type *t;
- t = type_allocator (objfile).new_type (TYPE_CODE_PTR, bit, name);
+ t = alloc.new_type (TYPE_CODE_PTR, bit, name);
t->set_target_type (target_type);
t->set_is_unsigned (true);
return t;
\f
/* Helper functions to initialize architecture-specific types. */
-/* Allocate a TYPE_CODE_PTR type structure associated with GDBARCH.
- BIT is the pointer type size in bits. NAME is the type name.
- TARGET_TYPE is the pointer target type. Always sets the pointer type's
- TYPE_UNSIGNED flag. */
-
-struct type *
-arch_pointer_type (struct gdbarch *gdbarch,
- int bit, const char *name, struct type *target_type)
-{
- struct type *t;
-
- t = type_allocator (gdbarch).new_type (TYPE_CODE_PTR, bit, name);
- t->set_target_type (target_type);
- t->set_is_unsigned (true);
- return t;
-}
-
/* Allocate a TYPE_CODE_FLAGS type structure associated with GDBARCH.
NAME is the type name. BIT is the size of the flag word in bits. */
objfile_type->nodebug_text_gnu_ifunc_symbol->set_is_gnu_ifunc (true);
objfile_type->nodebug_got_plt_symbol
- = init_pointer_type (objfile, gdbarch_addr_bit (gdbarch),
+ = init_pointer_type (alloc, gdbarch_addr_bit (gdbarch),
"<text from jump slot in .got.plt, no debug info>",
objfile_type->nodebug_text_symbol);
objfile_type->nodebug_data_symbol
extern bool can_create_complex_type (struct type *);
extern struct type *init_complex_type (const char *, struct type *);
-extern struct type *init_pointer_type (struct objfile *, int, const char *,
- struct type *);
+
+/* Allocate a TYPE_CODE_PTR type structure using ALLOC.
+ BIT is the pointer type size in bits. NAME is the type name.
+ TARGET_TYPE is the pointer target type. Always sets the pointer type's
+ TYPE_UNSIGNED flag. */
+
+extern struct type *init_pointer_type (type_allocator &alloc, int bit,
+ const char *name,
+ struct type *target_type);
+
extern struct type *init_fixed_point_type (struct objfile *, int, int,
const char *);
-/* Helper functions to construct architecture-owned types. */
-extern struct type *arch_pointer_type (struct gdbarch *, int, const char *,
- struct type *);
-
/* Helper functions to construct a struct or record type. An
initially empty type is created using arch_composite_type().
Fields are then added using append_composite_type_field*(). A union
type_allocator alloc (arch);
tdep->voyd = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
tdep->ptr_voyd
- = arch_pointer_type (arch, gdbarch_ptr_bit (arch), NULL, tdep->voyd);
+ = init_pointer_type (alloc, gdbarch_ptr_bit (arch), NULL, tdep->voyd);
tdep->func_voyd = lookup_function_type (tdep->voyd);
xsnprintf (type_name, sizeof (type_name), "%s_data_addr_t",
gdbarch_bfd_arch_info (arch)->printable_name);
tdep->data_addr_reg_type
- = arch_pointer_type (arch, data_addr_reg_bits, type_name, tdep->voyd);
+ = init_pointer_type (alloc, data_addr_reg_bits, type_name, tdep->voyd);
xsnprintf (type_name, sizeof (type_name), "%s_code_addr_t",
gdbarch_bfd_arch_info (arch)->printable_name);
tdep->code_addr_reg_type
- = arch_pointer_type (arch, code_addr_reg_bits, type_name, tdep->func_voyd);
+ = init_pointer_type (alloc, code_addr_reg_bits, type_name,
+ tdep->func_voyd);
tdep->uint8 = init_integer_type (alloc, 8, 1, "uint8_t");
tdep->uint16 = init_integer_type (alloc, 16, 1, "uint16_t");
break;
case btAdr:
- tp = init_pointer_type (objfile, 32, "adr_32",
+ tp = init_pointer_type (alloc, 32, "adr_32",
objfile_type (objfile)->builtin_void);
break;
break;
case btAdr64:
- tp = init_pointer_type (objfile, 64, "adr_64",
+ tp = init_pointer_type (alloc, 64, "adr_64",
objfile_type (objfile)->builtin_void);
break;
tdep->rl78_int32 = init_integer_type (alloc, 32, 0, "int32_t");
tdep->rl78_data_pointer
- = arch_pointer_type (gdbarch, 16, "rl78_data_addr_t", tdep->rl78_void);
+ = init_pointer_type (alloc, 16, "rl78_data_addr_t", tdep->rl78_void);
tdep->rl78_code_pointer
- = arch_pointer_type (gdbarch, 32, "rl78_code_addr_t", tdep->rl78_void);
+ = init_pointer_type (alloc, 32, "rl78_code_addr_t", tdep->rl78_void);
/* Registers. */
set_gdbarch_num_regs (gdbarch, RL78_NUM_REGS);
wchar_type = init_integer_type (alloc, 16,
1, "wchar_t");
void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
- wchar_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
- NULL, wchar_type);
+ wchar_ptr_type = init_pointer_type (alloc, gdbarch_ptr_bit (gdbarch),
+ nullptr, wchar_type);
/* list entry */
append_composite_type_field (rupp_type, "shell_info", uni_str_type);
append_composite_type_field (rupp_type, "runtime_data", uni_str_type);
- rupp_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
- NULL, rupp_type);
+ rupp_ptr_type = init_pointer_type (alloc, gdbarch_ptr_bit (gdbarch),
+ nullptr, rupp_type);
/* struct process environment block */
type_allocator alloc (gdbarch);
dword_type = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
1, "DWORD");
- pvoid_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), "PVOID",
+ pvoid_type = init_pointer_type (alloc, gdbarch_ptr_bit (gdbarch), "PVOID",
builtin_type (gdbarch)->builtin_void);
ulongptr_type = init_integer_type (alloc, gdbarch_ptr_bit (gdbarch),
1, "ULONG_PTR");
siginfo_type = arch_composite_type (gdbarch, "EXCEPTION_RECORD",
TYPE_CODE_STRUCT);
- siginfo_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
- NULL, siginfo_type);
+ siginfo_ptr_type = init_pointer_type (alloc, gdbarch_ptr_bit (gdbarch),
+ nullptr, siginfo_type);
/* ExceptionCode is documented as type DWORD, but here a helper
enum type is used instead to display a human-readable value. */
tdep->void_type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT,
"void");
tdep->func_void_type = make_function_type (tdep->void_type, NULL);
- tdep->pc_type = arch_pointer_type (gdbarch,
+ tdep->pc_type = init_pointer_type (alloc,
tdep->addr_length * TARGET_CHAR_BIT,
NULL, tdep->func_void_type);