[rfc][25/37] Eliminate builtin_type_ macros: Update *-tdep.c files

uweigand
2008-08-31T18:16:23Z

[-- Attachment #1: diff-type-tdep --]
[-- Type: text/plain, Size: 36871 bytes --]

Hello,

this patch removes all instances of builtin_type_ macros from all
*-tdep.c files. This is completely straigtforward as we always
have a gdbarch to work with.

Bye,
Ulrich

ChangeLog:

* alpha-tdep.c (alpha_register_type): Use builtin_type (gdbarch)
instead of builtin_type_ macros.
* amd64-tdep.c (amd64_register_type): Likewise.
(amd64_get_longjmp_target): Likewise.
* arm-tdep.c (arm_register_type): Likewise.
* avr-tdep.c (avr_register_type): Likewise.
* cris-tdep.c (cris_register_type, crisv32_register_type): Likewise.
* frv-tdep.c (frv_register_type): Likewise.
* h8300-tdep.c (h8300_register_type): Likewise.
* hppa-tdep.c (hppa32_convert_from_func_ptr_addr,
hppa_skip_trampoline_code): Likewise.
* i386-tdep.c (i386_register_type): Likewise.
(i386_unwind_pc, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_register_type): Likewise.
* m32r-tdep.c (m32r_register_type): Likewise.
* m68k-tdep.c (m68k_register_type, m68k_unwind_pc): Likewise.
* m88k-tdep.c (m88k_register_type): Likewise.
* mep-tdep.c (mep_register_type): Likewise.
* mips-tdep.c (mips_pseudo_register_type): Likewise.
* mn10300-tdep.c (mn10300_register_type): Likewise.
* mt-tdep.c (mt_copro_register_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64): Likewise.
(rs6000_convert_register_p, rs6000_register_to_value,
rs6000_value_to_register): Likewise.
* s390-tdep.c (s390_register_type): Likewise.
* sh64-tdep.c (sh64_register_type): Likewise.
(sh64_build_float_register_type, sh64_do_fp_register): Likewise.
* sh-tdep.c (sh_sh2a_register_type, sh_sh3e_register_type,
sh_sh4_build_float_register_type, sh_sh4_register_type,
sh_default_register_type): Likewise.
* sparc64-tdep.c (sparc64_register_type): Likewise.
* sparc-tdep.c (sparc32_register_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise.
* v850-tdep.c (v850_register_type): Likewise.
* vax-tdep.c (vax_register_type): Likewise.
* xtensa-tdep.c (xtensa_register_type, xtensa_unwind_pc,
xtensa_push_dummy_call): Likewise.

* std-regs.c (value_of_builtin_frame_fp_reg,
value_of_builtin_frame_pc_reg): Likewise.
* target-descriptions.c (tdesc_register_type): Likewise.

Index: gdb-head/gdb/alpha-tdep.c
===================================================================
--- gdb-head.orig/gdb/alpha-tdep.c
+++ gdb-head/gdb/alpha-tdep.c
@@ -95,9 +95,9 @@ static struct type *
alpha_register_type (struct gdbarch *gdbarch, int regno)
{
if (regno == ALPHA_SP_REGNUM || regno == ALPHA_GP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
if (regno == ALPHA_PC_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;

/* Don't need to worry about little vs big endian until
some jerk tries to port to alpha-unicosmk. */
Index: gdb-head/gdb/amd64-tdep.c
===================================================================
--- gdb-head.orig/gdb/amd64-tdep.c
+++ gdb-head/gdb/amd64-tdep.c
@@ -90,11 +90,11 @@ amd64_register_type (struct gdbarch *gdb
if (regnum >= AMD64_RAX_REGNUM && regnum <= AMD64_RDI_REGNUM)
return builtin_type_int64;
if (regnum == AMD64_RBP_REGNUM || regnum == AMD64_RSP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
if (regnum >= AMD64_R8_REGNUM && regnum <= AMD64_R15_REGNUM)
return builtin_type_int64;
if (regnum == AMD64_RIP_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == AMD64_EFLAGS_REGNUM)
return i386_eflags_type;
if (regnum >= AMD64_CS_REGNUM && regnum <= AMD64_GS_REGNUM)
@@ -1277,7 +1277,7 @@ amd64_get_longjmp_target (struct frame_i
CORE_ADDR jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame);
int jb_pc_offset = gdbarch_tdep (gdbarch)->jb_pc_offset;
- int len = TYPE_LENGTH (builtin_type_void_func_ptr);
+ int len = TYPE_LENGTH (builtin_type (gdbarch)->builtin_func_ptr);

/* If JB_PC_OFFSET is -1, we have no way to find out where the
longjmp will land. */
@@ -1285,11 +1285,12 @@ amd64_get_longjmp_target (struct frame_i
return 0;

get_frame_register (frame, AMD64_RDI_REGNUM, buf);
- jb_addr = extract_typed_address (buf, builtin_type_void_data_ptr);
+ jb_addr= extract_typed_address
+ (buf, builtin_type (gdbarch)->builtin_data_ptr);
if (target_read_memory (jb_addr + jb_pc_offset, buf, len))
return 0;

- *pc = extract_typed_address (buf, builtin_type_void_func_ptr);
+ *pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);

return 1;
}
Index: gdb-head/gdb/arm-tdep.c
===================================================================
--- gdb-head.orig/gdb/arm-tdep.c
+++ gdb-head/gdb/arm-tdep.c
@@ -1603,9 +1603,9 @@ arm_register_type (struct gdbarch *gdbar
if (regnum >= ARM_F0_REGNUM && regnum < ARM_F0_REGNUM + NUM_FREGS)
return builtin_type_arm_ext;
else if (regnum == ARM_SP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
else if (regnum == ARM_PC_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
else if (regnum >= ARRAY_SIZE (arm_register_names))
/* These registers are only supported on targets which supply
an XML description. */
Index: gdb-head/gdb/avr-tdep.c
===================================================================
--- gdb-head.orig/gdb/avr-tdep.c
+++ gdb-head/gdb/avr-tdep.c
@@ -213,7 +213,7 @@ avr_register_type (struct gdbarch *gdbar
if (reg_nr == AVR_PC_REGNUM)
return builtin_type_uint32;
if (reg_nr == AVR_SP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
else
return builtin_type_uint8;
}
Index: gdb-head/gdb/cris-tdep.c
===================================================================
--- gdb-head.orig/gdb/cris-tdep.c
+++ gdb-head/gdb/cris-tdep.c
@@ -1658,10 +1658,10 @@ static struct type *
cris_register_type (struct gdbarch *gdbarch, int regno)
{
if (regno == gdbarch_pc_regnum (gdbarch))
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
else if (regno == gdbarch_sp_regnum (gdbarch)
|| regno == CRIS_FP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
else if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
|| (regno >= MOF_REGNUM && regno <= USP_REGNUM))
/* Note: R8 taken care of previous clause. */
@@ -1679,10 +1679,10 @@ static struct type *
crisv32_register_type (struct gdbarch *gdbarch, int regno)
{
if (regno == gdbarch_pc_regnum (gdbarch))
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
else if (regno == gdbarch_sp_regnum (gdbarch)
|| regno == CRIS_FP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
else if ((regno >= 0 && regno <= ACR_REGNUM)
|| (regno >= EXS_REGNUM && regno <= SPC_REGNUM)
|| (regno == PID_REGNUM)
Index: gdb-head/gdb/frv-tdep.c
===================================================================
--- gdb-head.orig/gdb/frv-tdep.c
+++ gdb-head/gdb/frv-tdep.c
@@ -292,7 +292,7 @@ static struct type *
frv_register_type (struct gdbarch *gdbarch, int reg)
{
if (reg >= first_fpr_regnum && reg <= last_fpr_regnum)
- return builtin_type_float;
+ return builtin_type (gdbarch)->builtin_float;
else if (reg == iacc0_regnum)
return builtin_type_int64;
else
Index: gdb-head/gdb/h8300-tdep.c
===================================================================
--- gdb-head.orig/gdb/h8300-tdep.c
+++ gdb-head/gdb/h8300-tdep.c
@@ -1112,10 +1112,10 @@ h8300_register_type (struct gdbarch *gdb
switch (regno)
{
case E_PC_REGNUM:
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
case E_SP_REGNUM:
case E_FP_REGNUM:
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
default:
if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
return builtin_type_uint8;
Index: gdb-head/gdb/hppa-tdep.c
===================================================================
--- gdb-head.orig/gdb/hppa-tdep.c
+++ gdb-head/gdb/hppa-tdep.c
@@ -1244,8 +1244,9 @@ hppa32_convert_from_func_ptr_addr (struc
{
if (addr & 2)
{
+ struct type *func_ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
CORE_ADDR plabel = addr & ~3;
- return read_memory_typed_address (plabel, builtin_type_void_func_ptr);
+ return read_memory_typed_address (plabel, func_ptr_type);
}

return addr;
@@ -2897,6 +2898,9 @@ hppa_in_solib_call_trampoline (CORE_ADDR
CORE_ADDR
hppa_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct type *func_ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
+
unsigned int insn[HPPA_MAX_INSN_PATTERN_LEN];
int dp_rel;

@@ -2907,7 +2911,7 @@ hppa_skip_trampoline_code (struct frame_

/* PLABELs have bit 30 set; if it's a PLABEL, then dereference it. */
if (pc & 0x2)
- pc = read_memory_typed_address (pc & ~0x3, builtin_type_void_func_ptr);
+ pc = read_memory_typed_address (pc & ~0x3, func_ptr_type);

return pc;
}
@@ -2928,7 +2932,7 @@ hppa_skip_trampoline_code (struct frame_

if (in_plt_section (pc, NULL))
{
- pc = read_memory_typed_address (pc, builtin_type_void_func_ptr);
+ pc = read_memory_typed_address (pc, func_ptr_type);

/* If the PLT slot has not yet been resolved, the target will be
the PLT stub. */
@@ -2942,7 +2946,7 @@ hppa_skip_trampoline_code (struct frame_
}

/* This should point to the fixup routine. */
- pc = read_memory_typed_address (pc + 8, builtin_type_void_func_ptr);
+ pc = read_memory_typed_address (pc + 8, func_ptr_type);
}
}

Index: gdb-head/gdb/i386-tdep.c
===================================================================
--- gdb-head.orig/gdb/i386-tdep.c
+++ gdb-head/gdb/i386-tdep.c
@@ -1275,7 +1275,7 @@ i386_unwind_pc (struct gdbarch *gdbarch,
gdb_byte buf[8];

frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
- return extract_typed_address (buf, builtin_type_void_func_ptr);
+ return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
}
\f

@@ -2071,9 +2071,11 @@ i386_sse_type (struct gdbarch *gdbarch)

t = init_composite_type ("__gdb_builtin_type_vec128i", TYPE_CODE_UNION);
append_composite_type_field (t, "v4_float",
- init_vector_type (builtin_type_float, 4));
+ init_vector_type (builtin_type (gdbarch)
+ ->builtin_float, 4));
append_composite_type_field (t, "v2_double",
- init_vector_type (builtin_type_double, 2));
+ init_vector_type (builtin_type (gdbarch)
+ ->builtin_double, 2));
append_composite_type_field (t, "v16_int8",
init_vector_type (builtin_type_int8, 16));
append_composite_type_field (t, "v8_int16",
@@ -2100,13 +2102,13 @@ static struct type *
i386_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum == I386_EIP_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;

if (regnum == I386_EFLAGS_REGNUM)
return i386_eflags_type;

if (regnum == I386_EBP_REGNUM || regnum == I386_ESP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;

if (i386_fp_regnum_p (gdbarch, regnum))
return builtin_type_i387_ext;
@@ -2120,7 +2122,7 @@ i386_register_type (struct gdbarch *gdba
if (regnum == I387_MXCSR_REGNUM (gdbarch_tdep (gdbarch)))
return i386_mxcsr_type;

- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
}

/* Map a cooked register onto a raw register or memory. For the i386,
Index: gdb-head/gdb/ia64-tdep.c
===================================================================
--- gdb-head.orig/gdb/ia64-tdep.c
+++ gdb-head/gdb/ia64-tdep.c
@@ -309,7 +309,7 @@ ia64_register_type (struct gdbarch *arch
if (reg >= IA64_FR0_REGNUM && reg <= IA64_FR127_REGNUM)
return builtin_type_ia64_ext;
else
- return builtin_type_long;
+ return builtin_type (arch)->builtin_long;
}

static int
Index: gdb-head/gdb/m32r-tdep.c
===================================================================
--- gdb-head.orig/gdb/m32r-tdep.c
+++ gdb-head/gdb/m32r-tdep.c
@@ -231,9 +231,9 @@ static struct type *
m32r_register_type (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == M32R_PC_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
else if (reg_nr == M32R_SP_REGNUM || reg_nr == M32R_FP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
else
return builtin_type_int32;
}
Index: gdb-head/gdb/m68k-tdep.c
===================================================================
--- gdb-head.orig/gdb/m68k-tdep.c
+++ gdb-head/gdb/m68k-tdep.c
@@ -120,7 +120,7 @@ m68k_register_type (struct gdbarch *gdba
}

if (regnum == M68K_FPI_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;

if (regnum == M68K_FPC_REGNUM || regnum == M68K_FPS_REGNUM)
return builtin_type_int32;
@@ -132,10 +132,10 @@ m68k_register_type (struct gdbarch *gdba
}

if (regnum == gdbarch_pc_regnum (gdbarch))
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;

if (regnum >= M68K_A0_REGNUM && regnum <= M68K_A0_REGNUM + 7)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;

if (regnum == M68K_PS_REGNUM)
return m68k_ps_type;
@@ -832,7 +832,7 @@ m68k_unwind_pc (struct gdbarch *gdbarch,
gdb_byte buf[8];

frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
- return extract_typed_address (buf, builtin_type_void_func_ptr);
+ return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
}
\f
/* Normal frames. */
Index: gdb-head/gdb/m88k-tdep.c
===================================================================
--- gdb-head.orig/gdb/m88k-tdep.c
+++ gdb-head/gdb/m88k-tdep.c
@@ -75,11 +75,11 @@ m88k_register_type (struct gdbarch *gdba
/* SXIP, SNIP, SFIP and R1 contain code addresses. */
if ((regnum >= M88K_SXIP_REGNUM && regnum <= M88K_SFIP_REGNUM)
|| regnum == M88K_R1_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;

/* R30 and R31 typically contains data addresses. */
if (regnum == M88K_R30_REGNUM || regnum == M88K_R31_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;

return builtin_type_int32;
}
Index: gdb-head/gdb/mep-tdep.c
===================================================================
--- gdb-head.orig/gdb/mep-tdep.c
+++ gdb-head/gdb/mep-tdep.c
@@ -1097,14 +1097,14 @@ mep_register_type (struct gdbarch *gdbar
if (size == 32)
{
if (mep_pseudo_cr_is_float (reg_nr))
- return builtin_type_float;
+ return builtin_type (gdbarch)->builtin_float;
else
return builtin_type_uint32;
}
else if (size == 64)
{
if (mep_pseudo_cr_is_float (reg_nr))
- return builtin_type_double;
+ return builtin_type (gdbarch)->builtin_double;
else
return builtin_type_uint64;
}
Index: gdb-head/gdb/mips-tdep.c
===================================================================
--- gdb-head.orig/gdb/mips-tdep.c
+++ gdb-head/gdb/mips-tdep.c
@@ -737,12 +737,13 @@ mips_pseudo_register_type (struct gdbarc

/* 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_void_data_ptr))
+ if (mips_abi_regsize (gdbarch)
+ == TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr))
{
if (rawnum == MIPS_SP_REGNUM || rawnum == MIPS_EMBED_BADVADDR_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
else if (rawnum == MIPS_EMBED_PC_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
}

if (mips_abi_regsize (gdbarch) == 4 && TYPE_LENGTH (rawtype) == 8
Index: gdb-head/gdb/mn10300-tdep.c
===================================================================
--- gdb-head.orig/gdb/mn10300-tdep.c
+++ gdb-head/gdb/mn10300-tdep.c
@@ -265,7 +265,7 @@ am33_2_register_name (struct gdbarch *gd
static struct type *
mn10300_register_type (struct gdbarch *gdbarch, int reg)
{
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
}

static CORE_ADDR
Index: gdb-head/gdb/mt-tdep.c
===================================================================
--- gdb-head.orig/gdb/mt-tdep.c
+++ gdb-head/gdb/mt-tdep.c
@@ -226,9 +226,9 @@ mt_copro_register_type (struct gdbarch *
case MT_MAC_REGNUM:
return builtin_type_uint32;
case MT_CONTEXT_REGNUM:
- return builtin_type_long_long;
+ return builtin_type (arch)->builtin_long_long;
case MT_FLAG_REGNUM:
- return builtin_type_unsigned_char;
+ return builtin_type (arch)->builtin_unsigned_char;
default:
if (regnum >= MT_CPR0_REGNUM && regnum <= MT_CPR15_REGNUM)
return builtin_type_int16;
Index: gdb-head/gdb/rs6000-tdep.c
===================================================================
--- gdb-head.orig/gdb/rs6000-tdep.c
+++ gdb-head/gdb/rs6000-tdep.c
@@ -2079,7 +2079,8 @@ rs6000_builtin_type_vec64 (struct gdbarc
t = init_composite_type ("__ppc_builtin_type_vec64", TYPE_CODE_UNION);
append_composite_type_field (t, "uint64", builtin_type_int64);
append_composite_type_field (t, "v2_float",
- init_vector_type (builtin_type_float, 2));
+ init_vector_type (builtin_type (gdbarch)
+ ->builtin_float, 2));
append_composite_type_field (t, "v2_int32",
init_vector_type (builtin_type_int32, 2));
append_composite_type_field (t, "v4_int16",
@@ -2277,7 +2278,8 @@ rs6000_convert_register_p (struct gdbarc
&& regnum >= tdep->ppc_fp0_regnum
&& regnum < tdep->ppc_fp0_regnum + ppc_num_fprs
&& TYPE_CODE (type) == TYPE_CODE_FLT
- && TYPE_LENGTH (type) != TYPE_LENGTH (builtin_type_double));
+ && TYPE_LENGTH (type)
+ != TYPE_LENGTH (builtin_type (gdbarch)->builtin_double));
}

static void
@@ -2286,12 +2288,14 @@ rs6000_register_to_value (struct frame_i
struct type *type,
gdb_byte *to)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte from[MAX_REGISTER_SIZE];

gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);

get_frame_register (frame, regnum, from);
- convert_typed_floating (from, builtin_type_double, to, type);
+ convert_typed_floating (from, builtin_type (gdbarch)->builtin_double,
+ to, type);
}

static void
@@ -2300,11 +2304,13 @@ rs6000_value_to_register (struct frame_i
struct type *type,
const gdb_byte *from)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte to[MAX_REGISTER_SIZE];

gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);

- convert_typed_floating (from, type, to, builtin_type_double);
+ convert_typed_floating (from, type,
+ to, builtin_type (gdbarch)->builtin_double);
put_frame_register (frame, regnum, to);
}

Index: gdb-head/gdb/s390-tdep.c
===================================================================
--- gdb-head.orig/gdb/s390-tdep.c
+++ gdb-head/gdb/s390-tdep.c
@@ -96,19 +96,19 @@ static struct type *
s390_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum == S390_PSWM_REGNUM || regnum == S390_PSWA_REGNUM)
- return builtin_type_long;
+ return builtin_type (gdbarch)->builtin_long;
if (regnum >= S390_R0_REGNUM && regnum <= S390_R15_REGNUM)
- return builtin_type_long;
+ return builtin_type (gdbarch)->builtin_long;
if (regnum >= S390_A0_REGNUM && regnum <= S390_A15_REGNUM)
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
if (regnum == S390_FPC_REGNUM)
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
if (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM)
- return builtin_type_double;
+ return builtin_type (gdbarch)->builtin_double;
if (regnum == S390_PC_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == S390_CC_REGNUM)
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;

internal_error (__FILE__, __LINE__, _("invalid regnum"));
}
Index: gdb-head/gdb/sh64-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh64-tdep.c
+++ gdb-head/gdb/sh64-tdep.c
@@ -1503,12 +1503,12 @@ REGISTER_BYTE returns the register byte
*/

static struct type *
-sh64_build_float_register_type (int high)
+sh64_build_float_register_type (struct gdbarch *gdbarch, int high)
{
struct type *temp;

temp = create_range_type (NULL, builtin_type_int32, 0, high);
- return create_array_type (NULL, builtin_type_float, temp);
+ return create_array_type (NULL, builtin_type (gdbarch)->builtin_float, temp);
}

/* Return the GDB type object for the "standard" data type
@@ -1520,27 +1520,27 @@ sh64_register_type (struct gdbarch *gdba
&& reg_nr <= FP_LAST_REGNUM)
|| (reg_nr >= FP0_C_REGNUM
&& reg_nr <= FP_LAST_C_REGNUM))
- return builtin_type_float;
+ return builtin_type (gdbarch)->builtin_float;
else if ((reg_nr >= DR0_REGNUM
&& reg_nr <= DR_LAST_REGNUM)
|| (reg_nr >= DR0_C_REGNUM
&& reg_nr <= DR_LAST_C_REGNUM))
- return builtin_type_double;
+ return builtin_type (gdbarch)->builtin_double;
else if (reg_nr >= FPP0_REGNUM
&& reg_nr <= FPP_LAST_REGNUM)
- return sh64_build_float_register_type (1);
+ return sh64_build_float_register_type (gdbarch, 1);
else if ((reg_nr >= FV0_REGNUM
&& reg_nr <= FV_LAST_REGNUM)
||(reg_nr >= FV0_C_REGNUM
&& reg_nr <= FV_LAST_C_REGNUM))
- return sh64_build_float_register_type (3);
+ return sh64_build_float_register_type (gdbarch, 3);
else if (reg_nr == FPSCR_REGNUM)
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
else if (reg_nr >= R0_C_REGNUM
&& reg_nr < FP0_C_REGNUM)
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
else
- return builtin_type_long_long;
+ return builtin_type (gdbarch)->builtin_long_long;
}

static void
@@ -1997,7 +1997,7 @@ sh64_do_fp_register (struct gdbarch *gdb
regnum, gdbarch_register_name (gdbarch, regnum));

/* Get the register as a number */
- flt = unpack_double (builtin_type_float, raw_buffer, &inv);
+ flt = unpack_double (builtin_type (gdbarch)->builtin_float, raw_buffer, &inv);

/* Print the name and some spaces. */
fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
Index: gdb-head/gdb/sh-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh-tdep.c
+++ gdb-head/gdb/sh-tdep.c
@@ -2132,11 +2132,11 @@ sh_sh2a_register_type (struct gdbarch *g
{
if ((reg_nr >= gdbarch_fp0_regnum (gdbarch)
&& (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM))
- return builtin_type_float;
+ return builtin_type (gdbarch)->builtin_float;
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
- return builtin_type_double;
+ return builtin_type (gdbarch)->builtin_double;
else
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
}

/* Return the GDB type object for the "standard" data type
@@ -2146,18 +2146,18 @@ sh_sh3e_register_type (struct gdbarch *g
{
if ((reg_nr >= gdbarch_fp0_regnum (gdbarch)
&& (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM))
- return builtin_type_float;
+ return builtin_type (gdbarch)->builtin_float;
else
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
}

static struct type *
-sh_sh4_build_float_register_type (int high)
+sh_sh4_build_float_register_type (struct gdbarch *gdbarch, int high)
{
struct type *temp;

temp = create_range_type (NULL, builtin_type_int32, 0, high);
- return create_array_type (NULL, builtin_type_float, temp);
+ return create_array_type (NULL, builtin_type (gdbarch)->builtin_float, temp);
}

static struct type *
@@ -2165,19 +2165,19 @@ sh_sh4_register_type (struct gdbarch *gd
{
if ((reg_nr >= gdbarch_fp0_regnum (gdbarch)
&& (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM))
- return builtin_type_float;
+ return builtin_type (gdbarch)->builtin_float;
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
- return builtin_type_double;
+ return builtin_type (gdbarch)->builtin_double;
else if (reg_nr >= FV0_REGNUM && reg_nr <= FV_LAST_REGNUM)
- return sh_sh4_build_float_register_type (3);
+ return sh_sh4_build_float_register_type (gdbarch, 3);
else
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
}

static struct type *
sh_default_register_type (struct gdbarch *gdbarch, int reg_nr)
{
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
}

/* Is a register in a reggroup?
Index: gdb-head/gdb/sparc64-tdep.c
===================================================================
--- gdb-head.orig/gdb/sparc64-tdep.c
+++ gdb-head/gdb/sparc64-tdep.c
@@ -247,15 +247,15 @@ sparc64_register_type (struct gdbarch *g
/* Raw registers. */

if (regnum == SPARC_SP_REGNUM || regnum == SPARC_FP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
if (regnum >= SPARC_G0_REGNUM && regnum <= SPARC_I7_REGNUM)
return builtin_type_int64;
if (regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
- return builtin_type_float;
+ return builtin_type (gdbarch)->builtin_float;
if (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM)
- return builtin_type_double;
+ return builtin_type (gdbarch)->builtin_double;
if (regnum == SPARC64_PC_REGNUM || regnum == SPARC64_NPC_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
/* This raw register contains the contents of %cwp, %pstate, %asi
and %ccr as laid out in a %tstate register. */
if (regnum == SPARC64_STATE_REGNUM)
@@ -280,9 +280,9 @@ sparc64_register_type (struct gdbarch *g
if (regnum == SPARC64_CCR_REGNUM)
return builtin_type_int64;
if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D62_REGNUM)
- return builtin_type_double;
+ return builtin_type (gdbarch)->builtin_double;
if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM)
- return builtin_type_long_double;
+ return builtin_type (gdbarch)->builtin_long_double;

internal_error (__FILE__, __LINE__, _("invalid regnum"));
}
Index: gdb-head/gdb/sparc-tdep.c
===================================================================
--- gdb-head.orig/gdb/sparc-tdep.c
+++ gdb-head/gdb/sparc-tdep.c
@@ -332,16 +332,16 @@ static struct type *
sparc32_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
- return builtin_type_float;
+ return builtin_type (gdbarch)->builtin_float;

if (regnum >= SPARC32_D0_REGNUM && regnum <= SPARC32_D30_REGNUM)
- return builtin_type_double;
+ return builtin_type (gdbarch)->builtin_double;

if (regnum == SPARC_SP_REGNUM || regnum == SPARC_FP_REGNUM)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;

if (regnum == SPARC32_PC_REGNUM || regnum == SPARC32_NPC_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;

if (regnum == SPARC32_PSR_REGNUM)
return sparc_psr_type;
Index: gdb-head/gdb/spu-tdep.c
===================================================================
--- gdb-head.orig/gdb/spu-tdep.c
+++ gdb-head/gdb/spu-tdep.c
@@ -74,9 +74,11 @@ spu_builtin_type_vec128 (struct gdbarch
append_composite_type_field (t, "v16_int8",
init_vector_type (builtin_type_int8, 16));
append_composite_type_field (t, "v2_double",
- init_vector_type (builtin_type_double, 2));
+ init_vector_type (builtin_type (gdbarch)
+ ->builtin_double, 2));
append_composite_type_field (t, "v4_float",
- init_vector_type (builtin_type_float, 4));
+ init_vector_type (builtin_type (gdbarch)
+ ->builtin_float, 4));

TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "spu_builtin_type_vec128";
@@ -137,10 +139,10 @@ spu_register_type (struct gdbarch *gdbar
return builtin_type_uint32;

case SPU_PC_REGNUM:
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;

case SPU_SP_REGNUM:
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;

case SPU_FPSCR_REGNUM:
return builtin_type_uint128;
Index: gdb-head/gdb/std-regs.c
===================================================================
--- gdb-head.orig/gdb/std-regs.c
+++ gdb-head/gdb/std-regs.c
@@ -42,12 +42,13 @@ value_of_builtin_frame_fp_reg (struct fr
frame);
else
{
- struct value *val = allocate_value (builtin_type_void_data_ptr);
+ struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
+ struct value *val = allocate_value (data_ptr_type);
gdb_byte *buf = value_contents_raw (val);
if (frame == NULL)
memset (buf, 0, TYPE_LENGTH (value_type (val)));
else
- gdbarch_address_to_pointer (gdbarch, builtin_type_void_data_ptr,
+ gdbarch_address_to_pointer (gdbarch, data_ptr_type,
buf, get_frame_base_address (frame));
return val;
}
@@ -61,12 +62,13 @@ value_of_builtin_frame_pc_reg (struct fr
return value_of_register (gdbarch_pc_regnum (gdbarch), frame);
else
{
- struct value *val = allocate_value (builtin_type_void_func_ptr);
+ struct type *func_ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
+ struct value *val = allocate_value (func_ptr_type);
gdb_byte *buf = value_contents_raw (val);
if (frame == NULL)
memset (buf, 0, TYPE_LENGTH (value_type (val)));
else
- gdbarch_address_to_pointer (gdbarch, builtin_type_void_func_ptr,
+ gdbarch_address_to_pointer (gdbarch, func_ptr_type,
buf, get_frame_pc (frame));
return val;
}
Index: gdb-head/gdb/target-descriptions.c
===================================================================
--- gdb-head.orig/gdb/target-descriptions.c
+++ gdb-head/gdb/target-descriptions.c
@@ -552,32 +552,32 @@ tdesc_register_type (struct gdbarch *gdb
if (strcmp (reg->type, "float") == 0)
{
if (reg->bitsize == gdbarch_float_bit (gdbarch))
- return builtin_type_float;
+ return builtin_type (gdbarch)->builtin_float;
else if (reg->bitsize == gdbarch_double_bit (gdbarch))
- return builtin_type_double;
+ return builtin_type (gdbarch)->builtin_double;
else if (reg->bitsize == gdbarch_long_double_bit (gdbarch))
- return builtin_type_long_double;
+ return builtin_type (gdbarch)->builtin_long_double;
}
else if (strcmp (reg->type, "int") == 0)
{
if (reg->bitsize == gdbarch_long_bit (gdbarch))
- return builtin_type_long;
+ return builtin_type (gdbarch)->builtin_long;
else if (reg->bitsize == TARGET_CHAR_BIT)
- return builtin_type_char;
+ return builtin_type (gdbarch)->builtin_char;
else if (reg->bitsize == gdbarch_short_bit (gdbarch))
- return builtin_type_short;
+ return builtin_type (gdbarch)->builtin_short;
else if (reg->bitsize == gdbarch_int_bit (gdbarch))
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
else if (reg->bitsize == gdbarch_long_long_bit (gdbarch))
- return builtin_type_long_long;
+ return builtin_type (gdbarch)->builtin_long_long;
else if (reg->bitsize == gdbarch_ptr_bit (gdbarch))
/* A bit desperate by this point... */
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
}
else if (strcmp (reg->type, "code_ptr") == 0)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
else if (strcmp (reg->type, "data_ptr") == 0)
- return builtin_type_void_data_ptr;
+ return builtin_type (gdbarch)->builtin_data_ptr;
else
internal_error (__FILE__, __LINE__,
"Register \"%s\" has an unknown type \"%s\"",
@@ -585,7 +585,7 @@ tdesc_register_type (struct gdbarch *gdb

warning (_("Register \"%s\" has an unsupported size (%d bits)"),
reg->name, reg->bitsize);
- return builtin_type_long;
+ return builtin_type (gdbarch)->builtin_long;
}

static int
Index: gdb-head/gdb/v850-tdep.c
===================================================================
--- gdb-head.orig/gdb/v850-tdep.c
+++ gdb-head/gdb/v850-tdep.c
@@ -183,7 +183,7 @@ static struct type *
v850_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum == E_PC_REGNUM)
- return builtin_type_void_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
return builtin_type_int32;
}

Index: gdb-head/gdb/vax-tdep.c
===================================================================
--- gdb-head.orig/gdb/vax-tdep.c
+++ gdb-head/gdb/vax-tdep.c
@@ -61,7 +61,7 @@ vax_register_name (struct gdbarch *gdbar
static struct type *
vax_register_type (struct gdbarch *gdbarch, int regnum)
{
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;
}
\f
/* Core file support. */
Index: gdb-head/gdb/xtensa-tdep.c
===================================================================
--- gdb-head.orig/gdb/xtensa-tdep.c
+++ gdb-head/gdb/xtensa-tdep.c
@@ -229,7 +229,7 @@ xtensa_register_type (struct gdbarch *gd
+ gdbarch_tdep (gdbarch)->num_aregs)
|| (regnum >= gdbarch_tdep (gdbarch)->a0_base
&& regnum < gdbarch_tdep (gdbarch)->a0_base + 16))
- return builtin_type_int;
+ return builtin_type (gdbarch)->builtin_int;

if (regnum == gdbarch_pc_regnum (gdbarch)
|| regnum == gdbarch_tdep (gdbarch)->a0_base + 1)
@@ -1015,15 +1015,16 @@ static CORE_ADDR
xtensa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
gdb_byte buf[8];
+ CORE_ADDR pc;

DEBUGTRACE ("xtensa_unwind_pc (next_frame = %p)\n", next_frame);

frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
+ pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);

- DEBUGINFO ("[xtensa_unwind_pc] pc = 0x%08x\n", (unsigned int)
- extract_typed_address (buf, builtin_type_void_func_ptr));
+ DEBUGINFO ("[xtensa_unwind_pc] pc = 0x%08x\n", (unsigned int) pc);

- return extract_typed_address (buf, builtin_type_void_func_ptr);
+ return pc;
}

@@ -1677,9 +1678,10 @@ xtensa_push_dummy_call (struct gdbarch *
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_long))
+ if (TYPE_LENGTH (arg_type)
+ < TYPE_LENGTH (builtin_type (gdbarch)->builtin_long))
{
- arg_type = builtin_type_long;
+ arg_type = builtin_type (gdbarch)->builtin_long;
arg = value_cast (arg_type, arg);
}
/* Aligment is equal to the type length for the basic types. */
@@ -1689,15 +1691,16 @@ xtensa_push_dummy_call (struct gdbarch *
case TYPE_CODE_FLT:

/* Align doubles correctly. */
- if (TYPE_LENGTH (arg_type) == TYPE_LENGTH (builtin_type_double))
- info->align = TYPE_LENGTH (builtin_type_double);
+ if (TYPE_LENGTH (arg_type)
+ == TYPE_LENGTH (builtin_type (gdbarch)->builtin_double))
+ info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_double);
else
- info->align = TYPE_LENGTH (builtin_type_long);
+ info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long);
break;

case TYPE_CODE_STRUCT:
default:
- info->align = TYPE_LENGTH (builtin_type_long);
+ info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long);
break;
}
info->length = TYPE_LENGTH (arg_type);