2003-07-03 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Thu, 3 Jul 2003 14:34:29 +0000 (14:34 +0000)
committerAndrew Cagney <cagney@redhat.com>
Thu, 3 Jul 2003 14:34:29 +0000 (14:34 +0000)
* 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.

gdb/ChangeLog
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/regcache.c

index 7a394368301037674de088c07909180810f9c2d9..a4b9537fe613acdcbd2e1c7aeb169fa4257af45a 100644 (file)
@@ -1,3 +1,11 @@
+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.
index 87585dd42c66625af50b1194b37fb548fbf1ae4c..966e373939ce053e531077f631df3658bd1c2359 100644 (file)
@@ -641,8 +641,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* 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 */
@@ -2147,6 +2147,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (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",
@@ -2191,6 +2200,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
     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",
@@ -3385,6 +3403,13 @@ set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch,
   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)
 {
@@ -3392,6 +3417,7 @@ 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);
@@ -3404,6 +3430,13 @@ set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch,
   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)
 {
@@ -3411,6 +3444,7 @@ 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);
index 4dd7cfa9d7fa255894dae05e1355b98d1c0f0d79..0242d5b8ad4f0858f296ccf707bf26e30a1d24d1 100644 (file)
@@ -709,6 +709,26 @@ extern void set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, gdbar
    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))
@@ -729,6 +749,26 @@ extern void set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, g
    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))
index 494b916ffe4ce5901ef42a2742e6ef19670fba08..982b8a562494537ead58f9ef8c9224ef26e21d50 100755 (executable)
@@ -486,12 +486,12 @@ F::REGISTER_BYTE:int:deprecated_register_byte:int reg_nr:reg_nr::generic_registe
 # 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
index 509390f91725870bc0a48cccd48d8316b36b4399..ce1d8118b4c6c15fc43df0885177c440306a6f74 100644 (file)
@@ -178,16 +178,17 @@ init_regcache_descr (struct gdbarch *gdbarch)
 
   /* 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;