summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-03-27 19:11:10 +0000
committerDaniel Jacobowitz <drow@false.org>2006-03-27 19:11:10 +0000
commitffa0f56b660b1e3e0c160257b2090a0ec1de3ceb (patch)
tree8ec40adf30e11e9c327060bb8fb22026554072f8
parent5e2c91a2f259140b8e45ea304a847968771024df (diff)
downloadbinutils-gdb-ffa0f56b660b1e3e0c160257b2090a0ec1de3ceb.tar.gz
Basic register group support.
-rw-r--r--gdb/Makefile.in1
-rw-r--r--gdb/arm-tdep.c1
-rw-r--r--gdb/available.c42
-rw-r--r--gdb/available.h6
-rw-r--r--gdb/features/feature_to_c.sh5
5 files changed, 55 insertions, 0 deletions
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 323e00c85f9..81761346715 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -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) \
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f8f4dd6ffbb..cf8bbff3e4a 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -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)
{
diff --git a/gdb/available.c b/gdb/available.c
index def0c02b4ed..4087e13466b 100644
--- a/gdb/available.c
+++ b/gdb/available.c
@@ -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);
+}
diff --git a/gdb/available.h b/gdb/available.h
index 7b35e40d8b2..d437c752e70 100644
--- a/gdb/available.h
+++ b/gdb/available.h
@@ -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 *);
diff --git a/gdb/features/feature_to_c.sh b/gdb/features/feature_to_c.sh
index 764297725ee..b9441a4a1b2 100644
--- a/gdb/features/feature_to_c.sh
+++ b/gdb/features/feature_to_c.sh
@@ -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'`