diff options
author | Martin Galvan <martin.galvan@tallertechnologies.com> | 2015-05-26 11:59:17 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2015-05-26 12:07:59 +0100 |
commit | c9cf6e20c6988a7e510cfe788b1b2cfe4d0d04a7 (patch) | |
tree | e85959002942a5ae2bf83aaf38e833538cf96776 /gdb | |
parent | 4de0562a4c69fef4952aa7e19d7bda359f02e8b4 (diff) | |
download | fsf-binutils-gdb-c9cf6e20c6988a7e510cfe788b1b2cfe4d0d04a7.zip fsf-binutils-gdb-c9cf6e20c6988a7e510cfe788b1b2cfe4d0d04a7.tar.gz fsf-binutils-gdb-c9cf6e20c6988a7e510cfe788b1b2cfe4d0d04a7.tar.bz2 |
Rename in_function_epilogue_p to stack_frame_destroyed_p
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:
2015-05-26 Martin Galvan <martin.galvan@tallertechnologies.com>
* amd64-tdep.c: Replace in_function_epilogue_p with
stack_frame_destroyed_p throughout.
* arch-utils.c: Ditto.
* arch-utils.h: Ditto.
* arm-tdep.c: Ditto.
* breakpoint.c: Ditto.
* gdbarch.sh: Ditto.
* hppa-tdep.c: Ditto.
* i386-tdep.c: Ditto.
* mips-tdep.c: Ditto.
* nios2-tdep.c: Ditto.
* rs6000-tdep.c: Ditto.
* s390-linux-tdep.c: Ditto.
* score-tdep.c: Ditto.
* sh-tdep.c: Ditto.
* sparc-tdep.c: Ditto.
* sparc-tdep.h: Ditto.
* sparc64-tdep.c: Ditto.
* spu-tdep.c: Ditto.
* tic6x-tdep.c: Ditto.
* tilegx-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
* gdbarch.c, gdbarch.h: Re-generated.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 26 | ||||
-rw-r--r-- | gdb/amd64-tdep.c | 10 | ||||
-rw-r--r-- | gdb/arch-utils.c | 2 | ||||
-rw-r--r-- | gdb/arch-utils.h | 4 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 16 | ||||
-rw-r--r-- | gdb/breakpoint.c | 11 | ||||
-rw-r--r-- | gdb/gdbarch.c | 24 | ||||
-rw-r--r-- | gdb/gdbarch.h | 8 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 4 | ||||
-rw-r--r-- | gdb/hppa-tdep.c | 11 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 10 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 35 | ||||
-rw-r--r-- | gdb/nios2-tdep.c | 6 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 6 | ||||
-rw-r--r-- | gdb/s390-linux-tdep.c | 11 | ||||
-rw-r--r-- | gdb/score-tdep.c | 16 | ||||
-rw-r--r-- | gdb/sh-tdep.c | 9 | ||||
-rw-r--r-- | gdb/sparc-tdep.c | 4 | ||||
-rw-r--r-- | gdb/sparc-tdep.h | 2 | ||||
-rw-r--r-- | gdb/sparc64-tdep.c | 2 | ||||
-rw-r--r-- | gdb/spu-tdep.c | 7 | ||||
-rw-r--r-- | gdb/tic6x-tdep.c | 6 | ||||
-rw-r--r-- | gdb/tilegx-tdep.c | 7 | ||||
-rw-r--r-- | gdb/xstormy16-tdep.c | 11 |
24 files changed, 146 insertions, 102 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f55b9c4..96d014b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,29 @@ +2015-05-26 Martin Galvan <martin.galvan@tallertechnologies.com> + + * amd64-tdep.c: Replace in_function_epilogue_p with + stack_frame_destroyed_p throughout. + * arch-utils.c: Ditto. + * arch-utils.h: Ditto. + * arm-tdep.c: Ditto. + * breakpoint.c: Ditto. + * gdbarch.sh: Ditto. + * hppa-tdep.c: Ditto. + * i386-tdep.c: Ditto. + * mips-tdep.c: Ditto. + * nios2-tdep.c: Ditto. + * rs6000-tdep.c: Ditto. + * s390-linux-tdep.c: Ditto. + * score-tdep.c: Ditto. + * sh-tdep.c: Ditto. + * sparc-tdep.c: Ditto. + * sparc-tdep.h: Ditto. + * sparc64-tdep.c: Ditto. + * spu-tdep.c: Ditto. + * tic6x-tdep.c: Ditto. + * tilegx-tdep.c: Ditto. + * xstormy16-tdep.c: Ditto. + * gdbarch.c, gdbarch.h: Re-generated. + 2015-05-22 Andrew Burgess <andrew.burgess@embecosm.com> * NEWS: Mention 'tui enable' and 'tui disable'. diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 461b701..5e63b5e 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -2719,12 +2719,14 @@ 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 +/* Implement the stack_frame_destroyed_p gdbarch method. + + 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; @@ -2748,8 +2750,8 @@ 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), - get_frame_pc (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 e1c8ab0..8c3eb7c 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -127,7 +127,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 ed3bec9..1be323b 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -104,8 +104,8 @@ 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, - CORE_ADDR pc); +extern int generic_stack_frame_destroyed_p (struct gdbarch *gdbarch, + CORE_ADDR pc); /* By default, registers are not convertible. */ extern int generic_convert_register_p (struct gdbarch *gdbarch, int regnum, diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 8181f25..638855b 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -3223,11 +3223,10 @@ 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. */ +/* Implement the stack_frame_destroyed_p gdbarch method. */ 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; @@ -3334,11 +3333,10 @@ 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. */ +/* Implement the stack_frame_destroyed_p gdbarch method. */ 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; @@ -3346,7 +3344,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; @@ -10356,8 +10354,8 @@ 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 has been destroyed. */ + 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 a3531a0..657c58e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1837,10 +1837,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 - properly, so do not attempt to recreate locations at this + /* If we're at a point where the stack has been destroyed + (e.g. in a function epilogue), unwinding may not work + properly. 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 @@ -5037,7 +5038,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 @@ -5046,7 +5047,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 97874c9..821ad5e 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; gdbarch_make_symbol_special_ftype *make_symbol_special; @@ -402,7 +402,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->coff_make_msymbol_special = default_coff_make_msymbol_special; gdbarch->make_symbol_special = default_make_symbol_special; gdbarch->adjust_dwarf2_addr = default_adjust_dwarf2_addr; @@ -580,7 +580,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, has predicate. */ /* Skip verify of coff_make_msymbol_special, invalid_p == 0 */ /* Skip verify of make_symbol_special, invalid_p == 0 */ @@ -1020,8 +1020,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)); @@ -3110,20 +3110,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; } int diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index c94c19c..6f9e844 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -685,7 +685,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 @@ -693,9 +693,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); /* Process an ELF symbol in the minimal symbol table in a backend-specific way. Normally this hook is supposed to do nothing, however if required, diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 0f303a4..668e3eb 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 # Process an ELF symbol in the minimal symbol table in a backend-specific # way. Normally this hook is supposed to do nothing, however if required, # then this hook can be used to apply tranformations to symbols that are diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 8964ec0..01a7c80 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -560,13 +560,16 @@ find_unwind_entry (CORE_ADDR pc) return NULL; } -/* The epilogue is defined here as the area either on the `bv' instruction +/* Implement the stack_frame_destroyed_p gdbarch method. + + 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; @@ -3135,8 +3138,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, + hppa_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 0c7eb5a..b4ffe1b 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2178,12 +2178,14 @@ 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 +/* Implement the stack_frame_destroyed_p gdbarch method. + + 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; @@ -2207,8 +2209,8 @@ 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), - get_frame_pc (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 6e8ccd6..e0706db 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -6693,10 +6693,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. */ +/* Implement the stack_frame_destroyed_p gdbarch method (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; @@ -6731,11 +6732,11 @@ 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. */ +/* Implement the stack_frame_destroyed_p gdbarch method (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; @@ -6832,10 +6833,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. */ +/* Implement the stack_frame_destroyed_p gdbarch method (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; @@ -6872,17 +6874,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, +/* Implement the stack_frame_destroyed_p gdbarch method. + + 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 @@ -8843,7 +8848,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 988b9fc..1968a88 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -658,10 +658,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; @@ -1775,7 +1775,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 a125000..eb40430 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -934,10 +934,10 @@ rs6000_in_function_epilogue_frame_p (struct frame_info *curfrm, return 0; } -/* Implementation of gdbarch_in_function_epilogue_p. */ +/* Implement the stack_frame_destroyed_p gdbarch method. */ static int -rs6000_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +rs6000_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) { return rs6000_in_function_epilogue_frame_p (get_current_frame (), gdbarch, pc); @@ -5890,7 +5890,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 edc0da1..0650c27 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -1487,10 +1487,9 @@ 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. */ +/* Implmement the stack_frame_destroyed_p gdbarch method. */ 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; @@ -1838,9 +1837,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; @@ -3220,7 +3219,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 9cd5038..ef9336e 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -737,8 +737,10 @@ score3_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) return pc; } +/* Implement the stack_frame_destroyed_p gdbarch method. */ + 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); @@ -761,8 +763,10 @@ score7_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc) return 0; } +/* Implement the stack_frame_destroyed_p gdbarch method. */ + 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 +1498,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 +1510,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 82cf2f4..6f66f0e 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, +/* Implement the stack_frame_destroyed_p gdbarch method. + + 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 aae4604..5c77784 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 the stack_frame_destroyed_p gdbarch method. */ 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 b216529..905d213 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 eba8101..4978863 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 7e05834..e2cd91f 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -881,8 +881,7 @@ spu_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, } } -/* Return true if we are in the function's epilogue, i.e. after the - instruction that destroyed the function's stack frame. +/* Implement the stack_frame_destroyed_p gdbarch method. 1) scan forward from the point of execution: a) If you find an instruction that modifies the stack pointer @@ -899,7 +898,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 +2784,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 140ffbc..2603f91 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 7c5eea7..18b1832 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,7 @@ 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 135e43a..4faad2e 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, +/* Implement the stack_frame_destroyed_p gdbarch method. + + 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); |