diff options
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/frame.c | 6 | ||||
-rw-r--r-- | gdb/gdbarch.c | 20 | ||||
-rw-r--r-- | gdb/gdbarch.h | 25 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 2 | ||||
-rw-r--r-- | gdb/stack.c | 3 |
6 files changed, 62 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0fd32b8..21b2e86 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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". diff --git a/gdb/frame.c b/gdb/frame.c index acc163e..503cfa7 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 9519bb3..069e566 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 bc5d9ca..336f6ca 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 12131d8..9efadfe 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 6ce7366..a3a55c2 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. */ |