+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".
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);
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;
/* 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))
(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 */
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)
{
#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);
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
}
}
- 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. */