aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:46:19 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:46:19 +0000
commitdf4df182b49ab6808495f557d3727b8dfd4b98da (patch)
tree7df1585d4087550709356201e912e9ee285cb675 /gdb
parent69feb676087cb0883eb5feb38558dc3252059312 (diff)
downloadgdb-df4df182b49ab6808495f557d3727b8dfd4b98da.zip
gdb-df4df182b49ab6808495f557d3727b8dfd4b98da.tar.gz
gdb-df4df182b49ab6808495f557d3727b8dfd4b98da.tar.bz2
* gdbtypes.h (builtin_type_int0, builtin_type_int8, builtin_type_uint8,
builtin_type_int16, builtin_type_uint16, builtin_type_int32, builtin_type_uint32, builtin_type_int64, builtin_type_uint64, builtin_type_int128, builtin_type_uint128): Remove. (struct builtin_type): New members builtin_int0, builtin_int8, builtin_uint8, builtin_int16, builtin_uint16, builtin_int32, builtin_uint32, builtin_int64, builtin_uint64, builtin_int128, and builtin_uint128. * gdbtypes.c (builtin_type_int0, builtin_type_int8, builtin_type_uint8, builtin_type_int16, builtin_type_uint16, builtin_type_int32, builtin_type_uint32, builtin_type_int64, builtin_type_uint64, builtin_type_int128, builtin_type_uint128): Remove. (_initialize_gdbtypes): Do not initialize them. (gdbtypes_post_init): Initialize fixed-size integer types. * dwarf2expr.c (unsigned_address_type, signed_address_type): Add GDBARCH argument. Return platform-specific type. (dwarf2_read_address, execute_stack_op): Update calls. * target-descriptions.c (tdesc_gdb_type): Use platform-specific types instead of global builtin_int_... variables. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. * printcmd.c (do_examine): Likewise. * jv-exp.y (parse_number): Likewise. * alpha-tdep.c (alpha_register_type, alpha_push_dummy_call, alpha_store_return_value): Likewise. * amd64-linux-tdep.c (amd64_linux_register_type): Likewise. * amd64-tdep.c (amd64_register_type): 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 (hppa64_push_dummy_call, hppa32_register_type, hppa64_register_type): Likewise. * i386-tdep.c (i386_mmx_type, i386_sse_type): Likewise. * iq2000-tdep.c (iq2000_register_type): Likewise. * lm32-tdep.c (lm32_register_type, lm32_push_dummy_call): Likewise. * m32r-tdep.c (m32r_register_type): Likewise. * m68hc11-tdep.c (m68hc11_register_type, m68hc11_pseudo_register_read, m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_register_type): Likewise. * m88k-tdep.c (m88k_register_type, m88k_store_arguments): Likewise. * mep-tdep.c (mep_register_type): Likewise. * mips-tdep.c (mips_register_type, mips_pseudo_register_type, mips_print_fp_register): Likewise. * moxie-tdep.c (moxie_register_type): Likewise. * mt-tdep.c (mt_copro_register_type, mt_register_type): Likewise. * rs6000-tdep.c (rs6000_builtin_type_vec64, rs6000_builtin_type_vec128): Likewise. * score-tdep.c (score_register_type): Likewise. * sparc-tdep.c (sparc32_register_type, sparc32_store_arguments): Likewise. * sparc64-tdep.c (sparc64_register_type, sparc64_store_arguments): Likewise. * spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise. * v850-tdep.c (v850_register_type): Likewise. * xstormy16-tdep.c (xstormy16_register_type): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * mt-tdep.c (struct gdbarch_tdep): New data structure. (mt_gdbarch_init): Alloc TDEP structures. (mt_register_type): Cache coprocessor type in TDEP instead of static global variable. * xtensa-tdep.h (struct gdbarch_tdep): Add type_entries member. * xtensa-tdep.c (type_entries): Remove. (xtensa_register_type): Cache fixed-size types in TDEP instead of in global variable.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog73
-rw-r--r--gdb/alpha-tdep.c9
-rw-r--r--gdb/amd64-linux-tdep.c2
-rw-r--r--gdb/amd64-tdep.c8
-rw-r--r--gdb/arm-tdep.c4
-rw-r--r--gdb/avr-tdep.c4
-rw-r--r--gdb/cris-tdep.c16
-rw-r--r--gdb/dwarf2expr.c32
-rw-r--r--gdb/frv-tdep.c4
-rw-r--r--gdb/gdbtypes.c105
-rw-r--r--gdb/gdbtypes.h30
-rw-r--r--gdb/h8300-tdep.c8
-rw-r--r--gdb/hppa-tdep.c6
-rw-r--r--gdb/i386-tdep.c29
-rw-r--r--gdb/iq2000-tdep.c2
-rw-r--r--gdb/jv-exp.y10
-rw-r--r--gdb/lm32-tdep.c4
-rw-r--r--gdb/m32r-tdep.c2
-rw-r--r--gdb/m68hc11-tdep.c10
-rw-r--r--gdb/m68k-tdep.c6
-rw-r--r--gdb/m88k-tdep.c6
-rw-r--r--gdb/mep-tdep.c8
-rw-r--r--gdb/mi/mi-main.c11
-rw-r--r--gdb/mips-tdep.c26
-rw-r--r--gdb/moxie-tdep.c2
-rw-r--r--gdb/mt-tdep.c39
-rw-r--r--gdb/printcmd.c8
-rw-r--r--gdb/rs6000-tdep.c25
-rw-r--r--gdb/score-tdep.c2
-rw-r--r--gdb/sparc-tdep.c6
-rw-r--r--gdb/sparc64-tdep.c16
-rw-r--r--gdb/spu-tdep.c29
-rw-r--r--gdb/target-descriptions.c22
-rw-r--r--gdb/v850-tdep.c2
-rw-r--r--gdb/xstormy16-tdep.c4
-rw-r--r--gdb/xtensa-tdep.c38
-rw-r--r--gdb/xtensa-tdep.h8
37 files changed, 353 insertions, 263 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cfa317b..a8138e1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,78 @@
2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
+ * gdbtypes.h (builtin_type_int0, builtin_type_int8, builtin_type_uint8,
+ builtin_type_int16, builtin_type_uint16, builtin_type_int32,
+ builtin_type_uint32, builtin_type_int64, builtin_type_uint64,
+ builtin_type_int128, builtin_type_uint128): Remove.
+ (struct builtin_type): New members builtin_int0, builtin_int8,
+ builtin_uint8, builtin_int16, builtin_uint16, builtin_int32,
+ builtin_uint32, builtin_int64, builtin_uint64, builtin_int128,
+ and builtin_uint128.
+ * gdbtypes.c (builtin_type_int0, builtin_type_int8, builtin_type_uint8,
+ builtin_type_int16, builtin_type_uint16, builtin_type_int32,
+ builtin_type_uint32, builtin_type_int64, builtin_type_uint64,
+ builtin_type_int128, builtin_type_uint128): Remove.
+ (_initialize_gdbtypes): Do not initialize them.
+ (gdbtypes_post_init): Initialize fixed-size integer types.
+
+ * dwarf2expr.c (unsigned_address_type, signed_address_type): Add
+ GDBARCH argument. Return platform-specific type.
+ (dwarf2_read_address, execute_stack_op): Update calls.
+
+ * target-descriptions.c (tdesc_gdb_type): Use platform-specific types
+ instead of global builtin_int_... variables.
+ * mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
+ * printcmd.c (do_examine): Likewise.
+ * jv-exp.y (parse_number): Likewise.
+
+ * alpha-tdep.c (alpha_register_type, alpha_push_dummy_call,
+ alpha_store_return_value): Likewise.
+ * amd64-linux-tdep.c (amd64_linux_register_type): Likewise.
+ * amd64-tdep.c (amd64_register_type): 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 (hppa64_push_dummy_call, hppa32_register_type,
+ hppa64_register_type): Likewise.
+ * i386-tdep.c (i386_mmx_type, i386_sse_type): Likewise.
+ * iq2000-tdep.c (iq2000_register_type): Likewise.
+ * lm32-tdep.c (lm32_register_type, lm32_push_dummy_call): Likewise.
+ * m32r-tdep.c (m32r_register_type): Likewise.
+ * m68hc11-tdep.c (m68hc11_register_type, m68hc11_pseudo_register_read,
+ m68hc11_pseudo_register_write): Likewise.
+ * m68k-tdep.c (m68k_register_type): Likewise.
+ * m88k-tdep.c (m88k_register_type, m88k_store_arguments): Likewise.
+ * mep-tdep.c (mep_register_type): Likewise.
+ * mips-tdep.c (mips_register_type, mips_pseudo_register_type,
+ mips_print_fp_register): Likewise.
+ * moxie-tdep.c (moxie_register_type): Likewise.
+ * mt-tdep.c (mt_copro_register_type, mt_register_type): Likewise.
+ * rs6000-tdep.c (rs6000_builtin_type_vec64,
+ rs6000_builtin_type_vec128): Likewise.
+ * score-tdep.c (score_register_type): Likewise.
+ * sparc-tdep.c (sparc32_register_type, sparc32_store_arguments):
+ Likewise.
+ * sparc64-tdep.c (sparc64_register_type, sparc64_store_arguments):
+ Likewise.
+ * spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise.
+ * v850-tdep.c (v850_register_type): Likewise.
+ * xstormy16-tdep.c (xstormy16_register_type): Likewise.
+ * xtensa-tdep.c (xtensa_register_type): Likewise.
+
+ * mt-tdep.c (struct gdbarch_tdep): New data structure.
+ (mt_gdbarch_init): Alloc TDEP structures.
+ (mt_register_type): Cache coprocessor type in TDEP instead of
+ static global variable.
+
+ * xtensa-tdep.h (struct gdbarch_tdep): Add type_entries member.
+ * xtensa-tdep.c (type_entries): Remove.
+ (xtensa_register_type): Cache fixed-size types in TDEP instead
+ of in global variable.
+
+2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
+
* gdbtypes.h (builtin_type_true_char): Remove.
(builtin_type_true_unsigned_char): Likewise.
(struct builtin_type): Add builtin_true_char and
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index e2a202f..79a6ae1 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -104,7 +104,7 @@ alpha_register_type (struct gdbarch *gdbarch, int regno)
if (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31)
return builtin_type_ieee_double;
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
}
/* Is REGNUM a member of REGGROUP? */
@@ -298,12 +298,12 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* 32-bit values must be sign-extended to 64 bits
even if the base data type is unsigned. */
- arg_type = builtin_type_int32;
+ arg_type = builtin_type (gdbarch)->builtin_int32;
arg = value_cast (arg_type, arg);
}
if (TYPE_LENGTH (arg_type) < ALPHA_REGISTER_SIZE)
{
- arg_type = builtin_type_int64;
+ arg_type = builtin_type (gdbarch)->builtin_int64;
arg = value_cast (arg_type, arg);
}
break;
@@ -498,6 +498,7 @@ static void
alpha_store_return_value (struct type *valtype, struct regcache *regcache,
const gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int length = TYPE_LENGTH (valtype);
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l;
@@ -556,7 +557,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
/* 32-bit values must be sign-extended to 64 bits
even if the base data type is unsigned. */
if (length == 4)
- valtype = builtin_type_int32;
+ valtype = builtin_type (gdbarch)->builtin_int32;
l = unpack_long (valtype, valbuf);
regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l);
break;
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index badc0b4..bdc93f5 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -218,7 +218,7 @@ static struct type *
amd64_linux_register_type (struct gdbarch *gdbarch, int reg)
{
if (reg == AMD64_LINUX_ORIG_RAX_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
return amd64_register_type (gdbarch, reg);
}
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 4eef55d..a81e35b 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -90,21 +90,21 @@ struct type *
amd64_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum >= AMD64_RAX_REGNUM && regnum <= AMD64_RDI_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == AMD64_RBP_REGNUM || regnum == AMD64_RSP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
if (regnum >= AMD64_R8_REGNUM && regnum <= AMD64_R15_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == AMD64_RIP_REGNUM)
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)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
if (regnum >= AMD64_ST0_REGNUM && regnum <= AMD64_ST0_REGNUM + 7)
return builtin_type_i387_ext;
if (regnum >= AMD64_FCTRL_REGNUM && regnum <= AMD64_FCTRL_REGNUM + 7)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
if (regnum >= AMD64_XMM0_REGNUM && regnum <= AMD64_XMM0_REGNUM + 15)
return i386_sse_type (gdbarch);
if (regnum == AMD64_MXCSR_REGNUM)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 9ea5a06..4ca6c51 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1608,9 +1608,9 @@ arm_register_type (struct gdbarch *gdbarch, int regnum)
else if (regnum >= ARRAY_SIZE (arm_register_names))
/* These registers are only supported on targets which supply
an XML description. */
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
else
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
}
/* Map a DWARF register REGNUM onto the appropriate GDB register
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 16b27ad..4e7c78a 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -212,11 +212,11 @@ static struct type *
avr_register_type (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == AVR_PC_REGNUM)
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
if (reg_nr == AVR_SP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
}
/* Instruction address checks and convertions. */
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 63f4ae4..f2c0b7e 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1657,14 +1657,14 @@ cris_register_type (struct gdbarch *gdbarch, int regno)
else if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
|| (regno >= MOF_REGNUM && regno <= USP_REGNUM))
/* Note: R8 taken care of previous clause. */
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
else if (regno >= P4_REGNUM && regno <= CCR_REGNUM)
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
else if (regno >= P0_REGNUM && regno <= VR_REGNUM)
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else
/* Invalid (unimplemented) register. */
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
}
static struct type *
@@ -1680,17 +1680,17 @@ crisv32_register_type (struct gdbarch *gdbarch, int regno)
|| (regno == PID_REGNUM)
|| (regno >= S0_REGNUM && regno <= S15_REGNUM))
/* Note: R8 and SP taken care of by previous clause. */
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
else if (regno == WZ_REGNUM)
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
else if (regno == BZ_REGNUM || regno == VR_REGNUM || regno == SRS_REGNUM)
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else
{
/* Invalid (unimplemented) register. Should not happen as there are
no unimplemented CRISv32 registers. */
warning (_("crisv32_register_type: unknown regno %d"), regno);
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
}
}
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index e2e106b..fe0fd83 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -33,7 +33,7 @@
static void execute_stack_op (struct dwarf_expr_context *,
gdb_byte *, gdb_byte *);
-static struct type *unsigned_address_type (int);
+static struct type *unsigned_address_type (struct gdbarch *, int);
/* Create a new context for the expression evaluator. */
@@ -225,7 +225,7 @@ dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf,
if (gdbarch_integer_to_address_p (gdbarch))
return gdbarch_integer_to_address
- (gdbarch, unsigned_address_type (addr_size), buf);
+ (gdbarch, unsigned_address_type (gdbarch, addr_size), buf);
return extract_unsigned_integer (buf, addr_size);
}
@@ -234,16 +234,16 @@ dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf,
for unsigned arithmetic. */
static struct type *
-unsigned_address_type (int addr_size)
+unsigned_address_type (struct gdbarch *gdbarch, int addr_size)
{
switch (addr_size)
{
case 2:
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
case 4:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case 8:
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
default:
internal_error (__FILE__, __LINE__,
_("Unsupported address size.\n"));
@@ -254,16 +254,16 @@ unsigned_address_type (int addr_size)
for signed arithmetic. */
static struct type *
-signed_address_type (int addr_size)
+signed_address_type (struct gdbarch *gdbarch, int addr_size)
{
switch (addr_size)
{
case 2:
- return builtin_type_int16;
+ return builtin_type (gdbarch)->builtin_int16;
case 4:
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
case 8:
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
default:
internal_error (__FILE__, __LINE__,
_("Unsupported address size.\n"));
@@ -622,6 +622,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
CORE_ADDR first, second;
enum exp_opcode binop;
struct value *val1, *val2;
+ struct type *stype, *utype;
second = dwarf_expr_fetch (ctx, 0);
dwarf_expr_pop (ctx);
@@ -629,10 +630,10 @@ execute_stack_op (struct dwarf_expr_context *ctx,
first = dwarf_expr_fetch (ctx, 0);
dwarf_expr_pop (ctx);
- val1 = value_from_longest
- (unsigned_address_type (ctx->addr_size), first);
- val2 = value_from_longest
- (unsigned_address_type (ctx->addr_size), second);
+ utype = unsigned_address_type (ctx->gdbarch, ctx->addr_size);
+ stype = signed_address_type (ctx->gdbarch, ctx->addr_size);
+ val1 = value_from_longest (utype, first);
+ val2 = value_from_longest (utype, second);
switch (op)
{
@@ -665,8 +666,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
break;
case DW_OP_shra:
binop = BINOP_RSH;
- val1 = value_from_longest
- (signed_address_type (ctx->addr_size), first);
+ val1 = value_from_longest (stype, first);
break;
case DW_OP_xor:
binop = BINOP_BITWISE_XOR;
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index cf48dc6..b187fef 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -294,9 +294,9 @@ frv_register_type (struct gdbarch *gdbarch, int reg)
if (reg >= first_fpr_regnum && reg <= last_fpr_regnum)
return builtin_type (gdbarch)->builtin_float;
else if (reg == iacc0_regnum)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
else
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static void
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 25d6321..a06f48a 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -39,20 +39,6 @@
#include "gdb_assert.h"
#include "hashtab.h"
-/* These variables point to the objects
- representing the predefined C data types. */
-
-struct type *builtin_type_int0;
-struct type *builtin_type_int8;
-struct type *builtin_type_uint8;
-struct type *builtin_type_int16;
-struct type *builtin_type_uint16;
-struct type *builtin_type_int32;
-struct type *builtin_type_uint32;
-struct type *builtin_type_int64;
-struct type *builtin_type_uint64;
-struct type *builtin_type_int128;
-struct type *builtin_type_uint128;
/* Floatformat pairs. */
const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN] = {
@@ -3196,6 +3182,52 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
TYPE_FLAG_UNSIGNED,
"true character", (struct objfile *) NULL);
+ /* Fixed-size integer types. */
+ builtin_type->builtin_int0 =
+ init_type (TYPE_CODE_INT, 0 / 8,
+ 0,
+ "int0_t", (struct objfile *) NULL);
+ builtin_type->builtin_int8 =
+ init_type (TYPE_CODE_INT, 8 / 8,
+ TYPE_FLAG_NOTTEXT,
+ "int8_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint8 =
+ init_type (TYPE_CODE_INT, 8 / 8,
+ TYPE_FLAG_UNSIGNED | TYPE_FLAG_NOTTEXT,
+ "uint8_t", (struct objfile *) NULL);
+ builtin_type->builtin_int16 =
+ init_type (TYPE_CODE_INT, 16 / 8,
+ 0,
+ "int16_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint16 =
+ init_type (TYPE_CODE_INT, 16 / 8,
+ TYPE_FLAG_UNSIGNED,
+ "uint16_t", (struct objfile *) NULL);
+ builtin_type->builtin_int32 =
+ init_type (TYPE_CODE_INT, 32 / 8,
+ 0,
+ "int32_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint32 =
+ init_type (TYPE_CODE_INT, 32 / 8,
+ TYPE_FLAG_UNSIGNED,
+ "uint32_t", (struct objfile *) NULL);
+ builtin_type->builtin_int64 =
+ init_type (TYPE_CODE_INT, 64 / 8,
+ 0,
+ "int64_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint64 =
+ init_type (TYPE_CODE_INT, 64 / 8,
+ TYPE_FLAG_UNSIGNED,
+ "uint64_t", (struct objfile *) NULL);
+ builtin_type->builtin_int128 =
+ init_type (TYPE_CODE_INT, 128 / 8,
+ 0,
+ "int128_t", (struct objfile *) NULL);
+ builtin_type->builtin_uint128 =
+ init_type (TYPE_CODE_INT, 128 / 8,
+ TYPE_FLAG_UNSIGNED,
+ "uint128_t", (struct objfile *) NULL);
+
/* Default data/code pointer types. */
builtin_type->builtin_data_ptr =
make_pointer_type (builtin_type->builtin_void, NULL);
@@ -3375,51 +3407,6 @@ _initialize_gdbtypes (void)
caching pointer or reference types that *are* architecture
dependent. */
- builtin_type_int0 =
- init_type (TYPE_CODE_INT, 0 / 8,
- 0,
- "int0_t", (struct objfile *) NULL);
- builtin_type_int8 =
- init_type (TYPE_CODE_INT, 8 / 8,
- TYPE_FLAG_NOTTEXT,
- "int8_t", (struct objfile *) NULL);
- builtin_type_uint8 =
- init_type (TYPE_CODE_INT, 8 / 8,
- TYPE_FLAG_UNSIGNED | TYPE_FLAG_NOTTEXT,
- "uint8_t", (struct objfile *) NULL);
- builtin_type_int16 =
- init_type (TYPE_CODE_INT, 16 / 8,
- 0,
- "int16_t", (struct objfile *) NULL);
- builtin_type_uint16 =
- init_type (TYPE_CODE_INT, 16 / 8,
- TYPE_FLAG_UNSIGNED,
- "uint16_t", (struct objfile *) NULL);
- builtin_type_int32 =
- init_type (TYPE_CODE_INT, 32 / 8,
- 0,
- "int32_t", (struct objfile *) NULL);
- builtin_type_uint32 =
- init_type (TYPE_CODE_INT, 32 / 8,
- TYPE_FLAG_UNSIGNED,
- "uint32_t", (struct objfile *) NULL);
- builtin_type_int64 =
- init_type (TYPE_CODE_INT, 64 / 8,
- 0,
- "int64_t", (struct objfile *) NULL);
- builtin_type_uint64 =
- init_type (TYPE_CODE_INT, 64 / 8,
- TYPE_FLAG_UNSIGNED,
- "uint64_t", (struct objfile *) NULL);
- builtin_type_int128 =
- init_type (TYPE_CODE_INT, 128 / 8,
- 0,
- "int128_t", (struct objfile *) NULL);
- builtin_type_uint128 =
- init_type (TYPE_CODE_INT, 128 / 8,
- TYPE_FLAG_UNSIGNED,
- "uint128_t", (struct objfile *) NULL);
-
builtin_type_ieee_single =
build_flt (-1, "builtin_type_ieee_single", floatformats_ieee_single);
builtin_type_ieee_double =
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 2d9ce12..36a98c8 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -990,6 +990,21 @@ struct builtin_type
struct type *builtin_true_char;
struct type *builtin_true_unsigned_char;
+ /* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
+ is for when an architecture needs to describe a register that has
+ no size. */
+ struct type *builtin_int0;
+ struct type *builtin_int8;
+ struct type *builtin_uint8;
+ struct type *builtin_int16;
+ struct type *builtin_uint16;
+ struct type *builtin_int32;
+ struct type *builtin_uint32;
+ struct type *builtin_int64;
+ struct type *builtin_uint64;
+ struct type *builtin_int128;
+ struct type *builtin_uint128;
+
/* Pointer types. */
@@ -1056,21 +1071,6 @@ struct objfile_type
extern const struct objfile_type *objfile_type (struct objfile *objfile);
-/* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
- is for when an architecture needs to describe a register that has
- no size. */
-extern struct type *builtin_type_int0;
-extern struct type *builtin_type_int8;
-extern struct type *builtin_type_uint8;
-extern struct type *builtin_type_int16;
-extern struct type *builtin_type_uint16;
-extern struct type *builtin_type_int32;
-extern struct type *builtin_type_uint32;
-extern struct type *builtin_type_int64;
-extern struct type *builtin_type_uint64;
-extern struct type *builtin_type_int128;
-extern struct type *builtin_type_uint128;
-
/* Explicit floating-point formats. See "floatformat.h". */
extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 9d679ac..f12cb1b 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -1119,13 +1119,13 @@ h8300_register_type (struct gdbarch *gdbarch, int regno)
return builtin_type (gdbarch)->builtin_data_ptr;
default:
if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else if (is_h8300hmode (gdbarch))
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else
- return builtin_type_int16;
+ return builtin_type (gdbarch)->builtin_int16;
}
}
}
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index c97f30d..36ff8f5 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -975,7 +975,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
safely sign-extend them. */
if (len < 8)
{
- arg = value_cast (builtin_type_int64, arg);
+ arg = value_cast (builtin_type (gdbarch)->builtin_int64, arg);
len = 8;
}
}
@@ -2610,7 +2610,7 @@ static struct type *
hppa32_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum < HPPA_FP4_REGNUM)
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
else
return builtin_type_ieee_single;
}
@@ -2619,7 +2619,7 @@ static struct type *
hppa64_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum < HPPA64_FP4_REGNUM)
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
else
return builtin_type_ieee_double;
}
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 60526b0..1dd4bb9 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2052,6 +2052,8 @@ i386_mmx_type (struct gdbarch *gdbarch)
if (!tdep->i386_mmx_type)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
+
/* The type we're building is this: */
#if 0
union __gdb_builtin_type_vec64i
@@ -2066,13 +2068,14 @@ i386_mmx_type (struct gdbarch *gdbarch)
struct type *t;
t = init_composite_type ("__gdb_builtin_type_vec64i", TYPE_CODE_UNION);
- append_composite_type_field (t, "uint64", builtin_type_int64);
+
+ append_composite_type_field (t, "uint64", bt->builtin_int64);
append_composite_type_field (t, "v2_int32",
- init_vector_type (builtin_type_int32, 2));
+ init_vector_type (bt->builtin_int32, 2));
append_composite_type_field (t, "v4_int16",
- init_vector_type (builtin_type_int16, 4));
+ init_vector_type (bt->builtin_int16, 4));
append_composite_type_field (t, "v8_int8",
- init_vector_type (builtin_type_int8, 8));
+ init_vector_type (bt->builtin_int8, 8));
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec64i";
@@ -2089,6 +2092,8 @@ i386_sse_type (struct gdbarch *gdbarch)
if (!tdep->i386_sse_type)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
+
/* The type we're building is this: */
#if 0
union __gdb_builtin_type_vec128i
@@ -2107,20 +2112,18 @@ 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 (gdbarch)
- ->builtin_float, 4));
+ init_vector_type (bt->builtin_float, 4));
append_composite_type_field (t, "v2_double",
- init_vector_type (builtin_type (gdbarch)
- ->builtin_double, 2));
+ init_vector_type (bt->builtin_double, 2));
append_composite_type_field (t, "v16_int8",
- init_vector_type (builtin_type_int8, 16));
+ init_vector_type (bt->builtin_int8, 16));
append_composite_type_field (t, "v8_int16",
- init_vector_type (builtin_type_int16, 8));
+ init_vector_type (bt->builtin_int16, 8));
append_composite_type_field (t, "v4_int32",
- init_vector_type (builtin_type_int32, 4));
+ init_vector_type (bt->builtin_int32, 4));
append_composite_type_field (t, "v2_int64",
- init_vector_type (builtin_type_int64, 2));
- append_composite_type_field (t, "uint128", builtin_type_int128);
+ init_vector_type (bt->builtin_int64, 2));
+ append_composite_type_field (t, "uint128", bt->builtin_int128);
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec128i";
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 5c9329c..46d818d 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -587,7 +587,7 @@ iq2000_return_value (struct gdbarch *gdbarch, struct type *func_type,
static struct type *
iq2000_register_type (struct gdbarch *gdbarch, int regnum)
{
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static CORE_ADDR
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index f2dfa6a..71ee775 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -795,12 +795,12 @@ parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
}
/* If the type is bigger than a 32-bit signed integer can be, implicitly
- promote to long. Java does not do this, so mark it as builtin_type_uint64
- rather than parse_java_type->builtin_long. 0x80000000 will become
- -0x80000000 instead of 0x80000000L, because we don't know the sign
- at this point. */
+ promote to long. Java does not do this, so mark it as
+ parse_type->builtin_uint64 rather than parse_java_type->builtin_long.
+ 0x80000000 will become -0x80000000 instead of 0x80000000L, because we
+ don't know the sign at this point. */
if (type == parse_java_type->builtin_int && n > (ULONGEST)0x80000000)
- type = builtin_type_uint64;
+ type = parse_type->builtin_uint64;
putithere->typed_val_int.val = n;
putithere->typed_val_int.type = type;
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index def139d..c949b79 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -111,7 +111,7 @@ lm32_register_name (struct gdbarch *gdbarch, int reg_nr)
static struct type *
lm32_register_type (struct gdbarch *gdbarch, int reg_nr)
{
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
/* Return non-zero if a register can't be written. */
@@ -273,7 +273,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
case TYPE_CODE_ENUM:
if (TYPE_LENGTH (arg_type) < 4)
{
- arg_type = builtin_type_int32;
+ arg_type = builtin_type (gdbarch)->builtin_int32;
arg = value_cast (arg_type, arg);
}
break;
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index eccfe31..b5fc4cb 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -235,7 +235,7 @@ m32r_register_type (struct gdbarch *gdbarch, int reg_nr)
else if (reg_nr == M32R_SP_REGNUM || reg_nr == M32R_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 4bde070..3082429 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -289,7 +289,7 @@ m68hc11_pseudo_register_read (struct gdbarch *gdbarch,
if (regno == M68HC12_HARD_PC_REGNUM)
{
ULONGEST pc;
- const int regsize = TYPE_LENGTH (builtin_type_uint32);
+ const int regsize = 4;
regcache_cooked_read_unsigned (regcache, HARD_PC_REGNUM, &pc);
if (pc >= 0x8000 && pc < 0xc000)
@@ -329,7 +329,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
addressing mode. */
if (regno == M68HC12_HARD_PC_REGNUM)
{
- const int regsize = TYPE_LENGTH (builtin_type_uint32);
+ const int regsize = 4;
char *tmp = alloca (regsize);
CORE_ADDR pc;
@@ -1239,13 +1239,13 @@ m68hc11_register_type (struct gdbarch *gdbarch, int reg_nr)
case HARD_A_REGNUM:
case HARD_B_REGNUM:
case HARD_CCR_REGNUM:
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
case M68HC12_HARD_PC_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
default:
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
}
}
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 28e38eb..386b826 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -124,12 +124,12 @@ m68k_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == M68K_FPC_REGNUM || regnum == M68K_FPS_REGNUM)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
else
{
if (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FPI_REGNUM)
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
}
if (regnum == gdbarch_pc_regnum (gdbarch))
@@ -141,7 +141,7 @@ m68k_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == M68K_PS_REGNUM)
return m68k_ps_type;
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static const char *m68k_register_names[] = {
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 9b1084f..b1b0cfb 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -81,7 +81,7 @@ m88k_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == M88K_R30_REGNUM || regnum == M88K_R31_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
@@ -258,6 +258,7 @@ static CORE_ADDR
m88k_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int num_register_words = 0;
int num_stack_words = 0;
int i;
@@ -269,7 +270,8 @@ m88k_store_arguments (struct regcache *regcache, int nargs,
if (m88k_integral_or_pointer_p (type) && len < 4)
{
- args[i] = value_cast (builtin_type_int32, args[i]);
+ args[i] = value_cast (builtin_type (gdbarch)->builtin_int32,
+ args[i]);
type = value_type (args[i]);
len = TYPE_LENGTH (type);
}
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index e3f78b0..ee359f9 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -1084,7 +1084,7 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr)
keep the 'g' packet format fixed), and the pseudoregisters vary
in length. */
if (IS_RAW_CR_REGNUM (reg_nr))
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
/* Since GDB doesn't allow registers to change type, we have two
banks of pseudoregisters for the coprocessor general-purpose
@@ -1099,14 +1099,14 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr)
if (mep_pseudo_cr_is_float (reg_nr))
return builtin_type (gdbarch)->builtin_float;
else
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
}
else if (size == 64)
{
if (mep_pseudo_cr_is_float (reg_nr))
return builtin_type (gdbarch)->builtin_double;
else
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
}
else
gdb_assert (0);
@@ -1114,7 +1114,7 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr)
/* All other registers are 32 bits long. */
else
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 3829791..a96d43ce 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -828,6 +828,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
void
mi_cmd_data_read_memory (char *command, char **argv, int argc)
{
+ struct gdbarch *gdbarch = current_gdbarch;
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
CORE_ADDR addr;
long total_bytes;
@@ -884,23 +885,23 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
switch (word_size)
{
case 1:
- word_type = builtin_type_int8;
+ word_type = builtin_type (gdbarch)->builtin_int8;
word_asize = 'b';
break;
case 2:
- word_type = builtin_type_int16;
+ word_type = builtin_type (gdbarch)->builtin_int16;
word_asize = 'h';
break;
case 4:
- word_type = builtin_type_int32;
+ word_type = builtin_type (gdbarch)->builtin_int32;
word_asize = 'w';
break;
case 8:
- word_type = builtin_type_int64;
+ word_type = builtin_type (gdbarch)->builtin_int64;
word_asize = 'g';
break;
default:
- word_type = builtin_type_int8;
+ word_type = builtin_type (gdbarch)->builtin_int8;
word_asize = 'b';
}
/* The number of rows. */
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index ccd2069..2af536c 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -679,9 +679,9 @@ mips_register_type (struct gdbarch *gdbarch, int regnum)
/* The raw or ISA registers. These are all sized according to
the ISA regsize. */
if (mips_isa_regsize (gdbarch) == 4)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
}
else
{
@@ -692,19 +692,19 @@ mips_register_type (struct gdbarch *gdbarch, int regnum)
&& regnum <= gdbarch_num_regs (gdbarch) + MIPS_LAST_EMBED_REGNUM)
/* The pseudo/cooked view of the embedded registers is always
32-bit. The raw view is handled below. */
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p)
/* The target, while possibly using a 64-bit register buffer,
is only transfering 32-bits of each integer register.
Reflect this in the cooked/pseudo (ABI) register value. */
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else if (mips_abi_regsize (gdbarch) == 4)
/* The ABI is restricted to 32-bit registers (the ISA could be
32- or 64-bit). */
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else
/* 64-bit ABI. */
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
}
}
@@ -741,7 +741,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
the necessary 32 bits, but older versions of GDB expected 64,
so allow the target to provide 64 bits without interfering
with the displayed type. */
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
/* Use pointer types for registers if we can. For n32 we can not,
@@ -757,7 +757,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
if (mips_abi_regsize (gdbarch) == 4 && TYPE_LENGTH (rawtype) == 8
&& rawnum >= MIPS_ZERO_REGNUM && rawnum <= MIPS_EMBED_PC_REGNUM)
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
/* For all other registers, pass through the hardware type. */
return rawtype;
@@ -4396,8 +4396,9 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
get_formatted_print_options (&opts, 'x');
- print_scalar_formatted (raw_buffer, builtin_type_uint32, &opts, 'w',
- file);
+ print_scalar_formatted (raw_buffer,
+ builtin_type (gdbarch)->builtin_uint32,
+ &opts, 'w', file);
fprintf_filtered (file, " flt: ");
if (inv1)
@@ -4430,8 +4431,9 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
get_formatted_print_options (&opts, 'x');
- print_scalar_formatted (raw_buffer, builtin_type_uint64, &opts, 'g',
- file);
+ print_scalar_formatted (raw_buffer,
+ builtin_type (gdbarch)->builtin_uint64,
+ &opts, 'g', file);
fprintf_filtered (file, " flt: ");
if (inv1)
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 23b573e..93ba07c 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -110,7 +110,7 @@ moxie_register_type (struct gdbarch *gdbarch, int reg_nr)
else if (reg_nr == MOXIE_SP_REGNUM || reg_nr == MOXIE_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
/* Write into appropriate registers a function return value
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index ec52d5b..b0da869 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -139,6 +139,14 @@ enum mt_gdb_regnums
* MT_COPRO_PSEUDOREG_DIM_2)
};
+/* The tdep structure. */
+struct gdbarch_tdep
+{
+ /* ISA-specific types. */
+ struct type *copro_type;
+};
+
+
/* Return name of register number specified by REGNUM. */
static const char *
@@ -213,7 +221,7 @@ mt_copro_register_type (struct gdbarch *arch, int regnum)
case MT_QCHANNEL_REGNUM:
case MT_ISCRAMB_REGNUM:
case MT_QSCRAMB_REGNUM:
- return builtin_type_int32;
+ return builtin_type (arch)->builtin_int32;
case MT_BYPA_REGNUM:
case MT_BYPB_REGNUM:
case MT_BYPC_REGNUM:
@@ -222,27 +230,27 @@ mt_copro_register_type (struct gdbarch *arch, int regnum)
case MT_OUT_REGNUM:
case MT_ZI2_REGNUM:
case MT_ZQ2_REGNUM:
- return builtin_type_int16;
+ return builtin_type (arch)->builtin_int16;
case MT_EXMAC_REGNUM:
case MT_MAC_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (arch)->builtin_uint32;
case MT_CONTEXT_REGNUM:
return builtin_type (arch)->builtin_long_long;
case MT_FLAG_REGNUM:
return builtin_type (arch)->builtin_unsigned_char;
default:
if (regnum >= MT_CPR0_REGNUM && regnum <= MT_CPR15_REGNUM)
- return builtin_type_int16;
+ return builtin_type (arch)->builtin_int16;
else if (regnum == MT_CPR0_REGNUM + MT_COPRO_PSEUDOREG_MAC_REGNUM)
{
if (gdbarch_bfd_arch_info (arch)->mach == bfd_mach_mrisc2
|| gdbarch_bfd_arch_info (arch)->mach == bfd_mach_ms2)
- return builtin_type_uint64;
+ return builtin_type (arch)->builtin_uint64;
else
- return builtin_type_uint32;
+ return builtin_type (arch)->builtin_uint32;
}
else
- return builtin_type_uint32;
+ return builtin_type (arch)->builtin_uint32;
}
}
@@ -252,12 +260,10 @@ mt_copro_register_type (struct gdbarch *arch, int regnum)
static struct type *
mt_register_type (struct gdbarch *arch, int regnum)
{
- static struct type *copro_type = NULL;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
if (regnum >= 0 && regnum < MT_NUM_REGS + MT_NUM_PSEUDO_REGS)
{
- if (copro_type == NULL)
- copro_type = lookup_array_range_type (builtin_type_int16, 0, 1);
switch (regnum)
{
case MT_PC_REGNUM:
@@ -269,14 +275,19 @@ mt_register_type (struct gdbarch *arch, int regnum)
return builtin_type (arch)->builtin_data_ptr;
case MT_COPRO_REGNUM:
case MT_COPRO_PSEUDOREG_REGNUM:
- return copro_type;
+ if (tdep->copro_type == NULL)
+ {
+ struct type *elt = builtin_type (arch)->builtin_int16;
+ tdep->copro_type = lookup_array_range_type (elt, 0, 1);
+ }
+ return tdep->copro_type;
case MT_MAC_PSEUDOREG_REGNUM:
return mt_copro_register_type (arch,
MT_CPR0_REGNUM
+ MT_COPRO_PSEUDOREG_MAC_REGNUM);
default:
if (regnum >= MT_R0_REGNUM && regnum <= MT_R15_REGNUM)
- return builtin_type_int32;
+ return builtin_type (arch)->builtin_int32;
else if (regnum < MT_COPRO_PSEUDOREG_ARRAY)
return mt_copro_register_type (arch, regnum);
else
@@ -1098,6 +1109,7 @@ static struct gdbarch *
mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
+ struct gdbarch_tdep *tdep;
/* Find a candidate among the list of pre-declared architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
@@ -1106,7 +1118,8 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* None found, create a new architecture from the information
provided. */
- gdbarch = gdbarch_alloc (&info, NULL);
+ tdep = XCALLOC (1, struct gdbarch_tdep);
+ gdbarch = gdbarch_alloc (&info, tdep);
set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 59bb656..e0fb9fc 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -781,13 +781,13 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
}
if (size == 'b')
- val_type = builtin_type_int8;
+ val_type = builtin_type (next_gdbarch)->builtin_int8;
else if (size == 'h')
- val_type = builtin_type_int16;
+ val_type = builtin_type (next_gdbarch)->builtin_int16;
else if (size == 'w')
- val_type = builtin_type_int32;
+ val_type = builtin_type (next_gdbarch)->builtin_int32;
else if (size == 'g')
- val_type = builtin_type_int64;
+ val_type = builtin_type (next_gdbarch)->builtin_int64;
maxelts = 8;
if (size == 'w')
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 863cedb..00b42d0 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2248,6 +2248,8 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
if (!tdep->ppc_builtin_type_vec64)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
+
/* The type we're building is this: */
#if 0
union __gdb_builtin_type_vec64
@@ -2263,16 +2265,15 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
struct type *t;
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, "uint64", bt->builtin_int64);
append_composite_type_field (t, "v2_float",
- init_vector_type (builtin_type (gdbarch)
- ->builtin_float, 2));
+ init_vector_type (bt->builtin_float, 2));
append_composite_type_field (t, "v2_int32",
- init_vector_type (builtin_type_int32, 2));
+ init_vector_type (bt->builtin_int32, 2));
append_composite_type_field (t, "v4_int16",
- init_vector_type (builtin_type_int16, 4));
+ init_vector_type (bt->builtin_int16, 4));
append_composite_type_field (t, "v8_int8",
- init_vector_type (builtin_type_int8, 8));
+ init_vector_type (bt->builtin_int8, 8));
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "ppc_builtin_type_vec64";
@@ -2291,6 +2292,8 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
if (!tdep->ppc_builtin_type_vec128)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
+
/* The type we're building is this
type = union __ppc_builtin_type_vec128 {
@@ -2305,15 +2308,15 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
struct type *t;
t = init_composite_type ("__ppc_builtin_type_vec128", TYPE_CODE_UNION);
- append_composite_type_field (t, "uint128", builtin_type_uint128);
+ append_composite_type_field (t, "uint128", bt->builtin_uint128);
append_composite_type_field (t, "v4_float",
- init_vector_type (builtin_type (gdbarch)->builtin_float, 4));
+ init_vector_type (bt->builtin_float, 4));
append_composite_type_field (t, "v4_int32",
- init_vector_type (builtin_type_int32, 4));
+ init_vector_type (bt->builtin_int32, 4));
append_composite_type_field (t, "v8_int16",
- init_vector_type (builtin_type_int16, 8));
+ init_vector_type (bt->builtin_int16, 8));
append_composite_type_field (t, "v16_int8",
- init_vector_type (builtin_type_int8, 16));
+ init_vector_type (bt->builtin_int8, 16));
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "ppc_builtin_type_vec128";
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 59f1bff..e54f33c 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -268,7 +268,7 @@ static struct type *
score_register_type (struct gdbarch *gdbarch, int regnum)
{
gdb_assert (regnum >= 0 && regnum < SCORE_NUM_REGS);
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
}
static CORE_ADDR
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 543a397..9a60ff8 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -349,7 +349,7 @@ sparc32_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == SPARC32_FSR_REGNUM)
return sparc_fsr_type;
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static void
@@ -406,6 +406,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* Number of words in the "parameter array". */
int num_elements = 0;
int element = 0;
@@ -442,7 +443,8 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
gdb_assert (sparc_integral_or_pointer_p (type));
if (len < 4)
- args[i] = value_cast (builtin_type_int32, args[i]);
+ args[i] = value_cast (builtin_type (gdbarch)->builtin_int32,
+ args[i]);
num_elements += ((len + 3) / 4);
}
}
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index ba51aab..d1b04d7 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -249,7 +249,7 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == SPARC_SP_REGNUM || regnum == SPARC_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
if (regnum >= SPARC_G0_REGNUM && regnum <= SPARC_I7_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
return builtin_type (gdbarch)->builtin_float;
if (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM)
@@ -259,7 +259,7 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
/* This raw register contains the contents of %cwp, %pstate, %asi
and %ccr as laid out in a %tstate register. */
if (regnum == SPARC64_STATE_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_FSR_REGNUM)
return sparc64_fsr_type;
if (regnum == SPARC64_FPRS_REGNUM)
@@ -267,18 +267,18 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
/* "Although Y is a 64-bit register, its high-order 32 bits are
reserved and always read as 0." */
if (regnum == SPARC64_Y_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
/* Pseudo registers. */
if (regnum == SPARC64_CWP_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_PSTATE_REGNUM)
return sparc64_pstate_type;
if (regnum == SPARC64_ASI_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_CCR_REGNUM)
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D62_REGNUM)
return builtin_type (gdbarch)->builtin_double;
if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM)
@@ -687,6 +687,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* Number of extended words in the "parameter array". */
int num_elements = 0;
int element = 0;
@@ -768,7 +769,8 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
caller to an extended word according to the signed-ness
of the argument type." */
if (len < 8)
- args[i] = value_cast (builtin_type_int64, args[i]);
+ args[i] = value_cast (builtin_type (gdbarch)->builtin_int64,
+ args[i]);
num_elements++;
}
}
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index d7c482b..4fa94cc 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -61,24 +61,23 @@ spu_builtin_type_vec128 (struct gdbarch *gdbarch)
if (!tdep->spu_builtin_type_vec128)
{
+ const struct builtin_type *bt = builtin_type (gdbarch);
struct type *t;
t = init_composite_type ("__spu_builtin_type_vec128", TYPE_CODE_UNION);
- append_composite_type_field (t, "uint128", builtin_type_int128);
+ append_composite_type_field (t, "uint128", bt->builtin_int128);
append_composite_type_field (t, "v2_int64",
- init_vector_type (builtin_type_int64, 2));
+ init_vector_type (bt->builtin_int64, 2));
append_composite_type_field (t, "v4_int32",
- init_vector_type (builtin_type_int32, 4));
+ init_vector_type (bt->builtin_int32, 4));
append_composite_type_field (t, "v8_int16",
- init_vector_type (builtin_type_int16, 8));
+ init_vector_type (bt->builtin_int16, 8));
append_composite_type_field (t, "v16_int8",
- init_vector_type (builtin_type_int8, 16));
+ init_vector_type (bt->builtin_int8, 16));
append_composite_type_field (t, "v2_double",
- init_vector_type (builtin_type (gdbarch)
- ->builtin_double, 2));
+ init_vector_type (bt->builtin_double, 2));
append_composite_type_field (t, "v4_float",
- init_vector_type (builtin_type (gdbarch)
- ->builtin_float, 4));
+ init_vector_type (bt->builtin_float, 4));
TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "spu_builtin_type_vec128";
@@ -136,7 +135,7 @@ spu_register_type (struct gdbarch *gdbarch, int reg_nr)
switch (reg_nr)
{
case SPU_ID_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case SPU_PC_REGNUM:
return builtin_type (gdbarch)->builtin_func_ptr;
@@ -145,19 +144,19 @@ spu_register_type (struct gdbarch *gdbarch, int reg_nr)
return builtin_type (gdbarch)->builtin_data_ptr;
case SPU_FPSCR_REGNUM:
- return builtin_type_uint128;
+ return builtin_type (gdbarch)->builtin_uint128;
case SPU_SRR0_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case SPU_LSLR_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case SPU_DECR_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case SPU_DECR_STATUS_REGNUM:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
default:
internal_error (__FILE__, __LINE__, "invalid regnum");
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 48fc7df..9cdb546 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -452,34 +452,34 @@ tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type)
{
/* Predefined types. */
case TDESC_TYPE_INT8:
- return builtin_type_int8;
+ return builtin_type (gdbarch)->builtin_int8;
case TDESC_TYPE_INT16:
- return builtin_type_int16;
+ return builtin_type (gdbarch)->builtin_int16;
case TDESC_TYPE_INT32:
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
case TDESC_TYPE_INT64:
- return builtin_type_int64;
+ return builtin_type (gdbarch)->builtin_int64;
case TDESC_TYPE_INT128:
- return builtin_type_int128;
+ return builtin_type (gdbarch)->builtin_int128;
case TDESC_TYPE_UINT8:
- return builtin_type_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
case TDESC_TYPE_UINT16:
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
case TDESC_TYPE_UINT32:
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
case TDESC_TYPE_UINT64:
- return builtin_type_uint64;
+ return builtin_type (gdbarch)->builtin_uint64;
case TDESC_TYPE_UINT128:
- return builtin_type_uint128;
+ return builtin_type (gdbarch)->builtin_uint128;
case TDESC_TYPE_CODE_PTR:
return builtin_type (gdbarch)->builtin_func_ptr;
@@ -708,7 +708,7 @@ tdesc_register_type (struct gdbarch *gdbarch, int regno)
if (reg == NULL)
/* Return "int0_t", since "void" has a misleading size of one. */
- return builtin_type_int0;
+ return builtin_type (gdbarch)->builtin_int0;
if (arch_reg->type == NULL)
{
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 285fe3f..daff7e1 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -184,7 +184,7 @@ v850_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum == E_PC_REGNUM)
return builtin_type (gdbarch)->builtin_func_ptr;
- return builtin_type_int32;
+ return builtin_type (gdbarch)->builtin_int32;
}
static int
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 4445d3f..c5601b4 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -125,9 +125,9 @@ static struct type *
xstormy16_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum == E_PC_REGNUM)
- return builtin_type_uint32;
+ return builtin_type (gdbarch)->builtin_uint32;
else
- return builtin_type_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
}
/* Function: xstormy16_type_is_scalar
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 9f0d46a..7a96577 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -214,33 +214,27 @@ xtensa_register_name (struct gdbarch *gdbarch, int regnum)
/* Return the type of a register. Create a new type, if necessary. */
-static struct ctype_cache
-{
- struct ctype_cache *next;
- int size;
- struct type *virtual_type;
-} *type_entries = NULL;
-
static struct type *
xtensa_register_type (struct gdbarch *gdbarch, int regnum)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
/* Return signed integer for ARx and Ax registers. */
- if ((regnum >= gdbarch_tdep (gdbarch)->ar_base
- && regnum < gdbarch_tdep (gdbarch)->ar_base
- + gdbarch_tdep (gdbarch)->num_aregs)
- || (regnum >= gdbarch_tdep (gdbarch)->a0_base
- && regnum < gdbarch_tdep (gdbarch)->a0_base + 16))
+ if ((regnum >= tdep->ar_base
+ && regnum < tdep->ar_base + tdep->num_aregs)
+ || (regnum >= tdep->a0_base
+ && regnum < tdep->a0_base + 16))
return builtin_type (gdbarch)->builtin_int;
if (regnum == gdbarch_pc_regnum (gdbarch)
- || regnum == gdbarch_tdep (gdbarch)->a0_base + 1)
+ || regnum == tdep->a0_base + 1)
return builtin_type (gdbarch)->builtin_data_ptr;
/* Return the stored type for all other registers. */
else if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch))
{
- xtensa_register_t* reg = &gdbarch_tdep (gdbarch)->regmap[regnum];
+ xtensa_register_t* reg = &tdep->regmap[regnum];
/* Set ctype for this register (only the first time). */
@@ -254,27 +248,27 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
switch (size)
{
case 1:
- reg->ctype = builtin_type_uint8;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint8;
break;
case 2:
- reg->ctype = builtin_type_uint16;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint16;
break;
case 4:
- reg->ctype = builtin_type_uint32;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint32;
break;
case 8:
- reg->ctype = builtin_type_uint64;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint64;
break;
case 16:
- reg->ctype = builtin_type_uint128;
+ reg->ctype = builtin_type (gdbarch)->builtin_uint128;
break;
default:
- for (tp = type_entries; tp != NULL; tp = tp->next)
+ for (tp = tdep->type_entries; tp != NULL; tp = tp->next)
if (tp->size == size)
break;
@@ -282,8 +276,8 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
{
char *name = xmalloc (16);
tp = xmalloc (sizeof (struct ctype_cache));
- tp->next = type_entries;
- type_entries = tp;
+ tp->next = tdep->type_entries;
+ tdep->type_entries = tp;
tp->size = size;
sprintf (name, "int%d", size * 8);
diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index 8582da6..49afff6 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -227,6 +227,14 @@ struct gdbarch_tdep
unsigned long *fp_layout; /* Layout of custom/TIE regs in 'FP' area. */
unsigned int fp_layout_bytes; /* Size of layout information (in bytes). */
unsigned long *gregmap;
+
+ /* Cached register types. */
+ struct ctype_cache
+ {
+ struct ctype_cache *next;
+ int size;
+ struct type *virtual_type;
+ } *type_entries;
};
/* Macro to instantiate a gdbarch_tdep structure. */