aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2006-01-23 17:35:22 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2006-01-23 17:35:22 +0000
commitdda63807650967916bae1a29ebf4f9062a089fc7 (patch)
tree16c3bd4bd2775ab86b9170b71851f949fdfd6bc8
parent4b505b12693cdcd0b4e88aa8beedca359b8827a7 (diff)
downloadgdb-dda63807650967916bae1a29ebf4f9062a089fc7.zip
gdb-dda63807650967916bae1a29ebf4f9062a089fc7.tar.gz
gdb-dda63807650967916bae1a29ebf4f9062a089fc7.tar.bz2
2006-01-23 Andrew Stubbs <andrew.stubbs@st.com>
* sh-tdep.c: Include reggroups.h. (sh_register_reggroup_p): New function. (sh_gdbarch_init): Add call to set_gdbarch_register_reggroup_p. * Makefile.in (sh-tdep.o): Add dependency on reggroups.h.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/sh-tdep.c43
3 files changed, 51 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5f3106a..609b95e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2006-01-23 Andrew Stubbs <andrew.stubbs@st.com>
+ * sh-tdep.c: Include reggroups.h.
+ (sh_register_reggroup_p): New function.
+ (sh_gdbarch_init): Add call to set_gdbarch_register_reggroup_p.
+ * Makefile.in (sh-tdep.o): Add dependency on reggroups.h.
+
+2006-01-23 Andrew Stubbs <andrew.stubbs@st.com>
+
* cli/cli-cmds.c: Include fcntl.h.
(source_command): Use the GDB search path to find script files.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 0afa9b4..3065685 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2538,7 +2538,7 @@ sh-tdep.o: sh-tdep.c $(defs_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \
$(value_h) $(dis_asm_h) $(inferior_h) $(gdb_string_h) \
$(gdb_assert_h) $(arch_utils_h) $(floatformat_h) $(regcache_h) \
$(doublest_h) $(osabi_h) $(sh_tdep_h) $(elf_bfd_h) $(solib_svr4_h) \
- $(elf_sh_h) $(gdb_sim_sh_h)
+ $(elf_sh_h) $(gdb_sim_sh_h) $(reggroups_h)
sol2-tdep.o: sol2-tdep.c $(defs_h) $(frame_h) $(symtab_h)
solib-aix5.o: solib-aix5.c $(defs_h) $(gdb_string_h) $(elf_external_h) \
$(symtab_h) $(bfd_h) $(symfile_h) $(objfiles_h) $(gdbcore_h) \
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 13cae3a..4bce64a 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -44,6 +44,7 @@
#include "regcache.h"
#include "doublest.h"
#include "osabi.h"
+#include "reggroups.h"
#include "sh-tdep.h"
@@ -1812,6 +1813,47 @@ sh_default_register_type (struct gdbarch *gdbarch, int reg_nr)
return builtin_type_int;
}
+/* Is a register in a reggroup?
+ The default code in reggroup.c doesn't identify system registers, some
+ float registers or any of the vector registers.
+ TODO: sh2a and dsp registers. */
+int
+sh_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+ struct reggroup *reggroup)
+{
+ if (REGISTER_NAME (regnum) == NULL
+ || *REGISTER_NAME (regnum) == '\0')
+ return 0;
+
+ if (reggroup == float_reggroup
+ && (regnum == FPUL_REGNUM
+ || regnum == FPSCR_REGNUM))
+ return 1;
+
+ if (regnum >= FV0_REGNUM && regnum <= FV_LAST_REGNUM)
+ {
+ if (reggroup == vector_reggroup || reggroup == float_reggroup)
+ return 1;
+ if (reggroup == general_reggroup)
+ return 0;
+ }
+
+ if (regnum == VBR_REGNUM
+ || regnum == SR_REGNUM
+ || regnum == FPSCR_REGNUM
+ || regnum == SSR_REGNUM
+ || regnum == SPC_REGNUM)
+ {
+ if (reggroup == system_reggroup)
+ return 1;
+ if (reggroup == general_reggroup)
+ return 0;
+ }
+
+ /* The default code can cope with any other registers. */
+ return default_register_reggroup_p (gdbarch, regnum, reggroup);
+}
+
/* On the sh4, the DRi pseudo registers are problematic if the target
is little endian. When the user writes one of those registers, for
instance with 'ser var $dr0=1', we want the double to be stored
@@ -2371,6 +2413,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_num_pseudo_regs (gdbarch, 0);
set_gdbarch_register_type (gdbarch, sh_default_register_type);
+ set_gdbarch_register_reggroup_p (gdbarch, sh_register_reggroup_p);
set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);