From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11096 invoked by alias); 21 Apr 2002 09:16:47 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 11064 invoked from network); 21 Apr 2002 09:16:42 -0000 Received: from unknown (HELO pizda.ninka.net) (216.101.162.242) by sources.redhat.com with SMTP; 21 Apr 2002 09:16:42 -0000 Received: from localhost (IDENT:davem@localhost.localdomain [127.0.0.1]) by pizda.ninka.net (8.9.3/8.9.3) with ESMTP id CAA20944 for ; Sun, 21 Apr 2002 02:07:50 -0700 Date: Sun, 21 Apr 2002 02:16:00 -0000 Message-Id: <20020421.020750.82982361.davem@redhat.com> To: gdb-patches@sources.redhat.com Subject: [RFA] Kill SKIP_PROLOGUE_FRAMELESS_P From: "David S. Miller" Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg00727.txt.bz2 This is being done so that we don't have to multi-arch it. It's existence is questionable at best. Basically, it allowed a target to optimize SKIP_PROLOGUE() if we just cared about whether the function was frameless or not (ie. lacked any prologue at all). PROLOGUE_FRAMELESS_P and it's gdbarch equivalent exist and allow the target to perform this optimization equivalently. So we kill SKIP_PROLOGUE_FRAMELESS_P, and for every target that provided it we instead make them implement PROLOGUE_FRAMELESS_P. Now we have one less thing to make multi-arch'able. Ok to install? 2002-04-21 David S. Miller * arch-utils.c (generic_prologue_frameless_p): Kill SKIP_PROLOGUE_FRAMELESS_P code. * config/arc/tm-arc.h (SKIP_PROLOGUE_FRAMELESS_P): Delete references. (PROLOGUE_FRAMELESS_P, arc_prologue_frameless_p): New. * arc-tdep.c (arc_prologue_frameless_p): Implement. * config/arc/tm-sparc.h (SKIP_PROLOGUE_FRAMELESS_P): Delete references. (PROLOGUE_FRAMELESS_P, sparc_prologue_frameless_p): New. * sparc-tdep.c (sparc_prologue_frameless_p): Implement. (sparc_gdbarch_init): Pass it to set_gdbarch_prologue_frameless_p. * config/sparc/tm-linux.h, config/sparc/tm-sp64linux.h (SKIP_PROLOGUE_FRAMELESS_P, sparc_linux_skip_prologue_frameless_p): Kill. * sparc-linux-tdep.c (sparc_prologue_frameless_p): Declare. (sparc_linux_skip_prologue_frameless_p): Rename to... (sparc_linux_prologue_frameless_p): And reimplement to return boolean. (sparc_linux_gdbarch_os_init): Pass it to set_gdbarch_prologue_frameless_p. --- ./config/arc/tm-arc.h.~1~ Sun Jan 20 19:34:30 2002 +++ ./config/arc/tm-arc.h Sun Apr 21 02:01:42 2002 @@ -29,14 +29,13 @@ #define FUNCTION_START_OFFSET 0 /* Advance PC across any function entry prologue instructions - to reach some "real" code. SKIP_PROLOGUE_FRAMELESS_P advances - the PC past some of the prologue, but stops as soon as it - knows that the function has a frame. Its result is equal - to its input PC if the function is frameless, unequal otherwise. */ + to reach some "real" code. */ #define SKIP_PROLOGUE(pc) (arc_skip_prologue (pc, 0)) -#define SKIP_PROLOGUE_FRAMELESS_P(pc) (arc_skip_prologue (pc, 1)) extern CORE_ADDR arc_skip_prologue (CORE_ADDR, int); + +#define PROLOGUE_FRAMELESS_P(pc) arc_prologue_frameless_p(pc) +extern int arc_prologue_frameless_p (CORE_ADDR); /* Sequence of bytes for breakpoint instruction. ??? The current value is "sr -1,[-1]" and is for the simulator only. --- ./config/sparc/tm-sparc.h.~1~ Mon Jan 28 20:42:44 2002 +++ ./config/sparc/tm-sparc.h Sun Apr 21 02:04:12 2002 @@ -248,10 +248,7 @@ extern int sparc_intreg_size (void); #define BELIEVE_PCC_PROMOTION 1 /* Advance PC across any function entry prologue instructions - to reach some "real" code. SKIP_PROLOGUE_FRAMELESS_P advances - the PC past some of the prologue, but stops as soon as it - knows that the function has a frame. Its result is equal - to its input PC if the function is frameless, unequal otherwise. */ + to reach some "real" code. */ #define SKIP_PROLOGUE(PC) sparc_skip_prologue (PC, 0) @@ -312,6 +309,10 @@ extern CORE_ADDR sparc32_stack_align (CO sparc_reg_struct_has_addr (GCC_P, TYPE) extern int sparc_reg_struct_has_addr (int, struct type *); +/* Is the prologue at PC frameless? */ +#define PROLOGUE_FRAMELESS_P(PC) sparc_prologue_frameless_p (PC) +extern int sparc_prologue_frameless_p (CORE_ADDR); + #endif /* GDB_MULTI_ARCH */ #if defined (GDB_MULTI_ARCH) && (GDB_MULTI_ARCH > 0) @@ -332,15 +333,6 @@ extern int sparc_y_regnum (void); #define PC_ADJUST(PC) sparc_pc_adjust (PC) extern CORE_ADDR sparc_pc_adjust (CORE_ADDR); - -/* Advance PC across any function entry prologue instructions to reach - some "real" code. SKIP_PROLOGUE_FRAMELESS_P advances the PC past - some of the prologue, but stops as soon as it knows that the - function has a frame. Its result is equal to its input PC if the - function is frameless, unequal otherwise. */ - -#define SKIP_PROLOGUE_FRAMELESS_P(PC) sparc_skip_prologue (PC, 1) -extern CORE_ADDR sparc_skip_prologue (CORE_ADDR, int); /* If an argument is declared "register", Sun cc will keep it in a register, never saving it onto the stack. So we better not believe the "p" symbol --- ./config/sparc/tm-linux.h.~1~ Sun Apr 21 01:30:19 2002 +++ ./config/sparc/tm-linux.h Sun Apr 21 01:57:42 2002 @@ -29,8 +29,4 @@ #include "tm-linux.h" -#undef SKIP_PROLOGUE_FRAMELESS_P -#define SKIP_PROLOGUE_FRAMELESS_P(PC) sparc_linux_skip_prologue_frameless_p (PC) -extern CORE_ADDR sparc_linux_skip_prologue_frameless_p (CORE_ADDR pc); - #endif /* TM_SPARCLINUX_H */ --- ./config/sparc/tm-sp64linux.h.~1~ Sun Apr 21 01:30:27 2002 +++ ./config/sparc/tm-sp64linux.h Sun Apr 21 01:57:47 2002 @@ -29,8 +29,4 @@ Foundation, Inc., 59 Temple Place - Suit #include "tm-linux.h" -#undef SKIP_PROLOGUE_FRAMELESS_P -#define SKIP_PROLOGUE_FRAMELESS_P(PC) sparc_linux_skip_prologue_frameless_p (PC) -extern CORE_ADDR sparc_linux_skip_prologue_frameless_p (CORE_ADDR pc); - #endif /* TM_SPARC_LIN64_H */ --- ./sparc-tdep.c.~1~ Sat Apr 20 20:21:56 2002 +++ ./sparc-tdep.c Sun Apr 21 01:57:20 2002 @@ -626,6 +626,14 @@ sparc_skip_prologue (CORE_ADDR start_pc, return examine_prologue (start_pc, frameless_p, NULL, NULL); } +/* Is the prologue at IP frameless? */ + +int +sparc_prologue_frameless_p (CORE_ADDR ip) +{ + return ip == sparc_skip_prologue (ip, 1); +} + /* Check instruction at ADDR to see if it is a branch. All non-annulled instructions will go to NPC or will trap. Set *TARGET if we find a candidate branch; set to zero if not. @@ -2709,10 +2717,7 @@ sparc64_register_byte (int regno) } /* Advance PC across any function entry prologue instructions to reach - some "real" code. SKIP_PROLOGUE_FRAMELESS_P advances the PC past - some of the prologue, but stops as soon as it knows that the - function has a frame. Its result is equal to its input PC if the - function is frameless, unequal otherwise. */ + some "real" code. */ static CORE_ADDR sparc_gdbarch_skip_prologue (CORE_ADDR ip) @@ -3031,6 +3036,7 @@ sparc_gdbarch_init (struct gdbarch_info set_gdbarch_reg_struct_has_addr (gdbarch, sparc_reg_struct_has_addr); set_gdbarch_return_value_on_stack (gdbarch, sparc_return_value_on_stack); set_gdbarch_saved_pc_after_call (gdbarch, sparc_saved_pc_after_call); + set_gdbarch_prologue_frameless_p (gdbarch, sparc_prologue_frameless_p); set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_skip_prologue (gdbarch, sparc_gdbarch_skip_prologue); set_gdbarch_sp_regnum (gdbarch, SPARC_SP_REGNUM); --- ./sparc-linux-tdep.c.~1~ Sun Apr 21 01:30:03 2002 +++ ./sparc-linux-tdep.c Sun Apr 21 01:58:17 2002 @@ -385,13 +385,13 @@ sparc_linux_skip_solib_resolver (CORE_AD ret restore - is going to confuse SKIP_PROLOGUE_FRAMELESS_P. It is hard to - formulate a generic fix for this that would not break on sibcalls. + is going to confuse sparc_prologue_frameless_p. It is hard to + formulate a generic fix for this that would not break on sibcalls. */ - TODO Need to generically multi-arch this. */ +extern int sparc_prologue_frameless_p (CORE_ADDR); -CORE_ADDR -sparc_linux_skip_prologue_frameless_p (CORE_ADDR pc) +static int +sparc_linux_prologue_frameless_p (CORE_ADDR pc) { struct objfile *objfile; struct minimal_symbol *resolver @@ -414,9 +414,9 @@ sparc_linux_skip_prologue_frameless_p (C resolver_size = 0x100; if (pc >= rpc && pc < (rpc + resolver_size)) - return pc + 4; + return 1; } - return sparc_skip_prologue (pc, 1); + return sparc_prologue_frameless_p (pc); } /* Fetch (and possibly build) an appropriate link_map_offsets @@ -483,6 +483,7 @@ sparc_linux_gdbarch_os_init(struct gdbar set_gdbarch_saved_pc_after_call (gdbarch, sparc_linux_saved_pc_after_call); set_gdbarch_in_sigtramp (gdbarch, sparc_linux_in_sigtramp); set_gdbarch_skip_solib_resolver (gdbarch, sparc_linux_skip_solib_resolver); + set_gdbarch_prologue_frameless_p (gdbarch, sparc_linux_prologue_frameless_p); if (gdbarch_tdep (gdbarch)->intreg_size == 4) { --- ./arch-utils.c.~1~ Sun Apr 21 01:20:26 2002 +++ ./arch-utils.c Sun Apr 21 01:59:35 2002 @@ -166,11 +166,7 @@ generic_remote_translate_xfer_address (C int generic_prologue_frameless_p (CORE_ADDR ip) { -#ifdef SKIP_PROLOGUE_FRAMELESS_P - return ip == SKIP_PROLOGUE_FRAMELESS_P (ip); -#else return ip == SKIP_PROLOGUE (ip); -#endif } /* New/multi-arched targets should use the correct gdbarch field --- ./arc-tdep.c.~1~ Wed Feb 20 02:42:59 2002 +++ ./arc-tdep.c Sun Apr 21 02:00:40 2002 @@ -296,6 +296,14 @@ arc_skip_prologue (CORE_ADDR pc, int fra return codestream_tell (); } +/* Is the prologue at PC frameless? */ + +int +arc_prologue_frameless_p (CORE_ADDR pc) +{ + return (pc == arc_skip_prologue (pc, 1); +} + /* Return the return address for a frame. This is used to implement FRAME_SAVED_PC. This is taken from frameless_look_for_prologue. */