2003-01-13 Andrew Cagney <ac131313@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Mon, 13 Jan 2003 21:10:30 +0000 (21:10 +0000)
committerAndrew Cagney <cagney@redhat.com>
Mon, 13 Jan 2003 21:10:30 +0000 (21:10 +0000)
* gdbarch.sh (FRAME_INIT_SAVED_REGS): Change to function with
predicate.
* gdbarch.h, gdbarch.c: Regenerate.
* stack.c (frame_info): Only initialize the saved registers when
FRAME_INIT_SAVED_REGS_P.
* frame.c (frame_saved_regs_register_unwind): Assert
FRAME_INIT_SAVED_REGS_P.
(deprecated_generic_get_saved_register): Ditto.

gdb/ChangeLog
gdb/frame.c
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/stack.c

index 0fd32b89f73852c7a95b500d3ada9ae1b843e449..21b2e864fb13d77d0b0f3513c5b020cc0877ce23 100644 (file)
@@ -1,3 +1,14 @@
+2003-01-13  Andrew Cagney  <ac131313@redhat.com>
+
+       * gdbarch.sh (FRAME_INIT_SAVED_REGS): Change to function with
+       predicate.
+       * gdbarch.h, gdbarch.c: Regenerate.
+       * stack.c (frame_info): Only initialize the saved registers when
+       FRAME_INIT_SAVED_REGS_P.
+       * frame.c (frame_saved_regs_register_unwind): Assert
+       FRAME_INIT_SAVED_REGS_P.
+       (deprecated_generic_get_saved_register): Ditto.
+
 2003-01-13  Daniel Jacobowitz  <drow@mvista.com>
 
        * source.c (openp): Squelch warning about "filename".
index acc163e452c00dfc59f855a42bc0034f932a69cf..503cfa7b359a43d75ddfc0836ddc276524a592ba 100644 (file)
@@ -570,6 +570,10 @@ frame_saved_regs_register_unwind (struct frame_info *frame, void **cache,
   gdb_assert (!(DEPRECATED_USE_GENERIC_DUMMY_FRAMES
                && (get_frame_type (frame) == DUMMY_FRAME)));
 
+  /* Only (older) architectures that implement the
+     FRAME_INIT_SAVED_REGS method should be using this function.  */
+  gdb_assert (FRAME_INIT_SAVED_REGS_P ());
+
   /* Load the saved_regs register cache.  */
   if (frame->saved_regs == NULL)
     FRAME_INIT_SAVED_REGS (frame);
@@ -738,6 +742,8 @@ deprecated_generic_get_saved_register (char *raw_buffer, int *optimized,
   if (!target_has_registers)
     error ("No registers.");
 
+  gdb_assert (FRAME_INIT_SAVED_REGS_P ());
+
   /* Normal systems don't optimize out things with register numbers.  */
   if (optimized != NULL)
     *optimized = 0;
index 9519bb3cf62950a1e0a54c7df2a7d110d859beea..069e56666e1f85f28c2194797865f46baf57c24d 100644 (file)
@@ -739,9 +739,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of extract_struct_value_address, has predicate */
   /* Skip verify of deprecated_extract_struct_value_address, has predicate */
   /* Skip verify of use_struct_convention, invalid_p == 0 */
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->frame_init_saved_regs == 0))
-    fprintf_unfiltered (log, "\n\tframe_init_saved_regs");
+  /* Skip verify of frame_init_saved_regs, has predicate */
   /* Skip verify of init_extra_frame_info, has predicate */
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->skip_prologue == 0))
@@ -1464,6 +1462,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->frame_chain_valid
                         /*FRAME_CHAIN_VALID ()*/);
 #endif
+#ifdef FRAME_INIT_SAVED_REGS_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FRAME_INIT_SAVED_REGS_P()",
+                      XSTRING (FRAME_INIT_SAVED_REGS_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: FRAME_INIT_SAVED_REGS_P() = %d\n",
+                      FRAME_INIT_SAVED_REGS_P ());
+#endif
 #ifdef FRAME_INIT_SAVED_REGS
 #if GDB_MULTI_ARCH
   /* Macro might contain `[{}]' when not multi-arch */
@@ -4356,6 +4363,13 @@ set_gdbarch_use_struct_convention (struct gdbarch *gdbarch,
   gdbarch->use_struct_convention = use_struct_convention;
 }
 
+int
+gdbarch_frame_init_saved_regs_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->frame_init_saved_regs != 0;
+}
+
 void
 gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame)
 {
index bc5d9ca4cbb9d7c9f0068b4bb8f8ceb68e2c8c4a..336f6ca5abe2cd18bb1a9f5ae48527fcedb2ccab 100644 (file)
@@ -1750,6 +1750,31 @@ extern void set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, gdbarch_
 #endif
 #endif
 
+#if defined (FRAME_INIT_SAVED_REGS)
+/* Legacy for systems yet to multi-arch FRAME_INIT_SAVED_REGS */
+#if !defined (FRAME_INIT_SAVED_REGS_P)
+#define FRAME_INIT_SAVED_REGS_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (FRAME_INIT_SAVED_REGS_P)
+#define FRAME_INIT_SAVED_REGS_P() (0)
+#endif
+
+extern int gdbarch_frame_init_saved_regs_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_INIT_SAVED_REGS_P)
+#error "Non multi-arch definition of FRAME_INIT_SAVED_REGS"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_INIT_SAVED_REGS_P)
+#define FRAME_INIT_SAVED_REGS_P() (gdbarch_frame_init_saved_regs_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (FRAME_INIT_SAVED_REGS)
+#define FRAME_INIT_SAVED_REGS(frame) (internal_error (__FILE__, __LINE__, "FRAME_INIT_SAVED_REGS"), 0)
+#endif
+
 typedef void (gdbarch_frame_init_saved_regs_ftype) (struct frame_info *frame);
 extern void gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame);
 extern void set_gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs);
index 12131d88ac5cd91d9051ca5a392f99e05542d255..9efadfe2495cc0970d8d747b35623d92a03ae194 100755 (executable)
@@ -551,7 +551,7 @@ F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct r
 F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:char *regbuf:regbuf:::0
 f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0
 #
-f:2:FRAME_INIT_SAVED_REGS:void:frame_init_saved_regs:struct frame_info *frame:frame::0:0
+F:2:FRAME_INIT_SAVED_REGS:void:frame_init_saved_regs:struct frame_info *frame:frame:::0
 F:2:INIT_EXTRA_FRAME_INFO:void:init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame:::0
 #
 f:2:SKIP_PROLOGUE:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip::0:0
index 6ce7366e5bbc2861b2ec278434da8e0578851f09..a3a55c2f1613efe6649f57b7278bf2b5151d1817 100644 (file)
@@ -900,7 +900,8 @@ frame_info (char *addr_exp, int from_tty)
       }
   }
 
-  if (get_frame_saved_regs (fi) == NULL)
+  if (FRAME_INIT_SAVED_REGS_P ()
+      && get_frame_saved_regs (fi) == NULL)
     FRAME_INIT_SAVED_REGS (fi);
   /* Print as much information as possible on the location of all the
      registers.  */