From: Andrew Cagney Date: Mon, 13 Jan 2003 21:10:30 +0000 (+0000) Subject: 2003-01-13 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f87102502242e23f901af040c8eb904de162f87;p=binutils-gdb.git 2003-01-13 Andrew Cagney * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0fd32b89f73..21b2e864fb1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2003-01-13 Andrew Cagney + + * 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 * source.c (openp): Squelch warning about "filename". diff --git a/gdb/frame.c b/gdb/frame.c index acc163e452c..503cfa7b359 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -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; diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 9519bb3cf62..069e56666e1 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -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) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index bc5d9ca4cbb..336f6ca5abe 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -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); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 12131d88ac5..9efadfe2495 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -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 diff --git a/gdb/stack.c b/gdb/stack.c index 6ce7366e5bb..a3a55c2f161 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -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. */