aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-03-01 17:59:12 +0000
committerAndrew Cagney <cagney@redhat.com>2003-03-01 17:59:12 +0000
commit35cac7cfea5ce05bfb0516b9ca11e3cf6561c1d4 (patch)
treefd02efded8c8c4461b78a7a556fc594e0bc60194 /gdb/gdbarch.c
parent7b83296f2249f4252acecdc5af64595d66daadbd (diff)
downloadgdb-35cac7cfea5ce05bfb0516b9ca11e3cf6561c1d4.zip
gdb-35cac7cfea5ce05bfb0516b9ca11e3cf6561c1d4.tar.gz
gdb-35cac7cfea5ce05bfb0516b9ca11e3cf6561c1d4.tar.bz2
2003-03-01 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (register_type): New function with predicate. (REGISTER_VIRTUAL_TYPE): Change to function with predicate. * gdbarch.h, gdbarch.c: Re-generate. * arch-utils.c (generic_register_byte): Use generic_register_size. (generic_register_size): When available, use gdbarch_register_type. * regcache.c (init_regcache_descr): When available, initialize the register type array using gdbarch_register_type. If the architecture supplies gdbarch_register_type, do not use the legacy regcache layout. * d10v-tdep.c (d10v_register_type): Replace d10v_register_virtual_type. (d10v_gdbarch_init): Set register_type instead of register_virtual_type.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c57
1 files changed, 54 insertions, 3 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index c8e296c..bf16854 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -174,6 +174,7 @@ struct gdbarch
gdbarch_register_virtual_size_ftype *register_virtual_size;
int max_register_virtual_size;
gdbarch_register_virtual_type_ftype *register_virtual_type;
+ gdbarch_register_type_ftype *register_type;
gdbarch_deprecated_do_registers_info_ftype *deprecated_do_registers_info;
gdbarch_print_registers_info_ftype *print_registers_info;
gdbarch_print_float_info_ftype *print_float_info;
@@ -339,6 +340,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
default_print_registers_info,
0,
0,
@@ -666,9 +668,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->max_register_virtual_size == -1))
fprintf_unfiltered (log, "\n\tmax_register_virtual_size");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->register_virtual_type == 0))
- fprintf_unfiltered (log, "\n\tregister_virtual_type");
+ /* Skip verify of register_virtual_type, has predicate */
+ /* Skip verify of register_type, has predicate */
/* Skip verify of deprecated_do_registers_info, has predicate */
/* Skip verify of print_registers_info, invalid_p == 0 */
/* Skip verify of print_float_info, has predicate */
@@ -2031,6 +2032,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->register_to_value
/*REGISTER_TO_VALUE ()*/);
#endif
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_register_type_p() = %d\n",
+ gdbarch_register_type_p (current_gdbarch));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: register_type = 0x%08lx\n",
+ (long) current_gdbarch->register_type);
#ifdef REGISTER_VIRTUAL_SIZE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -2042,6 +2051,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->register_virtual_size
/*REGISTER_VIRTUAL_SIZE ()*/);
#endif
+#ifdef REGISTER_VIRTUAL_TYPE_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "REGISTER_VIRTUAL_TYPE_P()",
+ XSTRING (REGISTER_VIRTUAL_TYPE_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: REGISTER_VIRTUAL_TYPE_P() = %d\n",
+ REGISTER_VIRTUAL_TYPE_P ());
+#endif
#ifdef REGISTER_VIRTUAL_TYPE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -3344,6 +3362,13 @@ set_gdbarch_max_register_virtual_size (struct gdbarch *gdbarch,
gdbarch->max_register_virtual_size = max_register_virtual_size;
}
+int
+gdbarch_register_virtual_type_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->register_virtual_type != 0;
+}
+
struct type *
gdbarch_register_virtual_type (struct gdbarch *gdbarch, int reg_nr)
{
@@ -3364,6 +3389,32 @@ set_gdbarch_register_virtual_type (struct gdbarch *gdbarch,
}
int
+gdbarch_register_type_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->register_type != 0;
+}
+
+struct type *
+gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->register_type == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_register_type invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_register_type called\n");
+ return gdbarch->register_type (gdbarch, reg_nr);
+}
+
+void
+set_gdbarch_register_type (struct gdbarch *gdbarch,
+ gdbarch_register_type_ftype register_type)
+{
+ gdbarch->register_type = register_type;
+}
+
+int
gdbarch_deprecated_do_registers_info_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);