aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:52:52 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:52:52 +0000
commit209bd28e8ba1a8d4f3f5e90ea954437050870837 (patch)
treec698a17c33330d90bf8c511a622064e2ac6ccc82
parent270677457f363b213b10923759f4f96ed1aa868b (diff)
downloadgdb-209bd28e8ba1a8d4f3f5e90ea954437050870837.zip
gdb-209bd28e8ba1a8d4f3f5e90ea954437050870837.tar.gz
gdb-209bd28e8ba1a8d4f3f5e90ea954437050870837.tar.bz2
* i386-tdep.h (struct gdbarch_tdep): Add i386_eflags_type and
i386_mxcsr_type members. (i386_eflags_type): Make into function. (i386_mxcsr_type): Likewise. * i386-tdep.c (i386_eflags_type): Make into function. (i386_mxcsr_type): Likewise. (i386_register_type): Update uses. (i386_init_types): Remove. (_initialize_i386_tdep): Do not call it. * amd64-tdep.c (amd64_register_type): Update uses. * m68k-tdep.h (struct gdbarch_tdep): Add m68k_ps_type member. * m68k-tdep.c (m68k_ps_type): Make into function. (m68k_register_type): Update use. (m68k_init_types): Remove. (_initialize_m68k_tdep): Do not call it. * sparc-tdep.h (struct gdbarch_tdep): Add sparc_psr_type, sparc_fsr_type, sparc64_pstate_type, sparc64_fsr_type, and sparc64_fprs_type members. * sparc-tdep.c (sparc_psr_type): Make into function. (sparc_fsr_type): Likewise. (sparc32_register_type): Update uses. (sparc_init_types): Remove. (_initialize_sparc_tdep): Do not call it. * sparc64-tdep.c (sparc64_pstate_type): Make into function. (sparc64_fsr_type): Likewise. (sparc64_fprs_type): Likewise. (sparc64_register_type): Update uses. (sparc64_init_types): Remove. (_initialize_sparc64_tdep): Likewise.
-rw-r--r--gdb/ChangeLog34
-rw-r--r--gdb/amd64-tdep.c4
-rw-r--r--gdb/i386-tdep.c113
-rw-r--r--gdb/i386-tdep.h7
-rw-r--r--gdb/m68k-tdep.c52
-rw-r--r--gdb/m68k-tdep.h1
-rw-r--r--gdb/sparc-tdep.c92
-rw-r--r--gdb/sparc-tdep.h7
-rw-r--r--gdb/sparc64-tdep.c140
9 files changed, 270 insertions, 180 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c0755e2..f95d74b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,39 @@
2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
+ * i386-tdep.h (struct gdbarch_tdep): Add i386_eflags_type and
+ i386_mxcsr_type members.
+ (i386_eflags_type): Make into function.
+ (i386_mxcsr_type): Likewise.
+ * i386-tdep.c (i386_eflags_type): Make into function.
+ (i386_mxcsr_type): Likewise.
+ (i386_register_type): Update uses.
+ (i386_init_types): Remove.
+ (_initialize_i386_tdep): Do not call it.
+ * amd64-tdep.c (amd64_register_type): Update uses.
+
+ * m68k-tdep.h (struct gdbarch_tdep): Add m68k_ps_type member.
+ * m68k-tdep.c (m68k_ps_type): Make into function.
+ (m68k_register_type): Update use.
+ (m68k_init_types): Remove.
+ (_initialize_m68k_tdep): Do not call it.
+
+ * sparc-tdep.h (struct gdbarch_tdep): Add sparc_psr_type,
+ sparc_fsr_type, sparc64_pstate_type, sparc64_fsr_type, and
+ sparc64_fprs_type members.
+ * sparc-tdep.c (sparc_psr_type): Make into function.
+ (sparc_fsr_type): Likewise.
+ (sparc32_register_type): Update uses.
+ (sparc_init_types): Remove.
+ (_initialize_sparc_tdep): Do not call it.
+ * sparc64-tdep.c (sparc64_pstate_type): Make into function.
+ (sparc64_fsr_type): Likewise.
+ (sparc64_fprs_type): Likewise.
+ (sparc64_register_type): Update uses.
+ (sparc64_init_types): Remove.
+ (_initialize_sparc64_tdep): Likewise.
+
+2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
+
* gdbtypes.h (builtin_type_ieee_single, builtin_type_ieee_double,
builtin_type_i387_ext, builtin_type_m68881_ext, builtin_type_arm_ext,
builtin_type_ia64_spill, builtin_type_ia64_quad): Remove.
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 904915e..59434e2 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -98,7 +98,7 @@ amd64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == AMD64_RIP_REGNUM)
return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == AMD64_EFLAGS_REGNUM)
- return i386_eflags_type;
+ return i386_eflags_type (gdbarch);
if (regnum >= AMD64_CS_REGNUM && regnum <= AMD64_GS_REGNUM)
return builtin_type (gdbarch)->builtin_int32;
if (regnum >= AMD64_ST0_REGNUM && regnum <= AMD64_ST0_REGNUM + 7)
@@ -108,7 +108,7 @@ amd64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum >= AMD64_XMM0_REGNUM && regnum <= AMD64_XMM0_REGNUM + 15)
return i386_sse_type (gdbarch);
if (regnum == AMD64_MXCSR_REGNUM)
- return i386_mxcsr_type;
+ return i386_mxcsr_type (gdbarch);
internal_error (__FILE__, __LINE__, _("invalid regnum"));
}
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index cd7fe4c..a5b1b49 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1994,54 +1994,70 @@ i386_return_value (struct gdbarch *gdbarch, struct type *func_type,
}
-/* Type for %eflags. */
-struct type *i386_eflags_type;
+/* Construct types for ISA-specific registers. */
+struct type *
+i386_eflags_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-/* Type for %mxcsr. */
-struct type *i386_mxcsr_type;
+ if (!tdep->i386_eflags_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_i386_eflags", 4);
+ append_flags_type_flag (type, 0, "CF");
+ append_flags_type_flag (type, 1, NULL);
+ append_flags_type_flag (type, 2, "PF");
+ append_flags_type_flag (type, 4, "AF");
+ append_flags_type_flag (type, 6, "ZF");
+ append_flags_type_flag (type, 7, "SF");
+ append_flags_type_flag (type, 8, "TF");
+ append_flags_type_flag (type, 9, "IF");
+ append_flags_type_flag (type, 10, "DF");
+ append_flags_type_flag (type, 11, "OF");
+ append_flags_type_flag (type, 14, "NT");
+ append_flags_type_flag (type, 16, "RF");
+ append_flags_type_flag (type, 17, "VM");
+ append_flags_type_flag (type, 18, "AC");
+ append_flags_type_flag (type, 19, "VIF");
+ append_flags_type_flag (type, 20, "VIP");
+ append_flags_type_flag (type, 21, "ID");
+
+ tdep->i386_eflags_type = type;
+ }
-/* Construct types for ISA-specific registers. */
-static void
-i386_init_types (void)
+ return tdep->i386_eflags_type;
+}
+
+struct type *
+i386_mxcsr_type (struct gdbarch *gdbarch)
{
- struct type *type;
-
- type = init_flags_type ("builtin_type_i386_eflags", 4);
- append_flags_type_flag (type, 0, "CF");
- append_flags_type_flag (type, 1, NULL);
- append_flags_type_flag (type, 2, "PF");
- append_flags_type_flag (type, 4, "AF");
- append_flags_type_flag (type, 6, "ZF");
- append_flags_type_flag (type, 7, "SF");
- append_flags_type_flag (type, 8, "TF");
- append_flags_type_flag (type, 9, "IF");
- append_flags_type_flag (type, 10, "DF");
- append_flags_type_flag (type, 11, "OF");
- append_flags_type_flag (type, 14, "NT");
- append_flags_type_flag (type, 16, "RF");
- append_flags_type_flag (type, 17, "VM");
- append_flags_type_flag (type, 18, "AC");
- append_flags_type_flag (type, 19, "VIF");
- append_flags_type_flag (type, 20, "VIP");
- append_flags_type_flag (type, 21, "ID");
- i386_eflags_type = type;
-
- type = init_flags_type ("builtin_type_i386_mxcsr", 4);
- append_flags_type_flag (type, 0, "IE");
- append_flags_type_flag (type, 1, "DE");
- append_flags_type_flag (type, 2, "ZE");
- append_flags_type_flag (type, 3, "OE");
- append_flags_type_flag (type, 4, "UE");
- append_flags_type_flag (type, 5, "PE");
- append_flags_type_flag (type, 6, "DAZ");
- append_flags_type_flag (type, 7, "IM");
- append_flags_type_flag (type, 8, "DM");
- append_flags_type_flag (type, 9, "ZM");
- append_flags_type_flag (type, 10, "OM");
- append_flags_type_flag (type, 11, "UM");
- append_flags_type_flag (type, 12, "PM");
- append_flags_type_flag (type, 15, "FZ");
- i386_mxcsr_type = type;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (!tdep->i386_mxcsr_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_i386_mxcsr", 4);
+ append_flags_type_flag (type, 0, "IE");
+ append_flags_type_flag (type, 1, "DE");
+ append_flags_type_flag (type, 2, "ZE");
+ append_flags_type_flag (type, 3, "OE");
+ append_flags_type_flag (type, 4, "UE");
+ append_flags_type_flag (type, 5, "PE");
+ append_flags_type_flag (type, 6, "DAZ");
+ append_flags_type_flag (type, 7, "IM");
+ append_flags_type_flag (type, 8, "DM");
+ append_flags_type_flag (type, 9, "ZM");
+ append_flags_type_flag (type, 10, "OM");
+ append_flags_type_flag (type, 11, "UM");
+ append_flags_type_flag (type, 12, "PM");
+ append_flags_type_flag (type, 15, "FZ");
+
+ tdep->i386_mxcsr_type = type;
+ }
+
+ return tdep->i386_mxcsr_type;
}
struct type *
@@ -2157,7 +2173,7 @@ i386_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == I386_EFLAGS_REGNUM)
- return i386_eflags_type;
+ return i386_eflags_type (gdbarch);
if (regnum == I386_EBP_REGNUM || regnum == I386_ESP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
@@ -2172,7 +2188,7 @@ i386_register_type (struct gdbarch *gdbarch, int regnum)
return i386_sse_type (gdbarch);
if (regnum == I387_MXCSR_REGNUM (gdbarch_tdep (gdbarch)))
- return i386_mxcsr_type;
+ return i386_mxcsr_type (gdbarch);
return builtin_type (gdbarch)->builtin_int;
}
@@ -5352,7 +5368,6 @@ is \"default\"."),
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_GO32,
i386_go32_init_abi);
- /* Initialize the i386-specific register groups & types. */
+ /* Initialize the i386-specific register groups. */
i386_init_reggroups ();
- i386_init_types();
}
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index f058273..8b436d7 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -104,6 +104,8 @@ struct gdbarch_tdep
int sc_sp_offset;
/* ISA-specific data types. */
+ struct type *i386_eflags_type;
+ struct type *i386_mxcsr_type;
struct type *i386_mmx_type;
struct type *i386_sse_type;
struct type *i387_ext_type;
@@ -160,9 +162,8 @@ enum i386_regnum
#define I386_MAX_REGISTER_SIZE 16
/* Types for i386-specific registers. */
-extern struct type *i386_eflags_type;
-extern struct type *i386_mxcsr_type;
-
+extern struct type *i386_eflags_type (struct gdbarch *gdbarch);
+extern struct type *i386_mxcsr_type (struct gdbarch *gdbarch);
extern struct type *i386_mmx_type (struct gdbarch *gdbarch);
extern struct type *i386_sse_type (struct gdbarch *gdbarch);
extern struct type *i387_ext_type (struct gdbarch *gdbarch);
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index dda67e3..0c551c6 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -71,29 +71,34 @@ m68k_local_breakpoint_from_pc (struct gdbarch *gdbarch,
}
-/* Type for %ps. */
-struct type *m68k_ps_type;
-
/* Construct types for ISA-specific registers. */
-static void
-m68k_init_types (void)
+static struct type *
+m68k_ps_type (struct gdbarch *gdbarch)
{
- struct type *type;
-
- type = init_flags_type ("builtin_type_m68k_ps", 4);
- append_flags_type_flag (type, 0, "C");
- append_flags_type_flag (type, 1, "V");
- append_flags_type_flag (type, 2, "Z");
- append_flags_type_flag (type, 3, "N");
- append_flags_type_flag (type, 4, "X");
- append_flags_type_flag (type, 8, "I0");
- append_flags_type_flag (type, 9, "I1");
- append_flags_type_flag (type, 10, "I2");
- append_flags_type_flag (type, 12, "M");
- append_flags_type_flag (type, 13, "S");
- append_flags_type_flag (type, 14, "T0");
- append_flags_type_flag (type, 15, "T1");
- m68k_ps_type = type;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (!tdep->m68k_ps_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_m68k_ps", 4);
+ append_flags_type_flag (type, 0, "C");
+ append_flags_type_flag (type, 1, "V");
+ append_flags_type_flag (type, 2, "Z");
+ append_flags_type_flag (type, 3, "N");
+ append_flags_type_flag (type, 4, "X");
+ append_flags_type_flag (type, 8, "I0");
+ append_flags_type_flag (type, 9, "I1");
+ append_flags_type_flag (type, 10, "I2");
+ append_flags_type_flag (type, 12, "M");
+ append_flags_type_flag (type, 13, "S");
+ append_flags_type_flag (type, 14, "T0");
+ append_flags_type_flag (type, 15, "T1");
+
+ tdep->m68k_ps_type = type;
+ }
+
+ return tdep->m68k_ps_type;
}
static struct type *
@@ -152,7 +157,7 @@ m68k_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type (gdbarch)->builtin_data_ptr;
if (regnum == M68K_PS_REGNUM)
- return m68k_ps_type;
+ return m68k_ps_type (gdbarch);
return builtin_type (gdbarch)->builtin_int32;
}
@@ -1257,7 +1262,4 @@ void
_initialize_m68k_tdep (void)
{
gdbarch_register (bfd_arch_m68k, m68k_gdbarch_init, m68k_dump_tdep);
-
- /* Initialize the m68k-specific register types. */
- m68k_init_types ();
}
diff --git a/gdb/m68k-tdep.h b/gdb/m68k-tdep.h
index 986def1..7825094 100644
--- a/gdb/m68k-tdep.h
+++ b/gdb/m68k-tdep.h
@@ -94,6 +94,7 @@ struct gdbarch_tdep
int fpregs_present;
/* ISA-specific data types. */
+ struct type *m68k_ps_type;
struct type *m68881_ext_type;
};
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 9a60ff8..f6dbf3f 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -283,46 +283,61 @@ sparc32_register_name (struct gdbarch *gdbarch, int regnum)
return NULL;
}
+/* Construct types for ISA-specific registers. */
-/* Type for %psr. */
-struct type *sparc_psr_type;
+static struct type *
+sparc_psr_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-/* Type for %fsr. */
-struct type *sparc_fsr_type;
+ if (!tdep->sparc_psr_type)
+ {
+ struct type *type;
-/* Construct types for ISA-specific registers. */
+ type = init_flags_type ("builtin_type_sparc_psr", 4);
+ append_flags_type_flag (type, 5, "ET");
+ append_flags_type_flag (type, 6, "PS");
+ append_flags_type_flag (type, 7, "S");
+ append_flags_type_flag (type, 12, "EF");
+ append_flags_type_flag (type, 13, "EC");
-static void
-sparc_init_types (void)
+ tdep->sparc_psr_type = type;
+ }
+
+ return tdep->sparc_psr_type;
+}
+
+static struct type *
+sparc_fsr_type (struct gdbarch *gdbarch)
{
- struct type *type;
-
- type = init_flags_type ("builtin_type_sparc_psr", 4);
- append_flags_type_flag (type, 5, "ET");
- append_flags_type_flag (type, 6, "PS");
- append_flags_type_flag (type, 7, "S");
- append_flags_type_flag (type, 12, "EF");
- append_flags_type_flag (type, 13, "EC");
- sparc_psr_type = type;
-
- type = init_flags_type ("builtin_type_sparc_fsr", 4);
- append_flags_type_flag (type, 0, "NXA");
- append_flags_type_flag (type, 1, "DZA");
- append_flags_type_flag (type, 2, "UFA");
- append_flags_type_flag (type, 3, "OFA");
- append_flags_type_flag (type, 4, "NVA");
- append_flags_type_flag (type, 5, "NXC");
- append_flags_type_flag (type, 6, "DZC");
- append_flags_type_flag (type, 7, "UFC");
- append_flags_type_flag (type, 8, "OFC");
- append_flags_type_flag (type, 9, "NVC");
- append_flags_type_flag (type, 22, "NS");
- append_flags_type_flag (type, 23, "NXM");
- append_flags_type_flag (type, 24, "DZM");
- append_flags_type_flag (type, 25, "UFM");
- append_flags_type_flag (type, 26, "OFM");
- append_flags_type_flag (type, 27, "NVM");
- sparc_fsr_type = type;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (!tdep->sparc_fsr_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_sparc_fsr", 4);
+ append_flags_type_flag (type, 0, "NXA");
+ append_flags_type_flag (type, 1, "DZA");
+ append_flags_type_flag (type, 2, "UFA");
+ append_flags_type_flag (type, 3, "OFA");
+ append_flags_type_flag (type, 4, "NVA");
+ append_flags_type_flag (type, 5, "NXC");
+ append_flags_type_flag (type, 6, "DZC");
+ append_flags_type_flag (type, 7, "UFC");
+ append_flags_type_flag (type, 8, "OFC");
+ append_flags_type_flag (type, 9, "NVC");
+ append_flags_type_flag (type, 22, "NS");
+ append_flags_type_flag (type, 23, "NXM");
+ append_flags_type_flag (type, 24, "DZM");
+ append_flags_type_flag (type, 25, "UFM");
+ append_flags_type_flag (type, 26, "OFM");
+ append_flags_type_flag (type, 27, "NVM");
+
+ tdep->sparc_fsr_type = type;
+ }
+
+ return tdep->sparc_fsr_type;
}
/* Return the GDB type object for the "standard" data type of data in
@@ -344,10 +359,10 @@ sparc32_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type (gdbarch)->builtin_func_ptr;
if (regnum == SPARC32_PSR_REGNUM)
- return sparc_psr_type;
+ return sparc_psr_type (gdbarch);
if (regnum == SPARC32_FSR_REGNUM)
- return sparc_fsr_type;
+ return sparc_fsr_type (gdbarch);
return builtin_type (gdbarch)->builtin_int32;
}
@@ -1740,7 +1755,4 @@ void
_initialize_sparc_tdep (void)
{
register_gdbarch_init (bfd_arch_sparc, sparc32_gdbarch_init);
-
- /* Initialize the SPARC-specific register types. */
- sparc_init_types();
}
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index 6df6e7e..77a4578 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -67,6 +67,13 @@ struct gdbarch_tdep
/* Alternative location for trap return. Used for single-stepping. */
CORE_ADDR (*step_trap) (struct frame_info *frame, unsigned long insn);
+
+ /* ISA-specific data types. */
+ struct type *sparc_psr_type;
+ struct type *sparc_fsr_type;
+ struct type *sparc64_pstate_type;
+ struct type *sparc64_fsr_type;
+ struct type *sparc64_fprs_type;
};
/* Register numbers of various important registers. */
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index d1b04d7..acfbace 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -121,61 +121,89 @@ sparc64_structure_or_union_p (const struct type *type)
}
-/* Type for %pstate. */
-struct type *sparc64_pstate_type;
+/* Construct types for ISA-specific registers. */
-/* Type for %fsr. */
-struct type *sparc64_fsr_type;
+static struct type *
+sparc64_pstate_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-/* Type for %fprs. */
-struct type *sparc64_fprs_type;
+ if (!tdep->sparc64_pstate_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_sparc64_pstate", 8);
+ append_flags_type_flag (type, 0, "AG");
+ append_flags_type_flag (type, 1, "IE");
+ append_flags_type_flag (type, 2, "PRIV");
+ append_flags_type_flag (type, 3, "AM");
+ append_flags_type_flag (type, 4, "PEF");
+ append_flags_type_flag (type, 5, "RED");
+ append_flags_type_flag (type, 8, "TLE");
+ append_flags_type_flag (type, 9, "CLE");
+ append_flags_type_flag (type, 10, "PID0");
+ append_flags_type_flag (type, 11, "PID1");
+
+ tdep->sparc64_pstate_type = type;
+ }
-/* Construct types for ISA-specific registers. */
+ return tdep->sparc64_pstate_type;
+}
-static void
-sparc64_init_types (void)
+static struct type *
+sparc64_fsr_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (!tdep->sparc64_fsr_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_sparc64_fsr", 8);
+ append_flags_type_flag (type, 0, "NXA");
+ append_flags_type_flag (type, 1, "DZA");
+ append_flags_type_flag (type, 2, "UFA");
+ append_flags_type_flag (type, 3, "OFA");
+ append_flags_type_flag (type, 4, "NVA");
+ append_flags_type_flag (type, 5, "NXC");
+ append_flags_type_flag (type, 6, "DZC");
+ append_flags_type_flag (type, 7, "UFC");
+ append_flags_type_flag (type, 8, "OFC");
+ append_flags_type_flag (type, 9, "NVC");
+ append_flags_type_flag (type, 22, "NS");
+ append_flags_type_flag (type, 23, "NXM");
+ append_flags_type_flag (type, 24, "DZM");
+ append_flags_type_flag (type, 25, "UFM");
+ append_flags_type_flag (type, 26, "OFM");
+ append_flags_type_flag (type, 27, "NVM");
+
+ tdep->sparc64_fsr_type = type;
+ }
+
+ return tdep->sparc64_fsr_type;
+}
+
+static struct type *
+sparc64_fprs_type (struct gdbarch *gdbarch)
{
- struct type *type;
-
- type = init_flags_type ("builtin_type_sparc64_pstate", 8);
- append_flags_type_flag (type, 0, "AG");
- append_flags_type_flag (type, 1, "IE");
- append_flags_type_flag (type, 2, "PRIV");
- append_flags_type_flag (type, 3, "AM");
- append_flags_type_flag (type, 4, "PEF");
- append_flags_type_flag (type, 5, "RED");
- append_flags_type_flag (type, 8, "TLE");
- append_flags_type_flag (type, 9, "CLE");
- append_flags_type_flag (type, 10, "PID0");
- append_flags_type_flag (type, 11, "PID1");
- sparc64_pstate_type = type;
-
- type = init_flags_type ("builtin_type_sparc64_fsr", 8);
- append_flags_type_flag (type, 0, "NXA");
- append_flags_type_flag (type, 1, "DZA");
- append_flags_type_flag (type, 2, "UFA");
- append_flags_type_flag (type, 3, "OFA");
- append_flags_type_flag (type, 4, "NVA");
- append_flags_type_flag (type, 5, "NXC");
- append_flags_type_flag (type, 6, "DZC");
- append_flags_type_flag (type, 7, "UFC");
- append_flags_type_flag (type, 8, "OFC");
- append_flags_type_flag (type, 9, "NVC");
- append_flags_type_flag (type, 22, "NS");
- append_flags_type_flag (type, 23, "NXM");
- append_flags_type_flag (type, 24, "DZM");
- append_flags_type_flag (type, 25, "UFM");
- append_flags_type_flag (type, 26, "OFM");
- append_flags_type_flag (type, 27, "NVM");
- sparc64_fsr_type = type;
-
- type = init_flags_type ("builtin_type_sparc64_fprs", 8);
- append_flags_type_flag (type, 0, "DL");
- append_flags_type_flag (type, 1, "DU");
- append_flags_type_flag (type, 2, "FEF");
- sparc64_fprs_type = type;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (!tdep->sparc64_fprs_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_sparc64_fprs", 8);
+ append_flags_type_flag (type, 0, "DL");
+ append_flags_type_flag (type, 1, "DU");
+ append_flags_type_flag (type, 2, "FEF");
+
+ tdep->sparc64_fprs_type = type;
+ }
+
+ return tdep->sparc64_fprs_type;
}
+
/* Register information. */
static const char *sparc64_register_names[] =
@@ -261,9 +289,9 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == SPARC64_STATE_REGNUM)
return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_FSR_REGNUM)
- return sparc64_fsr_type;
+ return sparc64_fsr_type (gdbarch);
if (regnum == SPARC64_FPRS_REGNUM)
- return sparc64_fprs_type;
+ return sparc64_fprs_type (gdbarch);
/* "Although Y is a 64-bit register, its high-order 32 bits are
reserved and always read as 0." */
if (regnum == SPARC64_Y_REGNUM)
@@ -274,7 +302,7 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == SPARC64_CWP_REGNUM)
return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_PSTATE_REGNUM)
- return sparc64_pstate_type;
+ return sparc64_pstate_type (gdbarch);
if (regnum == SPARC64_ASI_REGNUM)
return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_CCR_REGNUM)
@@ -1425,13 +1453,3 @@ sparc64_collect_fpregset (const struct regcache *regcache,
}
}
-
-/* Provide a prototype to silence -Wmissing-prototypes. */
-void _initialize_sparc64_tdep (void);
-
-void
-_initialize_sparc64_tdep (void)
-{
- /* Initialize the UltraSPARC-specific register types. */
- sparc64_init_types();
-}