* 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.
This commit is contained in:
Ulrich Weigand 2009-07-02 12:52:52 +00:00
parent 270677457f
commit 209bd28e8b
9 changed files with 267 additions and 177 deletions

View File

@ -1,3 +1,37 @@
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,

View File

@ -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"));
}

View File

@ -1994,54 +1994,70 @@ i386_return_value (struct gdbarch *gdbarch, struct type *func_type,
}
/* Type for %eflags. */
struct type *i386_eflags_type;
/* Type for %mxcsr. */
struct type *i386_mxcsr_type;
/* Construct types for ISA-specific registers. */
static void
i386_init_types (void)
struct type *
i386_eflags_type (struct gdbarch *gdbarch)
{
struct type *type;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
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;
if (!tdep->i386_eflags_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");
i386_mxcsr_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;
}
return tdep->i386_eflags_type;
}
struct type *
i386_mxcsr_type (struct gdbarch *gdbarch)
{
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();
}

View File

@ -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);

View File

@ -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;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
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;
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 ();
}

View File

@ -94,6 +94,7 @@ struct gdbarch_tdep
int fpregs_present;
/* ISA-specific data types. */
struct type *m68k_ps_type;
struct type *m68881_ext_type;
};

View File

@ -283,46 +283,61 @@ sparc32_register_name (struct gdbarch *gdbarch, int regnum)
return NULL;
}
/* Type for %psr. */
struct type *sparc_psr_type;
/* Type for %fsr. */
struct type *sparc_fsr_type;
/* Construct types for ISA-specific registers. */
static void
sparc_init_types (void)
static struct type *
sparc_psr_type (struct gdbarch *gdbarch)
{
struct type *type;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
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;
if (!tdep->sparc_psr_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");
sparc_fsr_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");
tdep->sparc_psr_type = type;
}
return tdep->sparc_psr_type;
}
static struct type *
sparc_fsr_type (struct gdbarch *gdbarch)
{
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();
}

View File

@ -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. */

View File

@ -121,61 +121,89 @@ sparc64_structure_or_union_p (const struct type *type)
}
/* Type for %pstate. */
struct type *sparc64_pstate_type;
/* Type for %fsr. */
struct type *sparc64_fsr_type;
/* Type for %fprs. */
struct type *sparc64_fprs_type;
/* Construct types for ISA-specific registers. */
static void
sparc64_init_types (void)
static struct type *
sparc64_pstate_type (struct gdbarch *gdbarch)
{
struct type *type;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
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;
if (!tdep->sparc64_pstate_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");
sparc64_fsr_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");
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;
tdep->sparc64_pstate_type = type;
}
return tdep->sparc64_pstate_type;
}
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 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();
}