From 5fdff4261c7ed2a7c14c2e72cb6981e853af2803 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 5 Nov 2001 23:11:31 +0000 Subject: [PATCH] Change INIT_EXTRA_FRAME_INFO() to a function with predicate. --- gdb/ChangeLog | 9 +++++++++ gdb/blockframe.c | 5 ++--- gdb/gdbarch.c | 10 +++++++--- gdb/gdbarch.h | 25 +++++++++++++++++++++++++ gdb/gdbarch.sh | 2 +- 5 files changed, 44 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a764f40f129..d07aab8c92f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2001-11-05 Andrew Cagney + + * gdbarch.sh (init_extra_frame_info): Change to a function with + pedicate. + * gdbarch.h, gdbarch.c: Re-generate. + * blockframe.c (create_new_frame): Replace #ifdef + INIT_EXTRA_FRAME_INFO with run-time test of + INIT_EXTRA_FRAME_INFO_P. + 2001-11-05 Andrew Cagney * gdbarch.sh (verify_gdbarch): Use a mem_file to accumulate all diff --git a/gdb/blockframe.c b/gdb/blockframe.c index c88649e19d3..1c6ec2c2d36 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -227,9 +227,8 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); fi->signal_handler_caller = IN_SIGTRAMP (fi->pc, name); -#ifdef INIT_EXTRA_FRAME_INFO - INIT_EXTRA_FRAME_INFO (0, fi); -#endif + if (INIT_EXTRA_FRAME_INFO_P ()) + INIT_EXTRA_FRAME_INFO (0, fi); return fi; } diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index ce42082452f..9cbc87a3cb9 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -694,9 +694,7 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH >= 2) && (gdbarch->frame_init_saved_regs == 0)) fprintf_unfiltered (log, "\n\tframe_init_saved_regs"); - if ((GDB_MULTI_ARCH >= 2) - && (gdbarch->init_extra_frame_info == 0)) - fprintf_unfiltered (log, "\n\tinit_extra_frame_info"); + /* Skip verify of init_extra_frame_info, has predicate */ if ((GDB_MULTI_ARCH >= 2) && (gdbarch->skip_prologue == 0)) fprintf_unfiltered (log, "\n\tskip_prologue"); @@ -3615,6 +3613,12 @@ set_gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, gdbarch->frame_init_saved_regs = frame_init_saved_regs; } +int +gdbarch_init_extra_frame_info_p (struct gdbarch *gdbarch) +{ + return gdbarch->init_extra_frame_info != 0; +} + void gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 31746fcee93..19909693656 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1441,6 +1441,31 @@ extern void set_gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, gdbarch_ #endif #endif +#if defined (INIT_EXTRA_FRAME_INFO) +/* Legacy for systems yet to multi-arch INIT_EXTRA_FRAME_INFO */ +#if !defined (INIT_EXTRA_FRAME_INFO_P) +#define INIT_EXTRA_FRAME_INFO_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (INIT_EXTRA_FRAME_INFO_P) +#define INIT_EXTRA_FRAME_INFO_P() (0) +#endif + +extern int gdbarch_init_extra_frame_info_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (INIT_EXTRA_FRAME_INFO_P) +#error "Non multi-arch definition of INIT_EXTRA_FRAME_INFO" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (INIT_EXTRA_FRAME_INFO_P) +#define INIT_EXTRA_FRAME_INFO_P() (gdbarch_init_extra_frame_info_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (INIT_EXTRA_FRAME_INFO) +#define INIT_EXTRA_FRAME_INFO(fromleaf, frame) (internal_error (__FILE__, __LINE__, "INIT_EXTRA_FRAME_INFO"), 0) +#endif + typedef void (gdbarch_init_extra_frame_info_ftype) (int fromleaf, struct frame_info *frame); extern void gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame); extern void set_gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, gdbarch_init_extra_frame_info_ftype *init_extra_frame_info); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 623b03e3328..5e1f101dbf4 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -487,7 +487,7 @@ F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:char *re f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::0 # f:2:FRAME_INIT_SAVED_REGS:void:frame_init_saved_regs:struct frame_info *frame:frame::0:0 -f:2:INIT_EXTRA_FRAME_INFO:void:init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, 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 f:2:PROLOGUE_FRAMELESS_P:int:prologue_frameless_p:CORE_ADDR ip:ip::0:generic_prologue_frameless_p::0 -- 2.30.2