+2003-07-03 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (REGISTER_RAW_SIZE, REGISTER_VIRTUAL_SIZE): Add
+ predicate.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * regcache.c (init_regcache_descr): Use legacy code when either
+ REGISTER_BYTE or REGISTER_RAW_SIZE is set.
+
2003-07-02 Daniel Jacobowitz <drow@mvista.com>
* NEWS: Move "set logging" entry into GDB 6.0 section.
/* Skip verify of register_type, has predicate */
/* Skip verify of deprecated_register_virtual_type, has predicate */
/* Skip verify of deprecated_register_byte, has predicate */
- /* Skip verify of deprecated_register_raw_size, invalid_p == 0 */
- /* Skip verify of deprecated_register_virtual_size, invalid_p == 0 */
+ /* Skip verify of deprecated_register_raw_size, has predicate */
+ /* Skip verify of deprecated_register_virtual_size, has predicate */
/* Skip verify of deprecated_max_register_raw_size, has predicate */
/* Skip verify of deprecated_max_register_virtual_size, has predicate */
/* Skip verify of unwind_dummy_id, has predicate */
(long) current_gdbarch->register_name
/*REGISTER_NAME ()*/);
#endif
+#ifdef REGISTER_RAW_SIZE_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "REGISTER_RAW_SIZE_P()",
+ XSTRING (REGISTER_RAW_SIZE_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: REGISTER_RAW_SIZE_P() = %d\n",
+ REGISTER_RAW_SIZE_P ());
+#endif
#ifdef REGISTER_RAW_SIZE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
fprintf_unfiltered (file,
"gdbarch_dump: register_type = 0x%08lx\n",
(long) current_gdbarch->register_type);
+#ifdef REGISTER_VIRTUAL_SIZE_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "REGISTER_VIRTUAL_SIZE_P()",
+ XSTRING (REGISTER_VIRTUAL_SIZE_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: REGISTER_VIRTUAL_SIZE_P() = %d\n",
+ REGISTER_VIRTUAL_SIZE_P ());
+#endif
#ifdef REGISTER_VIRTUAL_SIZE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
gdbarch->deprecated_register_byte = deprecated_register_byte;
}
+int
+gdbarch_deprecated_register_raw_size_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_register_raw_size != generic_register_size;
+}
+
int
gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, int reg_nr)
{
if (gdbarch->deprecated_register_raw_size == 0)
internal_error (__FILE__, __LINE__,
"gdbarch: gdbarch_deprecated_register_raw_size invalid");
+ /* Ignore predicate (gdbarch->deprecated_register_raw_size != generic_register_size). */
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_raw_size called\n");
return gdbarch->deprecated_register_raw_size (reg_nr);
gdbarch->deprecated_register_raw_size = deprecated_register_raw_size;
}
+int
+gdbarch_deprecated_register_virtual_size_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_register_virtual_size != generic_register_size;
+}
+
int
gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, int reg_nr)
{
if (gdbarch->deprecated_register_virtual_size == 0)
internal_error (__FILE__, __LINE__,
"gdbarch: gdbarch_deprecated_register_virtual_size invalid");
+ /* Ignore predicate (gdbarch->deprecated_register_virtual_size != generic_register_size). */
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_virtual_size called\n");
return gdbarch->deprecated_register_virtual_size (reg_nr);
DEPRECATED_REGISTER_RAW_SIZE can be deleted. See: maint print
registers. */
+#if defined (REGISTER_RAW_SIZE)
+/* Legacy for systems yet to multi-arch REGISTER_RAW_SIZE */
+#if !defined (REGISTER_RAW_SIZE_P)
+#define REGISTER_RAW_SIZE_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE_P)
+#define REGISTER_RAW_SIZE_P() (0)
+#endif
+
+extern int gdbarch_deprecated_register_raw_size_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_RAW_SIZE_P)
+#error "Non multi-arch definition of REGISTER_RAW_SIZE"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_RAW_SIZE_P)
+#define REGISTER_RAW_SIZE_P() (gdbarch_deprecated_register_raw_size_p (current_gdbarch))
+#endif
+
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE)
#define REGISTER_RAW_SIZE(reg_nr) (generic_register_size (reg_nr))
DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. See: maint print
registers. */
+#if defined (REGISTER_VIRTUAL_SIZE)
+/* Legacy for systems yet to multi-arch REGISTER_VIRTUAL_SIZE */
+#if !defined (REGISTER_VIRTUAL_SIZE_P)
+#define REGISTER_VIRTUAL_SIZE_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE_P)
+#define REGISTER_VIRTUAL_SIZE_P() (0)
+#endif
+
+extern int gdbarch_deprecated_register_virtual_size_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_SIZE_P)
+#error "Non multi-arch definition of REGISTER_VIRTUAL_SIZE"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_VIRTUAL_SIZE_P)
+#define REGISTER_VIRTUAL_SIZE_P() (gdbarch_deprecated_register_virtual_size_p (current_gdbarch))
+#endif
+
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE)
#define REGISTER_VIRTUAL_SIZE(reg_nr) (generic_register_size (reg_nr))
# sizes agree with the value computed from REGISTER_TYPE,
# DEPRECATED_REGISTER_RAW_SIZE can be deleted. See: maint print
# registers.
-f:2:REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
+F:2:REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size
# If all registers have identical raw and virtual sizes and those
# sizes agree with the value computed from REGISTER_TYPE,
# DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. See: maint print
# registers.
-f:2:REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
+F:2:REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size
# DEPRECATED_MAX_REGISTER_RAW_SIZE can be deleted. It has been
# replaced by the constant MAX_REGISTER_SIZE.
V:2:DEPRECATED_MAX_REGISTER_RAW_SIZE:int:deprecated_max_register_raw_size
/* If an old style architecture, fill in the remainder of the
register cache descriptor using the register macros. */
- if (!gdbarch_pseudo_register_read_p (gdbarch)
- && !gdbarch_pseudo_register_write_p (gdbarch)
- && !gdbarch_register_type_p (gdbarch))
+ /* NOTE: cagney/2003-06-29: If either of REGISTER_BYTE or
+ REGISTER_RAW_SIZE are still present, things are most likely
+ totally screwed. Ex: an architecture with raw register sizes
+ smaller than what REGISTER_BYTE indicates; non monotonic
+ REGISTER_BYTE values. For GDB 6 check for these nasty methods
+ and fall back to legacy code when present. Sigh! */
+ if ((!gdbarch_pseudo_register_read_p (gdbarch)
+ && !gdbarch_pseudo_register_write_p (gdbarch)
+ && !gdbarch_register_type_p (gdbarch))
+ || REGISTER_BYTE_P () || REGISTER_RAW_SIZE_P ())
{
- /* NOTE: cagney/2003-05-02: Don't add a test for REGISTER_BYTE_P
- to the above. Doing that would cause all the existing
- architectures to revert back to the legacy regcache
- mechanisms, and that is not a good thing. Instead just,
- later, check that the register cache's layout is consistent
- with REGISTER_BYTE. */
descr->legacy_p = 1;
init_legacy_regcache_descr (gdbarch, descr);
return descr;