From ce3b14b7917ffa57ae889030f6916b0427c9355c Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 13 Jun 2007 18:27:00 +0000 Subject: * Makefile.in (mips-tdep.o): Update. * mips-tdep.c (struct register_alias, mips_o32_aliases) (mips_n32_n64_aliases, mips_register_aliases): New. (mips_register_name): Call tdesc_register_name. (mips_tdesc_register_reggroup_p): New. (mips_pseudo_register_type, value_of_mips_user_reg): New. (mips_gdbarch_init): Add target-described register support. Register aliases for register names. * target-descriptions.c (tdesc_register_name): Make global. (tdesc_register_in_reggroup_p): New function, broken out from tdesc_register_reggroup_p. (tdesc_register_reggroup_p): Use it. * target-descriptions.h (tdesc_register_name) (tdesc_register_in_reggroup_p): New prototypes. * NEWS: Correct formatting. Mention MIPS register support. * features/mips-cp0.xml, features/mips-fpu.xml, features/mips64-cp0.xml, gdb/features/mips64-fpu.xml, mips-cpu.xml, features/mips64-cpu.xml: New files. * gdb.xml/tdesc-regs.exp: Add MIPS support. Allow multiple required features to be included. * gdb.texinfo (MIPS Features): New subsection. --- gdb/target-descriptions.c | 51 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 15 deletions(-) (limited to 'gdb/target-descriptions.c') diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index e8b7cbc81a3..6df4547e8bf 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -486,7 +486,10 @@ tdesc_find_register (struct gdbarch *gdbarch, int regno) return NULL; } -static const char * +/* Return the name of register REGNO, from the target description or + from an architecture-provided pseudo_register_name method. */ + +const char * tdesc_register_name (int regno) { struct tdesc_reg *reg = tdesc_find_register (current_gdbarch, regno); @@ -582,8 +585,9 @@ tdesc_remote_register_number (struct gdbarch *gdbarch, int regno) /* Check whether REGNUM is a member of REGGROUP. Registers from the target description may be classified as general, float, or vector. - Registers with no group specified go to the default reggroup - function and are handled by type. + Unlike a gdbarch register_reggroup_p method, this function will + return -1 if it does not know; the caller should handle registers + with no specified group. Arbitrary strings (other than "general", "float", and "vector") from the description are not used; they cause the register to be @@ -594,21 +598,12 @@ tdesc_remote_register_number (struct gdbarch *gdbarch, int regno) The save-restore flag is also implemented here. */ -static int -tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regno, - struct reggroup *reggroup) +int +tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno, + struct reggroup *reggroup) { - int num_regs = gdbarch_num_regs (gdbarch); - int num_pseudo_regs = gdbarch_num_pseudo_regs (gdbarch); struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno); - if (reg == NULL && regno >= num_regs && regno < num_regs + num_pseudo_regs) - { - struct tdesc_arch_data *data = gdbarch_data (gdbarch, tdesc_data); - gdb_assert (data->pseudo_register_reggroup_p != NULL); - return data->pseudo_register_reggroup_p (gdbarch, regno, reggroup); - } - if (reg != NULL && reg->group != NULL) { int general_p = 0, float_p = 0, vector_p = 0; @@ -634,6 +629,32 @@ tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regno, && (reggroup == save_reggroup || reggroup == restore_reggroup)) return reg->save_restore; + return -1; +} + +/* Check whether REGNUM is a member of REGGROUP. Registers with no + group specified go to the default reggroup function and are handled + by type. */ + +static int +tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regno, + struct reggroup *reggroup) +{ + int num_regs = gdbarch_num_regs (gdbarch); + int num_pseudo_regs = gdbarch_num_pseudo_regs (gdbarch); + int ret; + + if (regno >= num_regs && regno < num_regs + num_pseudo_regs) + { + struct tdesc_arch_data *data = gdbarch_data (gdbarch, tdesc_data); + gdb_assert (data->pseudo_register_reggroup_p != NULL); + return data->pseudo_register_reggroup_p (gdbarch, regno, reggroup); + } + + ret = tdesc_register_in_reggroup_p (gdbarch, regno, reggroup); + if (ret != -1) + return ret; + return default_register_reggroup_p (gdbarch, regno, reggroup); } -- cgit v1.2.1