From patchwork Tue Nov 25 19:12:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Galvan X-Patchwork-Id: 3909 Received: (qmail 27197 invoked by alias); 25 Nov 2014 19:12:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 27188 invoked by uid 89); 25 Nov 2014 19:12:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mail-qa0-f48.google.com Received: from mail-qa0-f48.google.com (HELO mail-qa0-f48.google.com) (209.85.216.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 25 Nov 2014 19:12:24 +0000 Received: by mail-qa0-f48.google.com with SMTP id v10so874841qac.35 for ; Tue, 25 Nov 2014 11:12:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZQGp53QgnDavLoUleXiZKDj/ZcWDQT7zUNOk8Xl2H+0=; b=L1n+dn1BNkJP7bOFQ89qETGNYcgvE0JvuOB7H4bbv6WOI4cWi/tDaraYTJeKbggm1L qMU8/xoaYXZ6xoY75PEMzeqN7yXQm5Dv0fEQeAJk0/E5TBBhTJmn+PLS8BQs7nsy74Y8 94mSzgLJZBK2aohsiyR/Ap3gbTW0iAZIlX6v/FHL6kPr/Tg9YkDLVPnXRIdPL9RQURxg EjxkIbuPP3WXZqZ+8kZisi3rAf0G2kWZZKEJonOHRkFMwjTvDIlsYrBFV48BkxEZXA5A Pm1MIpCeRSesyYUQqyTUHmsiGLHJG5wmk5RD2vlrS4hl/RD47Pc9Hxj6V9mK7UsEEiQB 6K+w== X-Gm-Message-State: ALoCoQnKiKG0tlSwIlwEznzu7Znx5bdxXEHW4RTDbdBHwUMWpjtC/KpVhBFIxOzuenD4Yp70PWwX X-Received: by 10.140.46.52 with SMTP id j49mr20731521qga.30.1416942742122; Tue, 25 Nov 2014 11:12:22 -0800 (PST) Received: from martin-galvan.dominio.tallertechnologies.com ([200.69.202.173]) by mx.google.com with ESMTPSA id j14sm1873389qar.17.2014.11.25.11.12.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Nov 2014 11:12:21 -0800 (PST) From: Martin Galvan To: gdb-patches@sourceware.org Cc: dje@google.com, uweigand@de.ibm.com, palves@redhat.com, yao@codesourcery.com, daniel.gutson@tallertechnologies.com Subject: [PATCH] Rename in_function_epilogue_p to stack_frame_destroyed_p. Date: Tue, 25 Nov 2014 16:12:14 -0300 Message-Id: <1416942734-8289-1-git-send-email-martin.galvan@tallertechnologies.com> From here: https://sourceware.org/ml/gdb-patches/2014-08/msg00592.html https://sourceware.org/ml/gdb-patches/2014-10/msg00590.html https://sourceware.org/ml/gdb-patches/2014-11/msg00224.html We concluded that gdbarch_in_function_epilogue_p is misnamed since it returns true if the given PC is one instruction after the one that destroyed the stack (which isn't necessarily inside an epilogue), therefore it should be renamed to stack_frame_destroyed_p. I also took the liberty of renaming the arch-specific implementations to *_stack_frame_destroyed_p as well for consistency. gdb/: 2014-11-25 Martin Galvan * Replace in_function_epilogue_p to stack_frame_destroyed_p throughout. --- gdb/amd64-tdep.c | 9 ++++++--- gdb/arch-utils.c | 2 +- gdb/arch-utils.h | 2 +- gdb/arm-tdep.c | 19 ++++++++++--------- gdb/breakpoint.c | 9 +++++---- gdb/gdbarch.c | 24 ++++++++++++------------ gdb/gdbarch.h | 8 ++++---- gdb/gdbarch.sh | 4 ++-- gdb/hppa-tdep.c | 11 +++++++---- gdb/i386-tdep.c | 9 ++++++--- gdb/mips-tdep.c | 36 +++++++++++++++++++++--------------- gdb/nios2-tdep.c | 6 +++--- gdb/rs6000-tdep.c | 8 ++++---- gdb/s390-linux-tdep.c | 12 ++++++------ gdb/score-tdep.c | 12 ++++++------ gdb/sh-tdep.c | 9 ++++++--- gdb/sparc-tdep.c | 4 ++-- gdb/sparc-tdep.h | 2 +- gdb/sparc64-tdep.c | 2 +- gdb/spu-tdep.c | 4 ++-- gdb/tic6x-tdep.c | 6 +++--- gdb/tilegx-tdep.c | 8 ++++---- gdb/xstormy16-tdep.c | 11 +++++++---- 23 files changed, 120 insertions(+), 97 deletions(-) diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index e69da01..9907a81 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -2707,12 +2707,15 @@ static const struct frame_base amd64_frame_base = /* Normal frames, but in a function epilogue. */ -/* The epilogue is defined here as the 'ret' instruction, which will +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). + + The epilogue is defined here as the 'ret' instruction, which will follow any instruction such as 'leave' or 'pop %ebp' that destroys the function's stack frame. */ static int -amd64_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +amd64_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { gdb_byte insn; struct compunit_symtab *cust; @@ -2736,7 +2739,7 @@ amd64_epilogue_frame_sniffer (const struct frame_unwind *self, void **this_prologue_cache) { if (frame_relative_level (this_frame) == 0) - return amd64_in_function_epilogue_p (get_frame_arch (this_frame), + return amd64_stack_frame_destroyed_p (get_frame_arch (this_frame), get_frame_pc (this_frame)); else return 0; diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index a2e76de..39adf82 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -126,7 +126,7 @@ generic_in_solib_return_trampoline (struct gdbarch *gdbarch, } int -generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +generic_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { return 0; } diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 1f5dd55..09333df 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -97,7 +97,7 @@ extern CORE_ADDR generic_skip_solib_resolver (struct gdbarch *gdbarch, extern int generic_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name); -extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, +extern int generic_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc); /* By default, registers are not convertible. */ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 1002870..46043ab 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -3231,11 +3231,11 @@ arm_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, } } -/* Return true if we are in the function's epilogue, i.e. after the - instruction that destroyed the function's stack frame. */ +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). */ static int -thumb_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch); unsigned int insn, insn2; @@ -3342,11 +3342,11 @@ thumb_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) return found_stack_adjust; } -/* Return true if we are in the function's epilogue, i.e. after the - instruction that destroyed the function's stack frame. */ +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). */ static int -arm_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +arm_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch); unsigned int insn; @@ -3354,7 +3354,7 @@ arm_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) CORE_ADDR func_start, func_end; if (arm_pc_is_thumb (gdbarch, pc)) - return thumb_in_function_epilogue_p (gdbarch, pc); + return thumb_stack_frame_destroyed_p (gdbarch, pc); if (!find_pc_partial_function (pc, NULL, &func_start, &func_end)) return 0; @@ -10380,8 +10380,9 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Advance PC across function entry code. */ set_gdbarch_skip_prologue (gdbarch, arm_skip_prologue); - /* Detect whether PC is in function epilogue. */ - set_gdbarch_in_function_epilogue_p (gdbarch, arm_in_function_epilogue_p); + /* Detect whether PC is at a point where the stack frame has been invalidated, + such as in a function's epilogue. */ + set_gdbarch_stack_frame_destroyed_p (gdbarch, arm_stack_frame_destroyed_p); /* Skip trampolines. */ set_gdbarch_skip_trampoline_code (gdbarch, arm_skip_stub); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 574d06c..5f9d8da 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1827,10 +1827,11 @@ update_watchpoint (struct watchpoint *b, int reparse) struct gdbarch *frame_arch = get_frame_arch (fi); CORE_ADDR frame_pc = get_frame_pc (fi); - /* If we're in a function epilogue, unwinding may not work + /* If we're at a point where the stack frame has been invalidated + (such as in a function's epilogue), unwinding may not work properly, so do not attempt to recreate locations at this point. See similar comments in watchpoint_check. */ - if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc)) + if (gdbarch_stack_frame_destroyed_p (frame_arch, frame_pc)) return; /* Save the current frame's ID so we can restore it after @@ -4997,7 +4998,7 @@ watchpoint_check (void *p) struct gdbarch *frame_arch = get_frame_arch (frame); CORE_ADDR frame_pc = get_frame_pc (frame); - /* in_function_epilogue_p() returns a non-zero value if we're + /* stack_frame_destroyed_p() returns a non-zero value if we're still in the function but the stack frame has already been invalidated. Since we can't rely on the values of local variables after the stack has been destroyed, we are treating @@ -5006,7 +5007,7 @@ watchpoint_check (void *p) frame is in an epilogue - even if they are in some other frame, our view of the stack is likely to be wrong and frame_find_by_id could error out. */ - if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc)) + if (gdbarch_stack_frame_destroyed_p (frame_arch, frame_pc)) return WP_IGNORE; fr = frame_find_by_id (b->watchpoint_frame); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index f89a6d2..f5fde8c 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -249,7 +249,7 @@ struct gdbarch gdbarch_skip_trampoline_code_ftype *skip_trampoline_code; gdbarch_skip_solib_resolver_ftype *skip_solib_resolver; gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline; - gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p; + gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p; gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special; gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special; int cannot_step_breakpoint; @@ -391,7 +391,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->skip_trampoline_code = generic_skip_trampoline_code; gdbarch->skip_solib_resolver = generic_skip_solib_resolver; gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline; - gdbarch->in_function_epilogue_p = generic_in_function_epilogue_p; + gdbarch->stack_frame_destroyed_p = generic_stack_frame_destroyed_p; gdbarch->elf_make_msymbol_special = default_elf_make_msymbol_special; gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special; gdbarch->register_reggroup_p = default_register_reggroup_p; @@ -564,7 +564,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of skip_trampoline_code, invalid_p == 0 */ /* Skip verify of skip_solib_resolver, invalid_p == 0 */ /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */ - /* Skip verify of in_function_epilogue_p, invalid_p == 0 */ + /* Skip verify of stack_frame_destroyed_p, invalid_p == 0 */ /* Skip verify of elf_make_msymbol_special, invalid_p == 0 */ /* Skip verify of coff_make_msymbol_special, invalid_p == 0 */ /* Skip verify of cannot_step_breakpoint, invalid_p == 0 */ @@ -955,8 +955,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: have_nonsteppable_watchpoint = %s\n", plongest (gdbarch->have_nonsteppable_watchpoint)); fprintf_unfiltered (file, - "gdbarch_dump: in_function_epilogue_p = <%s>\n", - host_address_to_string (gdbarch->in_function_epilogue_p)); + "gdbarch_dump: stack_frame_destroyed_p = <%s>\n", + host_address_to_string (gdbarch->stack_frame_destroyed_p)); fprintf_unfiltered (file, "gdbarch_dump: in_solib_return_trampoline = <%s>\n", host_address_to_string (gdbarch->in_solib_return_trampoline)); @@ -3049,20 +3049,20 @@ set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, } int -gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr) +gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr) { gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->in_function_epilogue_p != NULL); + gdb_assert (gdbarch->stack_frame_destroyed_p != NULL); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_in_function_epilogue_p called\n"); - return gdbarch->in_function_epilogue_p (gdbarch, addr); + fprintf_unfiltered (gdb_stdlog, "gdbarch_stack_frame_destroyed_p called\n"); + return gdbarch->stack_frame_destroyed_p (gdbarch, addr); } void -set_gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, - gdbarch_in_function_epilogue_p_ftype in_function_epilogue_p) +set_gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, + gdbarch_stack_frame_destroyed_p_ftype stack_frame_destroyed_p) { - gdbarch->in_function_epilogue_p = in_function_epilogue_p; + gdbarch->stack_frame_destroyed_p = stack_frame_destroyed_p; } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 0bd1d56..2c945cf 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -676,7 +676,7 @@ extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdb /* A target might have problems with watchpoints as soon as the stack frame of the current function has been destroyed. This mostly happens - as the first action in a funtion's epilogue. in_function_epilogue_p() + as the first action in a function's epilogue. stack_frame_destroyed_p() is defined to return a non-zero value if either the given addr is one instruction after the stack destroying instruction up to the trailing return instruction or if we can figure out that the stack frame has @@ -684,9 +684,9 @@ extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdb which don't suffer from that problem could just let this functionality untouched. */ -typedef int (gdbarch_in_function_epilogue_p_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); -extern int gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr); -extern void set_gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p); +typedef int (gdbarch_stack_frame_destroyed_p_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); +extern int gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr); +extern void set_gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p); typedef void (gdbarch_elf_make_msymbol_special_ftype) (asymbol *sym, struct minimal_symbol *msym); extern void gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 8aeb394..dbea1b0 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -627,14 +627,14 @@ m:int:in_solib_return_trampoline:CORE_ADDR pc, const char *name:pc, name::generi # A target might have problems with watchpoints as soon as the stack # frame of the current function has been destroyed. This mostly happens -# as the first action in a funtion's epilogue. in_function_epilogue_p() +# as the first action in a function's epilogue. stack_frame_destroyed_p() # is defined to return a non-zero value if either the given addr is one # instruction after the stack destroying instruction up to the trailing # return instruction or if we can figure out that the stack frame has # already been invalidated regardless of the value of addr. Targets # which don't suffer from that problem could just let this functionality # untouched. -m:int:in_function_epilogue_p:CORE_ADDR addr:addr:0:generic_in_function_epilogue_p::0 +m:int:stack_frame_destroyed_p:CORE_ADDR addr:addr:0:generic_stack_frame_destroyed_p::0 f:void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym::default_elf_make_msymbol_special::0 f:void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym::default_coff_make_msymbol_special::0 v:int:cannot_step_breakpoint:::0:0::0 diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 627f31a..3a53bc5 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -529,13 +529,16 @@ find_unwind_entry (CORE_ADDR pc) return NULL; } -/* The epilogue is defined here as the area either on the `bv' instruction +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). + + The epilogue is defined here as the area either on the `bv' instruction itself or an instruction which destroys the function's stack frame. We do not assume that the epilogue is at the end of a function as we can also have return sequences in the middle of a function. */ static int -hppa_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +hppa_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); unsigned long status; @@ -3043,8 +3046,8 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* The following gdbarch vector elements do not depend on the address size, or in any other gdbarch element previously set. */ set_gdbarch_skip_prologue (gdbarch, hppa_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, - hppa_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, + stack_frame_destroyed_p); set_gdbarch_inner_than (gdbarch, core_addr_greaterthan); set_gdbarch_sp_regnum (gdbarch, HPPA_SP_REGNUM); set_gdbarch_fp0_regnum (gdbarch, HPPA_FP0_REGNUM); diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 6c4ef17..ccc0645 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2176,12 +2176,15 @@ static const struct frame_unwind i386_frame_unwind = /* Normal frames, but in a function epilogue. */ -/* The epilogue is defined here as the 'ret' instruction, which will +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). + + The epilogue is defined here as the 'ret' instruction, which will follow any instruction such as 'leave' or 'pop %ebp' that destroys the function's stack frame. */ static int -i386_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +i386_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { gdb_byte insn; struct compunit_symtab *cust; @@ -2205,7 +2208,7 @@ i386_epilogue_frame_sniffer (const struct frame_unwind *self, void **this_prologue_cache) { if (frame_relative_level (this_frame) == 0) - return i386_in_function_epilogue_p (get_frame_arch (this_frame), + return i386_stack_frame_destroyed_p (get_frame_arch (this_frame), get_frame_pc (this_frame)); else return 0; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index c072bf0..4642a9e 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -6544,10 +6544,11 @@ mips_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) return mips32_scan_prologue (gdbarch, pc, limit_pc, NULL, NULL); } -/* Check whether the PC is in a function epilogue (32-bit version). - This is a helper function for mips_in_function_epilogue_p. */ +/* Check whether the PC is at a point where the stack frame has already been + destroyed, e.g. in a function's epilogue (32-bit version). + This is a helper function for mips_stack_frame_destroyed_p. */ static int -mips32_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +mips32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr = 0, func_end = 0; @@ -6582,11 +6583,12 @@ mips32_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) return 0; } -/* Check whether the PC is in a function epilogue (microMIPS version). - This is a helper function for mips_in_function_epilogue_p. */ +/* Check whether the PC is at a point where the stack frame has already been + destroyed, e.g. in a function's epilogue (microMIPS version). + This is a helper function for mips_stack_frame_destroyed_p. */ static int -micromips_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr = 0; CORE_ADDR func_end = 0; @@ -6683,10 +6685,11 @@ micromips_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) return 1; } -/* Check whether the PC is in a function epilogue (16-bit version). - This is a helper function for mips_in_function_epilogue_p. */ +/* Check whether the PC is at a point where the stack frame has already been + destroyed, e.g. in a function's epilogue (16-bit version). + This is a helper function for mips_stack_frame_destroyed_p. */ static int -mips16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +mips16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr = 0, func_end = 0; @@ -6723,17 +6726,20 @@ mips16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) return 0; } -/* The epilogue is defined here as the area at the end of a function, +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). + + The epilogue is defined here as the area at the end of a function, after an instruction which destroys the function's stack frame. */ static int -mips_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +mips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { if (mips_pc_is_mips16 (gdbarch, pc)) - return mips16_in_function_epilogue_p (gdbarch, pc); + return mips16_stack_frame_destroyed_p (gdbarch, pc); else if (mips_pc_is_micromips (gdbarch, pc)) - return micromips_in_function_epilogue_p (gdbarch, pc); + return micromips_stack_frame_destroyed_p (gdbarch, pc); else - return mips32_in_function_epilogue_p (gdbarch, pc); + return mips32_stack_frame_destroyed_p (gdbarch, pc); } /* Root of all "set mips "/"show mips " commands. This will eventually be @@ -8701,7 +8707,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, mips_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, mips_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, mips_stack_frame_destroyed_p); set_gdbarch_pointer_to_address (gdbarch, signed_pointer_to_address); set_gdbarch_address_to_pointer (gdbarch, address_to_signed_pointer); diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c index 1b647ac..e50ad82 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -318,10 +318,10 @@ nios2_in_epilogue_p (struct gdbarch *gdbarch, return 0; } -/* Implement the in_function_epilogue_p gdbarch method. */ +/* Implement the stack_frame_destroyed_p gdbarch method. */ static int -nios2_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +nios2_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr; @@ -1477,7 +1477,7 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_return_value (gdbarch, nios2_return_value); set_gdbarch_skip_prologue (gdbarch, nios2_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, nios2_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, nios2_stack_frame_destroyed_p); set_gdbarch_breakpoint_from_pc (gdbarch, nios2_breakpoint_from_pc); set_gdbarch_dummy_id (gdbarch, nios2_dummy_id); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index dabf448..9d6deda 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -854,8 +854,8 @@ insn_changes_sp_or_jumps (unsigned long insn) return 0; } -/* Return true if we are in the function's epilogue, i.e. after the - instruction that destroyed the function's stack frame. +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). 1) scan forward from the point of execution: a) If you find an instruction that modifies the stack pointer @@ -872,7 +872,7 @@ insn_changes_sp_or_jumps (unsigned long insn) limit for the size of an epilogue. */ static int -rs6000_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +rs6000_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -4098,7 +4098,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_push_dummy_call (gdbarch, ppc64_sysv_abi_push_dummy_call); set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, rs6000_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, rs6000_stack_frame_destroyed_p); set_gdbarch_skip_main_prologue (gdbarch, rs6000_skip_main_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index b5d94ce..9b8e264f 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -1327,10 +1327,10 @@ s390_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) return skip_pc ? skip_pc : pc; } -/* Return true if we are in the functin's epilogue, i.e. after the - instruction that destroyed the function's stack frame. */ +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). */ static int -s390_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +s390_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { int word_size = gdbarch_ptr_bit (gdbarch) / 8; @@ -1678,9 +1678,9 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame, && (next_frame == NULL || get_frame_type (get_next_frame (this_frame)) != NORMAL_FRAME)) { - /* See the comment in s390_in_function_epilogue_p on why this is + /* See the comment in s390_stack_frame_destroyed_p on why this is not completely reliable ... */ - if (s390_in_function_epilogue_p (gdbarch, get_frame_pc (this_frame))) + if (s390_stack_frame_destroyed_p (gdbarch, get_frame_pc (this_frame))) { memset (&data, 0, sizeof (data)); size = 0; @@ -3030,7 +3030,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, s390_breakpoint_from_pc); set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, s390_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, s390_stack_frame_destroyed_p); set_gdbarch_num_regs (gdbarch, S390_NUM_REGS); set_gdbarch_sp_regnum (gdbarch, S390_SP_REGNUM); diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c index dd438f9..8ab3d0f 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -738,7 +738,7 @@ score3_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) } static int -score7_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc) +score7_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc) { inst_t *inst = score7_fetch_inst (gdbarch, cur_pc, NULL); @@ -762,7 +762,7 @@ score7_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc) } static int -score3_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc) +score3_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc) { CORE_ADDR pc = cur_pc; inst_t *inst @@ -1494,8 +1494,8 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) case bfd_mach_score7: set_gdbarch_breakpoint_from_pc (gdbarch, score7_breakpoint_from_pc); set_gdbarch_skip_prologue (gdbarch, score7_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, - score7_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, + score7_stack_frame_destroyed_p); set_gdbarch_register_name (gdbarch, score7_register_name); set_gdbarch_num_regs (gdbarch, SCORE7_NUM_REGS); /* Core file support. */ @@ -1506,8 +1506,8 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) case bfd_mach_score3: set_gdbarch_breakpoint_from_pc (gdbarch, score3_breakpoint_from_pc); set_gdbarch_skip_prologue (gdbarch, score3_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, - score3_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, + score3_stack_frame_destroyed_p); set_gdbarch_register_name (gdbarch, score3_register_name); set_gdbarch_num_regs (gdbarch, SCORE3_NUM_REGS); break; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index d91a292..e17887b 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2050,11 +2050,14 @@ static const struct frame_unwind sh_stub_unwind = sh_stub_unwind_sniffer }; -/* The epilogue is defined here as the area at the end of a function, +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). + + The epilogue is defined here as the area at the end of a function, either on the `ret' instruction itself or after an instruction which destroys the function's stack frame. */ static int -sh_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +sh_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR func_addr = 0, func_end = 0; @@ -2294,7 +2297,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_dummy_id (gdbarch, sh_dummy_id); frame_base_set_default (gdbarch, &sh_frame_base); - set_gdbarch_in_function_epilogue_p (gdbarch, sh_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, sh_stack_frame_destroyed_p); dwarf2_frame_set_init_reg (gdbarch, sh_dwarf2_frame_init_reg); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 7eb3b18..9e48772 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -452,10 +452,10 @@ sparc32_pseudo_register_write (struct gdbarch *gdbarch, regcache_raw_write (regcache, regnum + 1, buf + 4); } -/* Implement "in_function_epilogue_p". */ +/* Implement "stack_frame_destroyed_p". */ int -sparc_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { /* This function must return true if we are one instruction after an instruction that destroyed the stack frame of the current diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h index 13f0bb2..0a73e60 100644 --- a/gdb/sparc-tdep.h +++ b/gdb/sparc-tdep.h @@ -194,7 +194,7 @@ extern struct sparc_frame_cache * sparc32_frame_cache (struct frame_info *this_frame, void **this_cache); extern int - sparc_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc); + sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc); diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index a1966c5..da66d3e 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -1211,7 +1211,7 @@ sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) (gdbarch, default_stabs_argument_has_addr); set_gdbarch_skip_prologue (gdbarch, sparc64_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, sparc_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, sparc_stack_frame_destroyed_p); /* Hook in the DWARF CFI frame unwinder. */ dwarf2_frame_set_init_reg (gdbarch, sparc64_dwarf2_frame_init_reg); diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index fe8f1d9..1a9a4bb 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -899,7 +899,7 @@ spu_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, limit for the size of an epilogue. */ static int -spu_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +spu_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR scan_pc, func_start, func_end, epilogue_start, epilogue_end; @@ -2785,7 +2785,7 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_virtual_frame_pointer (gdbarch, spu_virtual_frame_pointer); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_skip_prologue (gdbarch, spu_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, spu_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, spu_stack_frame_destroyed_p); /* Cell/B.E. cross-architecture unwinder support. */ frame_unwind_prepend_unwinder (gdbarch, &spu2ppu_unwind); diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c index ae3138e..944686b 100644 --- a/gdb/tic6x-tdep.c +++ b/gdb/tic6x-tdep.c @@ -1122,10 +1122,10 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, return sp; } -/* This is the implementation of gdbarch method in_function_epilogue_p. */ +/* This is the implementation of gdbarch method stack_frame_destroyed_p. */ static int -tic6x_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +tic6x_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { unsigned long inst = tic6x_fetch_instruction (gdbarch, pc); /* Normally, the epilogue is composed by instruction `b .S2 b3'. */ @@ -1328,7 +1328,7 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_get_longjmp_target (gdbarch, tic6x_get_longjmp_target); - set_gdbarch_in_function_epilogue_p (gdbarch, tic6x_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, tic6x_stack_frame_destroyed_p); set_gdbarch_return_in_first_hidden_param_p (gdbarch, tic6x_return_in_first_hidden_param_p); diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index befab56..b22c79a 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -771,10 +771,10 @@ tilegx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) NULL, NULL); } -/* This is the implementation of gdbarch method in_function_epilogue_p. */ +/* This is the implementation of gdbarch method stack_frame_destroyed_p. */ static int -tilegx_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +tilegx_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr = 0, func_end = 0; @@ -1051,8 +1051,8 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, tilegx_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, - tilegx_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, + tilegx_stack_frame_destroyed_p); /* Map debug registers into internal register numbers. */ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, tilegx_dwarf2_reg_to_regnum); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 9692742..ae2a0f2 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -453,11 +453,14 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) return (CORE_ADDR) pc; } -/* The epilogue is defined here as the area at the end of a function, +/* Returns true if we're at a point where the stack frame has already been + destroyed (such as in a function's epilogue). + + The epilogue is defined here as the area at the end of a function, either on the `ret' instruction itself or after an instruction which destroys the function's stack frame. */ static int -xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +xstormy16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR func_addr = 0, func_end = 0; @@ -835,8 +838,8 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame_base_set_default (gdbarch, &xstormy16_frame_base); set_gdbarch_skip_prologue (gdbarch, xstormy16_skip_prologue); - set_gdbarch_in_function_epilogue_p (gdbarch, - xstormy16_in_function_epilogue_p); + set_gdbarch_stack_frame_destroyed_p (gdbarch, + xstormy16_stack_frame_destroyed_p); /* These values and methods are used when gdb calls a target function. */ set_gdbarch_push_dummy_call (gdbarch, xstormy16_push_dummy_call);