From 0dfff4cba79b63947da409e72b2863b160a6233a Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 11 Sep 2008 14:23:15 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 44 +++++++++++++++++++++++++++++++++++++++ gdb/alpha-tdep.c | 4 ++-- gdb/amd64-tdep.c | 11 +++++----- gdb/arm-tdep.c | 4 ++-- gdb/avr-tdep.c | 2 +- gdb/cris-tdep.c | 8 +++---- gdb/frv-tdep.c | 2 +- gdb/h8300-tdep.c | 4 ++-- gdb/hppa-tdep.c | 12 +++++++---- gdb/i386-tdep.c | 14 +++++++------ gdb/ia64-tdep.c | 2 +- gdb/m32r-tdep.c | 4 ++-- gdb/m68k-tdep.c | 8 +++---- gdb/m88k-tdep.c | 4 ++-- gdb/mep-tdep.c | 4 ++-- gdb/mips-tdep.c | 7 ++++--- gdb/mn10300-tdep.c | 2 +- gdb/mt-tdep.c | 4 ++-- gdb/rs6000-tdep.c | 14 +++++++++---- gdb/s390-tdep.c | 14 ++++++------- gdb/sh-tdep.c | 24 ++++++++++----------- gdb/sh64-tdep.c | 20 +++++++++--------- gdb/sparc-tdep.c | 8 +++---- gdb/sparc64-tdep.c | 12 +++++------ gdb/spu-tdep.c | 10 +++++---- gdb/std-regs.c | 10 +++++---- gdb/target-descriptions.c | 24 ++++++++++----------- gdb/v850-tdep.c | 2 +- gdb/vax-tdep.c | 2 +- gdb/xtensa-tdep.c | 23 +++++++++++--------- 30 files changed, 184 insertions(+), 119 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 70b9ae94cd..23ebcebdcb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,47 @@ +2008-09-11 Ulrich Weigand + + * 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. + 2008-09-11 Ulrich Weigand * ada-lang.c (ada_coerce_to_simple_array_type): Use builtin_type_int32 diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index fe8671f3a5..27137d9038 100644 --- a/gdb/alpha-tdep.c +++ b/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. */ diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 75c99ab60b..9b7c8a4c58 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -90,11 +90,11 @@ amd64_register_type (struct gdbarch *gdbarch, int regnum) 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_info *frame, CORE_ADDR *pc) 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_info *frame, CORE_ADDR *pc) 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; } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index cb0eb12938..30799d3a18 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1605,9 +1605,9 @@ arm_register_type (struct gdbarch *gdbarch, int regnum) 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. */ diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 85f3c0a580..fdcd5076a1 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -213,7 +213,7 @@ avr_register_type (struct gdbarch *gdbarch, int reg_nr) 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; } diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 54816db04f..dd78e9cdc2 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1650,10 +1650,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. */ @@ -1671,10 +1671,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) diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 7c7942015a..bf8f015fba 100644 --- a/gdb/frv-tdep.c +++ b/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 diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 1d52553802..aaf5694cd7 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1112,10 +1112,10 @@ h8300_register_type (struct gdbarch *gdbarch, int regno) 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; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 4b2ec571e3..cd844e820d 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1245,8 +1245,9 @@ hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, { 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; @@ -2898,6 +2899,9 @@ hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name) 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; @@ -2908,7 +2912,7 @@ hppa_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) /* 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; } @@ -2929,7 +2933,7 @@ hppa_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) 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. */ @@ -2943,7 +2947,7 @@ hppa_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) } /* 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); } } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 40cbde5bff..edaac21b18 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1275,7 +1275,7 @@ i386_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) 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); } @@ -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 *gdbarch, int regnum) 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, diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index df5f43adc3..2f2e26140f 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -309,7 +309,7 @@ ia64_register_type (struct gdbarch *arch, int reg) 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 diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 53f0d2080f..c27195b2f9 100644 --- a/gdb/m32r-tdep.c +++ b/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; } diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 2319d7877e..1a314405b1 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -120,7 +120,7 @@ m68k_register_type (struct gdbarch *gdbarch, int regnum) } 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 *gdbarch, int regnum) } 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, struct frame_info *next_frame) 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); } /* Normal frames. */ diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c index dc9b2919df..ce3c5441a0 100644 --- a/gdb/m88k-tdep.c +++ b/gdb/m88k-tdep.c @@ -75,11 +75,11 @@ m88k_register_type (struct gdbarch *gdbarch, int regnum) /* 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; } diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 6dfbcc16b5..648ad91e42 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1097,14 +1097,14 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr) 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; } diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 615938b602..1cc34489d3 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -737,12 +737,13 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum) /* 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 diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 88cb150b73..50a7207431 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -265,7 +265,7 @@ am33_2_register_name (struct gdbarch *gdbarch, int reg) static struct type * mn10300_register_type (struct gdbarch *gdbarch, int reg) { - return builtin_type_int; + return builtin_type (gdbarch)->builtin_int; } static CORE_ADDR diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c index fd3f5882d4..da4afe347c 100644 --- a/gdb/mt-tdep.c +++ b/gdb/mt-tdep.c @@ -226,9 +226,9 @@ mt_copro_register_type (struct gdbarch *arch, int regnum) 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; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index c8bc7ac082..f46c979fb1 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2264,7 +2264,8 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch) 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", @@ -2462,7 +2463,8 @@ rs6000_convert_register_p (struct gdbarch *gdbarch, int regnum, && 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 @@ -2471,12 +2473,14 @@ rs6000_register_to_value (struct frame_info *frame, 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 @@ -2485,11 +2489,13 @@ rs6000_value_to_register (struct frame_info *frame, 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); } diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 07c1b33ea6..7621bbf6cb 100644 --- a/gdb/s390-tdep.c +++ b/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")); } diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 20ba95ec08..63df344019 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2124,11 +2124,11 @@ sh_sh2a_register_type (struct gdbarch *gdbarch, int reg_nr) { 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 @@ -2138,18 +2138,18 @@ sh_sh3e_register_type (struct gdbarch *gdbarch, int reg_nr) { 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 * @@ -2157,19 +2157,19 @@ sh_sh4_register_type (struct gdbarch *gdbarch, int reg_nr) { 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? diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index e127995cbd..7fd9c94b95 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -1495,12 +1495,12 @@ REGISTER_BYTE returns the register byte for the base register. */ 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 @@ -1512,27 +1512,27 @@ sh64_register_type (struct gdbarch *gdbarch, int reg_nr) && 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 @@ -1989,7 +1989,7 @@ sh64_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, 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); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index ff2feecb86..d21697a449 100644 --- a/gdb/sparc-tdep.c +++ b/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; diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 25c8e57b1c..582924720a 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -247,15 +247,15 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum) /* 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 *gdbarch, int regnum) 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")); } diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index e68b228fb0..e89402e05c 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -74,9 +74,11 @@ spu_builtin_type_vec128 (struct gdbarch *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 *gdbarch, int reg_nr) 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; diff --git a/gdb/std-regs.c b/gdb/std-regs.c index 5a7a68be9d..ffa7f71102 100644 --- a/gdb/std-regs.c +++ b/gdb/std-regs.c @@ -42,12 +42,13 @@ value_of_builtin_frame_fp_reg (struct frame_info *frame, const void *baton) 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 frame_info *frame, const void *baton) 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; } diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index ca5b4fdc23..337a0bd0db 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -552,32 +552,32 @@ tdesc_register_type (struct gdbarch *gdbarch, int regno) 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 *gdbarch, int regno) 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 diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 7fce311909..2e5a4e7cf2 100644 --- a/gdb/v850-tdep.c +++ b/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; } diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 618befa3f5..09b4bc7168 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -61,7 +61,7 @@ vax_register_name (struct gdbarch *gdbarch, int regnum) static struct type * vax_register_type (struct gdbarch *gdbarch, int regnum) { - return builtin_type_int; + return builtin_type (gdbarch)->builtin_int; } /* Core file support. */ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 7f8ecc2cef..e70710acd2 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -229,7 +229,7 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum) + 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 *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 *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); -- 2.34.1