]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Basic register group support.
authorDaniel Jacobowitz <drow@false.org>
Mon, 27 Mar 2006 19:11:10 +0000 (19:11 +0000)
committerDaniel Jacobowitz <drow@false.org>
Mon, 27 Mar 2006 19:11:10 +0000 (19:11 +0000)
gdb/Makefile.in
gdb/arm-tdep.c
gdb/available.c
gdb/available.h
gdb/features/feature_to_c.sh

index 323e00c85f9674210fd2ba48c85209f094734bff..8176134671510937ac5b1174e0a96d4041b789fd 100644 (file)
@@ -1812,6 +1812,7 @@ auxv.o: auxv.c $(defs_h) $(target_h) $(gdbtypes_h) $(command_h) \
        $(elf_common_h)
 available.o: available.c $(defs_h) $(symfile_h) $(target_h) $(available_h) \
        $(arch_utils_h) $(exceptions_h) $(gdbtypes_h) $(sha1_h) \
+       $(reggroups_h) \
        $(gdb_string) $(gdb_assert) $(gdb_obstack_h) $(gdb_stdint_h)
 avr-tdep.o: avr-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \
        $(frame_base_h) $(trad_frame_h) $(gdbcmd_h) $(gdbcore_h) \
index f8f4dd6ffbbac5a959f8770bb0820de3ab46471e..cf8bbff3e4aa3cb6eb114c95449d212cd9c6c89e 100644 (file)
@@ -2825,6 +2825,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pc_regnum (gdbarch, ARM_PC_REGNUM);
   set_gdbarch_num_regs (gdbarch, NUM_GREGS + NUM_FREGS + NUM_SREGS);
   set_gdbarch_register_type (gdbarch, arm_register_type);
+  set_gdbarch_register_reggroup_p (gdbarch, available_register_reggroup_p);
 
   if (info.feature_set)
     {
index def0c02b4ed02bc7accb2a2216ffb6d1e2f0af7f..4087e13466b176f8aaa43973245053b7dea08e32 100644 (file)
@@ -26,6 +26,7 @@
 #include "arch-utils.h"
 #include "exceptions.h"
 #include "gdbtypes.h"
+#include "reggroups.h"
 #include "symfile.h"
 #include "target.h"
 #include "sha1.h"
@@ -677,3 +678,44 @@ available_register_target_regnum (struct gdbarch *gdbarch, int regnum)
 
   return reg->protocol_number;
 }
+
+/* Check whether REGNUM is a member of REGGROUP.  */
+
+/* TODO: This function only supports "info registers", "info float",
+   and "info vector".  Registers with group="general" go in general;
+   group="float" and group="vector" are similar.  Other specified
+   values of group go into all-registers only.  Registers with no
+   group specified go to the default function and are handled by
+   type.  When we have a hierarchy of features, it may make more
+   sense to use that to show registers.  */
+
+int
+available_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+                              struct reggroup *reggroup)
+{
+  struct gdb_available_register *reg;
+
+  reg = find_register (gdbarch_feature_set (gdbarch), regnum);
+  if (reg != NULL && reg->group != NULL)
+    {
+      int general_p, float_p, vector_p;
+
+      if (strcmp (reg->group, "general") == 0)
+       general_p = 1;
+      else if (strcmp (reg->group, "float") == 0)
+       float_p = 1;
+      else if (strcmp (reg->group, "vector") == 0)
+       vector_p = 1;
+
+      if (reggroup == float_reggroup)
+       return float_p;
+
+      if (reggroup == vector_reggroup)
+       return vector_p;
+
+      if (reggroup == general_reggroup)
+       return general_p;
+    }
+
+  return default_register_reggroup_p (gdbarch, regnum, reggroup);
+}
index 7b35e40d8b268c48a8727cde126f577d95dd2195..d437c752e70bd67d8ded61756c00804ca8fa01a4 100644 (file)
@@ -26,6 +26,7 @@
 #define AVAILABLE_H 1
 
 struct obstack;
+struct reggroup;
 
 /* A GDB target interface can use these types to communicate to the
    architecture support (gdbarch) what new or optional features
@@ -174,6 +175,11 @@ const char *available_register_name (struct gdbarch *, int);
 
 int available_register_target_regnum (struct gdbarch *, int);
 
+/* Check the register group of a target-described register.  */
+
+int available_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+                                  struct reggroup *reggroup);
+
 /* Find a compiled-in XML file, e.g. the standard DTD.  */
 
 const char *fetch_xml_builtin (const char *);
index 764297725ee5f04003a428159071db91762d5ed9..b9441a4a1b2c4a97a2c3eb28edd25bbd4a26c8f6 100644 (file)
@@ -8,6 +8,11 @@ if test -z "$output" || test -z "$1"; then
   exit 1
 fi
 
+if test -e "$output"; then
+  echo "Output file \"$output\" already exists; refusing to overwrite."
+  exit 1
+fi
+
 for input in dummy "$@"; do
   if test $input != dummy; then
     arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`