From 2ca6c561875beb2a062b218f81ebf30e2dd7ec9c Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 6 Dec 2002 19:26:06 +0000 Subject: [PATCH] 2002-12-06 Andrew Cagney * gdbarch.sh (DEPRECATED_INIT_FRAME_PC_FIRST): Rename INIT_FRAME_PC_FIRST. Change to a function with predicate. Do not provide a default value. * gdbarch.h, gdbarch.c: Regenerate. * frame.c (get_prev_frame): Update. Check DEPRECATED_INIT_FRAME_PC_FIRST_P. * s390-tdep.c (s390_gdbarch_init): Update. * mips-tdep.c (mips_gdbarch_init): Update. * config/sparc/tm-sparc.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update. * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update. * alpha-tdep.c (alpha_gdbarch_init): Update. --- gdb/ChangeLog | 14 ++++++++ gdb/alpha-tdep.c | 3 +- gdb/config/rs6000/tm-rs6000.h | 2 +- gdb/config/sparc/tm-sparc.h | 2 +- gdb/frame.c | 8 +++-- gdb/gdbarch.c | 65 +++++++++++++++++++++-------------- gdb/gdbarch.h | 38 +++++++++++++++----- gdb/gdbarch.sh | 2 +- gdb/mips-tdep.c | 4 +-- gdb/s390-tdep.c | 2 +- 10 files changed, 95 insertions(+), 45 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cf2237c40cb..efd95fa2617 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2002-12-06 Andrew Cagney + + * gdbarch.sh (DEPRECATED_INIT_FRAME_PC_FIRST): Rename + INIT_FRAME_PC_FIRST. Change to a function with predicate. Do not + provide a default value. + * gdbarch.h, gdbarch.c: Regenerate. + * frame.c (get_prev_frame): Update. Check + DEPRECATED_INIT_FRAME_PC_FIRST_P. + * s390-tdep.c (s390_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * config/sparc/tm-sparc.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + 2002-12-06 Elena Zannoni * ia64-linux-nat.c: Include gdb_string.h. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 1f38f682360..6d998c40030 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -73,7 +73,6 @@ static gdbarch_push_arguments_ftype alpha_push_arguments; static gdbarch_push_dummy_frame_ftype alpha_push_dummy_frame; static gdbarch_pop_frame_ftype alpha_pop_frame; static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy; -static gdbarch_init_frame_pc_first_ftype alpha_init_frame_pc_first; static gdbarch_init_extra_frame_info_ftype alpha_init_extra_frame_info; static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target; @@ -1896,7 +1895,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_push_dummy_frame (gdbarch, alpha_push_dummy_frame); set_gdbarch_fix_call_dummy (gdbarch, alpha_fix_call_dummy); set_gdbarch_init_frame_pc (gdbarch, init_frame_pc_noop); - set_gdbarch_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first); + set_gdbarch_deprecated_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index 478e9bd164b..30f84860a98 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -78,7 +78,7 @@ extern void aix_process_linenos (void); /* Define other aspects of the stack frame. */ -#define INIT_FRAME_PC_FIRST(fromleaf, prev) \ +#define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) \ prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); #define INIT_FRAME_PC(fromleaf, prev) /* nothing */ diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 7cced22cfb8..ce94d9437e0 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -520,7 +520,7 @@ extern void sparc_print_extra_frame_info (struct frame_info *); /* INIT_EXTRA_FRAME_INFO needs the PC to detect flat frames. */ #define INIT_FRAME_PC(FROMLEAF, PREV) /* nothing */ -#define INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \ +#define DEPRECATED_INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \ (PREV)->pc = ((FROMLEAF) ? SAVED_PC_AFTER_CALL ((PREV)->next) : \ (PREV)->next ? FRAME_SAVED_PC ((PREV)->next) : read_pc ()); diff --git a/gdb/frame.c b/gdb/frame.c index b4e2cfd9388..4e31c93fa78 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -986,8 +986,9 @@ get_prev_frame (struct frame_info *next_frame) to require INIT_EXTRA_FRAME_INFO before they can do INIT_FRAME_PC. Phoo. - We shouldn't need INIT_FRAME_PC_FIRST to add more complication to - an already overcomplicated part of GDB. gnu@cygnus.com, 15Sep92. + We shouldn't need DEPRECATED_INIT_FRAME_PC_FIRST to add more + complication to an already overcomplicated part of GDB. + gnu@cygnus.com, 15Sep92. Assuming that some machines need INIT_FRAME_PC after INIT_EXTRA_FRAME_INFO, one possible scheme: @@ -1040,7 +1041,8 @@ get_prev_frame (struct frame_info *next_frame) FRAME_SAVED_PC() is being superseed by frame_pc_unwind() and that function does have somewhere to cache that PC value. */ - INIT_FRAME_PC_FIRST (fromleaf, prev); + if (DEPRECATED_INIT_FRAME_PC_FIRST_P ()) + DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev); if (INIT_EXTRA_FRAME_INFO_P ()) INIT_EXTRA_FRAME_INFO (fromleaf, prev); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 922ba5708b6..ef568205a20 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -195,7 +195,7 @@ struct gdbarch int call_dummy_stack_adjust_p; int call_dummy_stack_adjust; gdbarch_fix_call_dummy_ftype *fix_call_dummy; - gdbarch_init_frame_pc_first_ftype *init_frame_pc_first; + gdbarch_deprecated_init_frame_pc_first_ftype *deprecated_init_frame_pc_first; gdbarch_init_frame_pc_ftype *init_frame_pc; int believe_pcc_promotion; int believe_pcc_promotion_type; @@ -533,7 +533,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->call_dummy_words = legacy_call_dummy_words; current_gdbarch->sizeof_call_dummy_words = legacy_sizeof_call_dummy_words; current_gdbarch->call_dummy_stack_adjust_p = -1; - current_gdbarch->init_frame_pc_first = init_frame_pc_noop; current_gdbarch->init_frame_pc = init_frame_pc_default; current_gdbarch->coerce_float_to_double = default_coerce_float_to_double; current_gdbarch->register_convertible = generic_register_convertible_not; @@ -712,7 +711,7 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->fix_call_dummy == 0)) fprintf_unfiltered (log, "\n\tfix_call_dummy"); - /* Skip verify of init_frame_pc_first, invalid_p == 0 */ + /* Skip verify of deprecated_init_frame_pc_first, has predicate */ /* Skip verify of init_frame_pc, invalid_p == 0 */ /* Skip verify of coerce_float_to_double, invalid_p == 0 */ /* Skip verify of get_saved_register, has predicate */ @@ -1193,6 +1192,29 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_extract_struct_value_address /*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/); #endif +#ifdef DEPRECATED_INIT_FRAME_PC_FIRST_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_INIT_FRAME_PC_FIRST_P()", + XSTRING (DEPRECATED_INIT_FRAME_PC_FIRST_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_INIT_FRAME_PC_FIRST_P() = %d\n", + DEPRECATED_INIT_FRAME_PC_FIRST_P ()); +#endif +#ifdef DEPRECATED_INIT_FRAME_PC_FIRST +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev)", + XSTRING (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_INIT_FRAME_PC_FIRST = 0x%08lx\n", + (long) current_gdbarch->deprecated_init_frame_pc_first + /*DEPRECATED_INIT_FRAME_PC_FIRST ()*/); +#endif #ifdef DEPRECATED_PC_IN_CALL_DUMMY_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1572,20 +1594,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->init_frame_pc /*INIT_FRAME_PC ()*/); #endif -#ifdef INIT_FRAME_PC_FIRST -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "INIT_FRAME_PC_FIRST(fromleaf, prev)", - XSTRING (INIT_FRAME_PC_FIRST (fromleaf, prev))); -#endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: INIT_FRAME_PC_FIRST = 0x%08lx\n", - (long) current_gdbarch->init_frame_pc_first - /*INIT_FRAME_PC_FIRST ()*/); -#endif #ifdef INNER_THAN fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -3776,23 +3784,30 @@ set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch, gdbarch->fix_call_dummy = fix_call_dummy; } +int +gdbarch_deprecated_init_frame_pc_first_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_init_frame_pc_first != 0; +} + void -gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev) +gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev) { gdb_assert (gdbarch != NULL); - if (gdbarch->init_frame_pc_first == 0) + if (gdbarch->deprecated_init_frame_pc_first == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_init_frame_pc_first invalid"); + "gdbarch: gdbarch_deprecated_init_frame_pc_first invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_init_frame_pc_first called\n"); - gdbarch->init_frame_pc_first (fromleaf, prev); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_init_frame_pc_first called\n"); + gdbarch->deprecated_init_frame_pc_first (fromleaf, prev); } void -set_gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, - gdbarch_init_frame_pc_first_ftype init_frame_pc_first) +set_gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, + gdbarch_deprecated_init_frame_pc_first_ftype deprecated_init_frame_pc_first) { - gdbarch->init_frame_pc_first = init_frame_pc_first; + gdbarch->deprecated_init_frame_pc_first = deprecated_init_frame_pc_first; } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index f472e578599..c72897d6101 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1178,20 +1178,40 @@ extern void set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch, gdbarch_fix_cal #endif #endif +#if defined (DEPRECATED_INIT_FRAME_PC_FIRST) +/* Legacy for systems yet to multi-arch DEPRECATED_INIT_FRAME_PC_FIRST */ +#if !defined (DEPRECATED_INIT_FRAME_PC_FIRST_P) +#define DEPRECATED_INIT_FRAME_PC_FIRST_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_INIT_FRAME_PC_FIRST_P) +#define DEPRECATED_INIT_FRAME_PC_FIRST_P() (0) +#endif + +extern int gdbarch_deprecated_init_frame_pc_first_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_FRAME_PC_FIRST_P) +#error "Non multi-arch definition of DEPRECATED_INIT_FRAME_PC_FIRST" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_INIT_FRAME_PC_FIRST_P) +#define DEPRECATED_INIT_FRAME_PC_FIRST_P() (gdbarch_deprecated_init_frame_pc_first_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (INIT_FRAME_PC_FIRST) -#define INIT_FRAME_PC_FIRST(fromleaf, prev) (init_frame_pc_noop (fromleaf, prev)) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_INIT_FRAME_PC_FIRST) +#define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) (internal_error (__FILE__, __LINE__, "DEPRECATED_INIT_FRAME_PC_FIRST"), 0) #endif -typedef void (gdbarch_init_frame_pc_first_ftype) (int fromleaf, struct frame_info *prev); -extern void gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev); -extern void set_gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, gdbarch_init_frame_pc_first_ftype *init_frame_pc_first); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (INIT_FRAME_PC_FIRST) -#error "Non multi-arch definition of INIT_FRAME_PC_FIRST" +typedef void (gdbarch_deprecated_init_frame_pc_first_ftype) (int fromleaf, struct frame_info *prev); +extern void gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev); +extern void set_gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, gdbarch_deprecated_init_frame_pc_first_ftype *deprecated_init_frame_pc_first); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_FRAME_PC_FIRST) +#error "Non multi-arch definition of DEPRECATED_INIT_FRAME_PC_FIRST" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (INIT_FRAME_PC_FIRST) -#define INIT_FRAME_PC_FIRST(fromleaf, prev) (gdbarch_init_frame_pc_first (current_gdbarch, fromleaf, prev)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_INIT_FRAME_PC_FIRST) +#define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) (gdbarch_deprecated_init_frame_pc_first (current_gdbarch, fromleaf, prev)) #endif #endif diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index f1972117cd7..db07119cc04 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -513,7 +513,7 @@ v:2:SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_ v:1:CALL_DUMMY_STACK_ADJUST_P:int:call_dummy_stack_adjust_p::::0:-1:::0x%08lx v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0:::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p:::0 -f:2:INIT_FRAME_PC_FIRST:void:init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_noop::0 +F::DEPRECATED_INIT_FRAME_PC_FIRST:void:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_default::0 # v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::::: diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index c29c7a0a524..65216bd49d2 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -5964,8 +5964,8 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_addr_bits_remove (gdbarch, mips_addr_bits_remove); /* There's a mess in stack frame creation. See comments in - blockframe.c near reference to INIT_FRAME_PC_FIRST. */ - set_gdbarch_init_frame_pc_first (gdbarch, mips_init_frame_pc_first); + blockframe.c near reference to DEPRECATED_INIT_FRAME_PC_FIRST. */ + set_gdbarch_deprecated_init_frame_pc_first (gdbarch, mips_init_frame_pc_first); set_gdbarch_init_frame_pc (gdbarch, init_frame_pc_noop); /* Map debug register numbers onto internal register numbers. */ diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 622f2850738..a5584009d11 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1790,7 +1790,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_breakpoint_from_pc (gdbarch, s390_breakpoint_from_pc); set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue); set_gdbarch_init_extra_frame_info (gdbarch, s390_init_extra_frame_info); - set_gdbarch_init_frame_pc_first (gdbarch, s390_init_frame_pc_first); + set_gdbarch_deprecated_init_frame_pc_first (gdbarch, s390_init_frame_pc_first); set_gdbarch_read_fp (gdbarch, s390_read_fp); /* This function that tells us whether the function invocation represented by FI does not have a frame on the stack associated with it. If it -- 2.30.2