From 52f729a7241c0187f9ed31542d7e9a1ec98f63b7 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Fri, 15 Jun 2007 22:39:52 +0000 Subject: [PATCH] * gdbarch.sh (skip_trampoline_code): Add FRAME argument. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (generic_skip_trampoline_code): Add FRAME argument. * arch-utils.h (generic_skip_trampoline_code): Likewise. * infrun.c (handle_inferior_event): Pass current frame to gdbarch_skip_trampoline_code and skip_language_trampoline. * language.c (unk_lang_trampoline): Add FRAME argument. (skip_language_trampoline): Add FRAME argument. Pass it to skip_trampoline callback. * language.h: Add forward declaration of struct frame_info. (struct language_defn): Add FRAME argument to skip_trampoline. (skip_language_trampoline): Add FRAME argument. * cp-abi.c (cplus_skip_trampoline): Add FRAME argument. Pass it to skip_trampoline callback. * cp-abi.h: Add forward declaration of struct frame_info. (cplus_skip_trampoline): Add FRAME argument. (struct cp_abi_ops): Add FRAME argument to skip_trampoline callback. * gnu-v3-abi.c (gnuv3_skip_trampoline): Add FRAME argument. Pass it to gdbarch_skip_trampoline_code. * objc-lang.c (objc_skip_trampoline): Add FRAME argument. Pass it to gdbarch_skip_trampoline_code. * minsyms.c (find_solib_trampoline_target): Add FRAME argument. * symtab.h (find_solib_trampoline_target): Likewise. * obsd-tdep.c (obsd_skip_solib_resolver): Pass current frame to find_solib_trampoline_target. * arm-tdep.c (arm_skip_stub): Add FRAME argument. Read registers from FRAME instead of calling read_register. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code): Add FRAME argument. Read registers from FRAME instead of using read_register. * hppa-tdep.c (hppa_skip_trampoline_code): Likewise. * hppa-tdep.h (hppa_skip_trampoline_code): Add FRAME argument. * i386-cygwin-tdep.c (i386_cygwin_skip_trampoline_code): Add FRAME argument. * m32c-tdep.c (m32c_skip_trampoline_code): Add FRAME argument. * mips-tdep.c (mips_skip_trampoline_code): Add FRAME argument. Read registers from FRAME instead of using read_signed_register. * ppc-linux-tdep.c (ppc_linux_skip_trampoline_code): Add FRAME argument. (ppc64_standard_linkage_target): Likewise. Read registers from FRAME instead of using read_register. (ppc64_skip_trampoline_code): Add FRAME argument. Pass it to ppc64_standard_linkage_target. * rs6000-tdep.c (rs6000_skip_trampoline_code): Add FRAME argument. Pass it to find_solib_trampoline_target. Read registers from FRAME instead of using read_register. * xstormy16-tdep.c (xstormy16_skip_trampoline_code): Add FRAME argument. --- gdb/ChangeLog | 60 +++++++++++++++++++++++++++++++++++++++++- gdb/arch-utils.c | 2 +- gdb/arch-utils.h | 3 ++- gdb/arm-tdep.c | 4 +-- gdb/cp-abi.c | 4 +-- gdb/cp-abi.h | 5 ++-- gdb/gdbarch.c | 4 +-- gdb/gdbarch.h | 4 +-- gdb/gdbarch.sh | 2 +- gdb/gnu-v3-abi.c | 7 ++--- gdb/hppa-hpux-tdep.c | 19 +++++++------ gdb/hppa-tdep.c | 8 +++--- gdb/hppa-tdep.h | 2 +- gdb/i386-cygwin-tdep.c | 2 +- gdb/infrun.c | 10 ++++--- gdb/language.c | 8 +++--- gdb/language.h | 5 ++-- gdb/m32c-tdep.c | 2 +- gdb/minsyms.c | 2 +- gdb/mips-tdep.c | 10 +++---- gdb/objc-lang.c | 7 ++--- gdb/obsd-tdep.c | 2 +- gdb/ppc-linux-tdep.c | 15 ++++++----- gdb/rs6000-tdep.c | 6 ++--- gdb/symtab.h | 2 +- gdb/xstormy16-tdep.c | 2 +- 26 files changed, 134 insertions(+), 63 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 94c0223bbf..1dc943077b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,62 @@ +2007-06-15 Ulrich Weigand + + * gdbarch.sh (skip_trampoline_code): Add FRAME argument. + * gdbarch.c, gdbarch.h: Regenerate. + * arch-utils.c (generic_skip_trampoline_code): Add FRAME argument. + * arch-utils.h (generic_skip_trampoline_code): Likewise. + * infrun.c (handle_inferior_event): Pass current frame to + gdbarch_skip_trampoline_code and skip_language_trampoline. + + * language.c (unk_lang_trampoline): Add FRAME argument. + (skip_language_trampoline): Add FRAME argument. Pass it to + skip_trampoline callback. + * language.h: Add forward declaration of struct frame_info. + (struct language_defn): Add FRAME argument to skip_trampoline. + (skip_language_trampoline): Add FRAME argument. + * cp-abi.c (cplus_skip_trampoline): Add FRAME argument. Pass it + to skip_trampoline callback. + * cp-abi.h: Add forward declaration of struct frame_info. + (cplus_skip_trampoline): Add FRAME argument. + (struct cp_abi_ops): Add FRAME argument to skip_trampoline callback. + * gnu-v3-abi.c (gnuv3_skip_trampoline): Add FRAME argument. Pass it + to gdbarch_skip_trampoline_code. + * objc-lang.c (objc_skip_trampoline): Add FRAME argument. Pass it + to gdbarch_skip_trampoline_code. + + * minsyms.c (find_solib_trampoline_target): Add FRAME argument. + * symtab.h (find_solib_trampoline_target): Likewise. + * obsd-tdep.c (obsd_skip_solib_resolver): Pass current frame to + find_solib_trampoline_target. + + * arm-tdep.c (arm_skip_stub): Add FRAME argument. Read registers + from FRAME instead of calling read_register. + + * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code): Add FRAME + argument. Read registers from FRAME instead of using read_register. + * hppa-tdep.c (hppa_skip_trampoline_code): Likewise. + * hppa-tdep.h (hppa_skip_trampoline_code): Add FRAME argument. + + * i386-cygwin-tdep.c (i386_cygwin_skip_trampoline_code): Add FRAME + argument. + + * m32c-tdep.c (m32c_skip_trampoline_code): Add FRAME argument. + + * mips-tdep.c (mips_skip_trampoline_code): Add FRAME argument. Read + registers from FRAME instead of using read_signed_register. + + * ppc-linux-tdep.c (ppc_linux_skip_trampoline_code): Add FRAME + argument. + (ppc64_standard_linkage_target): Likewise. Read registers from FRAME + instead of using read_register. + (ppc64_skip_trampoline_code): Add FRAME argument. Pass it to + ppc64_standard_linkage_target. + * rs6000-tdep.c (rs6000_skip_trampoline_code): Add FRAME argument. + Pass it to find_solib_trampoline_target. Read registers from FRAME + instead of using read_register. + + * xstormy16-tdep.c (xstormy16_skip_trampoline_code): Add FRAME + argument. + 2007-06-15 Ulrich Weigand * gdbarch.sh (software_single_step): Replace REGCACHE argument by @@ -65,7 +124,6 @@ * spu-tdep.c (spu_software_single_step): Replace REGCACHE argument by FRAME. Read registers from FRAME instead of REGCACHE. - 2007-06-15 Ulrich Weigand * arm-tdep.c (arm_print_float_info): Use register value from FRAME diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 4a46e3535d..50768e93d6 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -96,7 +96,7 @@ legacy_register_sim_regno (int regnum) } CORE_ADDR -generic_skip_trampoline_code (CORE_ADDR pc) +generic_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { return 0; } diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 625a37e6c8..8520b33326 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -77,7 +77,8 @@ int cannot_register_not (int regnum); extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer; -extern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc); +extern CORE_ADDR generic_skip_trampoline_code (struct frame_info *frame, + CORE_ADDR pc); extern CORE_ADDR generic_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index fc7c6bd202..0935add6a1 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2380,7 +2380,7 @@ arm_in_call_stub (CORE_ADDR pc, char *name) are r0-r9, sl, fp, ip, sp, and lr. */ CORE_ADDR -arm_skip_stub (CORE_ADDR pc) +arm_skip_stub (struct frame_info *frame, CORE_ADDR pc) { char *name; CORE_ADDR start_addr; @@ -2402,7 +2402,7 @@ arm_skip_stub (CORE_ADDR pc) for (regno = 0; regno <= 14; regno++) if (strcmp (&name[10], table[regno]) == 0) - return read_register (regno); + return get_frame_register_unsigned (frame, regno); } return 0; /* not a stub */ diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c index 7bc1552597..2ca5a0bf63 100644 --- a/gdb/cp-abi.c +++ b/gdb/cp-abi.c @@ -122,11 +122,11 @@ cplus_make_method_ptr (gdb_byte *contents, CORE_ADDR value, int is_virtual) } CORE_ADDR -cplus_skip_trampoline (CORE_ADDR stop_pc) +cplus_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) { if (current_cp_abi.skip_trampoline == NULL) return 0; - return (*current_cp_abi.skip_trampoline) (stop_pc); + return (*current_cp_abi.skip_trampoline) (frame, stop_pc); } struct value * diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h index 91d89b340b..04c6a7d360 100644 --- a/gdb/cp-abi.h +++ b/gdb/cp-abi.h @@ -31,6 +31,7 @@ struct fn_field; struct type; struct value; struct ui_file; +struct frame_info; /* The functions here that attempt to determine what sort of thing a mangled name refers to may well be revised in the future. It would @@ -173,7 +174,7 @@ void cplus_make_method_ptr (gdb_byte *CONTENTS, CORE_ADDR address, /* Determine if we are currently in a C++ thunk. If so, get the address of the routine we are thunking to and continue to there instead. */ -CORE_ADDR cplus_skip_trampoline (CORE_ADDR stop_pc); +CORE_ADDR cplus_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc); struct cp_abi_ops { @@ -197,7 +198,7 @@ struct cp_abi_ops int (*method_ptr_size) (void); void (*make_method_ptr) (gdb_byte *, CORE_ADDR, int); struct value * (*method_ptr_to_value) (struct value **, struct value *); - CORE_ADDR (*skip_trampoline) (CORE_ADDR); + CORE_ADDR (*skip_trampoline) (struct frame_info *, CORE_ADDR); }; diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index df76766847..a7fa046abf 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -2769,13 +2769,13 @@ set_gdbarch_print_insn (struct gdbarch *gdbarch, } CORE_ADDR -gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc) +gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR pc) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->skip_trampoline_code != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_trampoline_code called\n"); - return gdbarch->skip_trampoline_code (pc); + return gdbarch->skip_trampoline_code (frame, pc); } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index dcaf5eb442..92fa95b55b 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -734,8 +734,8 @@ extern void set_gdbarch_print_insn (struct gdbarch *gdbarch, gdbarch_print_insn_ #define TARGET_PRINT_INSN(vma, info) (gdbarch_print_insn (current_gdbarch, vma, info)) #endif -typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (CORE_ADDR pc); -extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc); +typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (struct frame_info *frame, CORE_ADDR pc); +extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR pc); extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code); /* If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 1f7d150629..ee7669be7d 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -616,7 +616,7 @@ M::int:single_step_through_delay:struct frame_info *frame:frame # FIXME: cagney/2003-08-28: Need to find a better way of selecting the # disassembler. Perhaps objdump can handle it? f:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, struct disassemble_info *info:vma, info::0: -f::CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc::generic_skip_trampoline_code::0 +f::CORE_ADDR:skip_trampoline_code:struct frame_info *frame, CORE_ADDR pc:frame, pc::generic_skip_trampoline_code::0 # If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 0f9f420844..4914b4692c 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -679,14 +679,15 @@ gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr) of the routine we are thunking to and continue to there instead. */ static CORE_ADDR -gnuv3_skip_trampoline (CORE_ADDR stop_pc) +gnuv3_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) { CORE_ADDR real_stop_pc, method_stop_pc; struct minimal_symbol *thunk_sym, *fn_sym; struct obj_section *section; char *thunk_name, *fn_name; - real_stop_pc = gdbarch_skip_trampoline_code (current_gdbarch, stop_pc); + real_stop_pc = gdbarch_skip_trampoline_code + (current_gdbarch, frame, stop_pc); if (real_stop_pc == 0) real_stop_pc = stop_pc; @@ -710,7 +711,7 @@ gnuv3_skip_trampoline (CORE_ADDR stop_pc) method_stop_pc = SYMBOL_VALUE_ADDRESS (fn_sym); real_stop_pc = gdbarch_skip_trampoline_code - (current_gdbarch, method_stop_pc); + (current_gdbarch, frame, method_stop_pc); if (real_stop_pc == 0) real_stop_pc = method_stop_pc; diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index 1510d87edc..195d907804 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -299,7 +299,7 @@ hppa_hpux_in_solib_return_trampoline (CORE_ADDR pc, char *name) used in dynamic executables. */ static CORE_ADDR -hppa_hpux_skip_trampoline_code (CORE_ADDR pc) +hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { long orig_pc = pc; long prev_inst, curr_inst, loc; @@ -310,7 +310,7 @@ hppa_hpux_skip_trampoline_code (CORE_ADDR pc) of the function. So we may have to do something special. */ if (pc == hppa_symbol_address("$$dyncall")) { - pc = (CORE_ADDR) read_register (22); + pc = (CORE_ADDR) get_frame_register_unsigned (frame, 22); /* If bit 30 (counting from the left) is on, then pc is the address of the PLT entry for this function, not the address of the function @@ -321,12 +321,12 @@ hppa_hpux_skip_trampoline_code (CORE_ADDR pc) } if (pc == hppa_symbol_address("$$dyncall_external")) { - pc = (CORE_ADDR) read_register (22); + pc = (CORE_ADDR) get_frame_register_unsigned (frame, 22); pc = (CORE_ADDR) read_memory_integer (pc & ~0x3, gdbarch_ptr_bit (current_gdbarch) / 8); } else if (pc == hppa_symbol_address("_sr4export")) - pc = (CORE_ADDR) (read_register (22)); + pc = (CORE_ADDR) get_frame_register_unsigned (frame, 22); /* Get the unwind descriptor corresponding to PC, return zero if no unwind was found. */ @@ -500,8 +500,11 @@ hppa_hpux_skip_trampoline_code (CORE_ADDR pc) /* Yup. See if the previous instruction loaded rp from sp - 8. */ if (prev_inst == 0x4bc23ff1) - return (read_memory_integer - (read_register (HPPA_SP_REGNUM) - 8, 4)) & ~0x3; + { + CORE_ADDR sp; + sp = get_frame_register_unsigned (frame, HPPA_SP_REGNUM); + return read_memory_integer (sp - 8, 4) & ~0x3; + } else { warning (_("Unable to find restore of %%rp before bv (%%rp).")); @@ -515,7 +518,7 @@ hppa_hpux_skip_trampoline_code (CORE_ADDR pc) else if ((curr_inst & 0xffe0f000) == 0xe840d000) { return (read_memory_integer - (read_register (HPPA_SP_REGNUM) - 24, + (get_frame_register_unsigned (frame, HPPA_SP_REGNUM) - 24, gdbarch_ptr_bit (current_gdbarch) / 8)) & ~0x3; } @@ -528,7 +531,7 @@ hppa_hpux_skip_trampoline_code (CORE_ADDR pc) I guess we could check for the previous instruction being mtsp %r1,%sr0 if we want to do sanity checking. */ return (read_memory_integer - (read_register (HPPA_SP_REGNUM) - 24, + (get_frame_register_unsigned (frame, HPPA_SP_REGNUM) - 24, gdbarch_ptr_bit (current_gdbarch) / 8)) & ~0x3; } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index c46d977b5c..1810a6091c 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -2941,7 +2941,7 @@ hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name) systems: $$dyncall, import stubs and PLT stubs. */ CORE_ADDR -hppa_skip_trampoline_code (CORE_ADDR pc) +hppa_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { unsigned int insn[HPPA_MAX_INSN_PATTERN_LEN]; int dp_rel; @@ -2949,7 +2949,7 @@ hppa_skip_trampoline_code (CORE_ADDR pc) /* $$dyncall handles both PLABELs and direct addresses. */ if (hppa_in_dyncall (pc)) { - pc = read_register (HPPA_R0_REGNUM + 22); + pc = get_frame_register_unsigned (frame, HPPA_R0_REGNUM + 22); /* PLABELs have bit 30 set; if it's a PLABEL, then dereference it. */ if (pc & 0x2) @@ -2965,9 +2965,9 @@ hppa_skip_trampoline_code (CORE_ADDR pc) pc = hppa_extract_21 (insn[0]) + hppa_extract_14 (insn[1]); if (dp_rel) - pc += read_register (HPPA_DP_REGNUM); + pc += get_frame_register_unsigned (frame, HPPA_DP_REGNUM); else - pc += read_register (HPPA_R0_REGNUM + 19); + pc += get_frame_register_unsigned (frame, HPPA_R0_REGNUM + 19); /* fallthrough */ } diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h index 25fd2f333e..f469afc657 100644 --- a/gdb/hppa-tdep.h +++ b/gdb/hppa-tdep.h @@ -246,6 +246,6 @@ extern struct hppa_objfile_private * hppa_init_objfile_priv_data (struct objfile *objfile); extern int hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name); -extern CORE_ADDR hppa_skip_trampoline_code (CORE_ADDR pc); +extern CORE_ADDR hppa_skip_trampoline_code (struct frame_info *, CORE_ADDR pc); #endif /* hppa-tdep.h */ diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c index a444e5a725..a999d39a7a 100644 --- a/gdb/i386-cygwin-tdep.c +++ b/gdb/i386-cygwin-tdep.c @@ -27,7 +27,7 @@ #include "i386-tdep.h" static CORE_ADDR -i386_cygwin_skip_trampoline_code (CORE_ADDR pc) +i386_cygwin_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { return i386_pe_skip_trampoline_code (pc, NULL); } diff --git a/gdb/infrun.c b/gdb/infrun.c index ae530b77e2..1eea281ddb 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2456,9 +2456,10 @@ process_event_stop_test: function. That's what tells us (a) whether we want to step into it at all, and (b) what prologue we want to run to the end of, if we do step into it. */ - real_stop_pc = skip_language_trampoline (stop_pc); + real_stop_pc = skip_language_trampoline (get_current_frame (), stop_pc); if (real_stop_pc == 0) - real_stop_pc = gdbarch_skip_trampoline_code (current_gdbarch, stop_pc); + real_stop_pc = gdbarch_skip_trampoline_code + (current_gdbarch, get_current_frame (), stop_pc); if (real_stop_pc != 0) ecs->stop_func_start = real_stop_pc; @@ -2520,8 +2521,9 @@ process_event_stop_test: stop_pc, ecs->stop_func_name)) { /* Determine where this trampoline returns. */ - CORE_ADDR real_stop_pc = gdbarch_skip_trampoline_code - (current_gdbarch, stop_pc); + CORE_ADDR real_stop_pc; + real_stop_pc = gdbarch_skip_trampoline_code + (current_gdbarch, get_current_frame (), stop_pc); if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: stepped into solib return tramp\n"); diff --git a/gdb/language.c b/gdb/language.c index d1efac7b3e..16e385155f 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -77,7 +77,7 @@ static void unk_lang_print_type (struct type *, char *, struct ui_file *, static int unk_lang_value_print (struct value *, struct ui_file *, int, enum val_prettyprint); -static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc); +static CORE_ADDR unk_lang_trampoline (struct frame_info *, CORE_ADDR pc); /* Forward declaration */ extern const struct language_defn unknown_language_defn; @@ -1005,7 +1005,7 @@ add_language (const struct language_defn *lang) Return the result from the first that returns non-zero, or 0 if all `fail'. */ CORE_ADDR -skip_language_trampoline (CORE_ADDR pc) +skip_language_trampoline (struct frame_info *frame, CORE_ADDR pc) { int i; @@ -1013,7 +1013,7 @@ skip_language_trampoline (CORE_ADDR pc) { if (languages[i]->skip_trampoline) { - CORE_ADDR real_pc = (languages[i]->skip_trampoline) (pc); + CORE_ADDR real_pc = (languages[i]->skip_trampoline) (frame, pc); if (real_pc) return real_pc; } @@ -1130,7 +1130,7 @@ unk_lang_value_print (struct value *val, struct ui_file *stream, int format, error (_("internal error - unimplemented function unk_lang_value_print called.")); } -static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc) +static CORE_ADDR unk_lang_trampoline (struct frame_info *frame, CORE_ADDR pc) { return 0; } diff --git a/gdb/language.h b/gdb/language.h index b40f855445..f81064358e 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -29,6 +29,7 @@ /* Forward decls for prototypes */ struct value; struct objfile; +struct frame_info; struct expression; struct ui_file; @@ -221,7 +222,7 @@ struct language_defn If that PC falls in a trampoline belonging to this language, return the address of the first pc in the real function, or 0 if it isn't a language tramp for this language. */ - CORE_ADDR (*skip_trampoline) (CORE_ADDR pc); + CORE_ADDR (*skip_trampoline) (struct frame_info *, CORE_ADDR); /* Now come some hooks for lookup_symbol. */ @@ -453,7 +454,7 @@ extern enum language get_frame_language (void); /* In stack.c */ /* Check for a language-specific trampoline. */ -extern CORE_ADDR skip_language_trampoline (CORE_ADDR pc); +extern CORE_ADDR skip_language_trampoline (struct frame_info *, CORE_ADDR pc); /* Return demangled language symbol, or NULL. */ extern char *language_demangle (const struct language_defn *current_language, diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 02b0541af8..d66e0d9554 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -2332,7 +2332,7 @@ m32c_return_value (struct gdbarch *gdbarch, code sequence seems more fragile. */ static CORE_ADDR -m32c_skip_trampoline_code (CORE_ADDR stop_pc) +m32c_skip_trampoline_code (struct frame_info *frame, CORE_ADDR stop_pc) { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); diff --git a/gdb/minsyms.c b/gdb/minsyms.c index e4b0356b86..45f0c2f301 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1047,7 +1047,7 @@ lookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc) a duplicate function in case this matters someday. */ CORE_ADDR -find_solib_trampoline_target (CORE_ADDR pc) +find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) { struct objfile *objfile; struct minimal_symbol *msymbol; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index dfa10ab460..da46b35208 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -4603,7 +4603,7 @@ mips_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) gory details. */ static CORE_ADDR -mips_skip_trampoline_code (CORE_ADDR pc) +mips_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { char *name; CORE_ADDR start_addr; @@ -4616,14 +4616,14 @@ mips_skip_trampoline_code (CORE_ADDR pc) target PC is in $31 ($ra). */ if (strcmp (name, "__mips16_ret_sf") == 0 || strcmp (name, "__mips16_ret_df") == 0) - return read_signed_register (MIPS_RA_REGNUM); + return get_frame_register_signed (frame, MIPS_RA_REGNUM); if (strncmp (name, "__mips16_call_stub_", 19) == 0) { /* If the PC is in __mips16_call_stub_{1..10}, this is a call stub and the target PC is in $2. */ if (name[19] >= '0' && name[19] <= '9') - return read_signed_register (2); + return get_frame_register_signed (frame, 2); /* If the PC at the start of __mips16_call_stub_{s,d}f_{0..10}, i.e. before the jal instruction, this is effectively a call stub @@ -4645,7 +4645,7 @@ mips_skip_trampoline_code (CORE_ADDR pc) So scan down to the lui/addi and extract the target address from those two instructions. */ - CORE_ADDR target_pc = read_signed_register (2); + CORE_ADDR target_pc = get_frame_register_signed (frame, 2); ULONGEST inst; int i; @@ -4676,7 +4676,7 @@ mips_skip_trampoline_code (CORE_ADDR pc) else /* This is the 'return' part of a call stub. The return address is in $r18. */ - return read_signed_register (18); + return get_frame_register_signed (frame, 18); } } return 0; /* not a stub */ diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 5ab4bb2433..2567ed2b30 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -576,12 +576,13 @@ objc_create_fundamental_type (struct objfile *objfile, int typeid) for the user since they are only interested in stepping into the method function anyway. */ static CORE_ADDR -objc_skip_trampoline (CORE_ADDR stop_pc) +objc_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) { CORE_ADDR real_stop_pc; CORE_ADDR method_stop_pc; - real_stop_pc = gdbarch_skip_trampoline_code (current_gdbarch, stop_pc); + real_stop_pc = gdbarch_skip_trampoline_code + (current_gdbarch, frame, stop_pc); if (real_stop_pc != 0) find_objc_msgcall (real_stop_pc, &method_stop_pc); @@ -591,7 +592,7 @@ objc_skip_trampoline (CORE_ADDR stop_pc) if (method_stop_pc) { real_stop_pc = gdbarch_skip_trampoline_code - (current_gdbarch, method_stop_pc); + (current_gdbarch, frame, method_stop_pc); if (real_stop_pc == 0) real_stop_pc = method_stop_pc; } diff --git a/gdb/obsd-tdep.c b/gdb/obsd-tdep.c index 7fd6d2f5c7..2247782428 100644 --- a/gdb/obsd-tdep.c +++ b/gdb/obsd-tdep.c @@ -34,5 +34,5 @@ obsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) if (msym && SYMBOL_VALUE_ADDRESS (msym) == pc) return frame_pc_unwind (get_current_frame ()); else - return find_solib_trampoline_target (pc); + return find_solib_trampoline_target (get_current_frame (), pc); } diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 9eff5b0f71..5834b6d2de 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -86,7 +86,7 @@ static CORE_ADDR -ppc_linux_skip_trampoline_code (CORE_ADDR pc) +ppc_linux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { gdb_byte buf[4]; struct obj_section *sect; @@ -557,14 +557,16 @@ static struct insn_pattern ppc64_standard_linkage[] = standard linkage function will send them. (This doesn't deal with dynamic linker lazy symbol resolution stubs.) */ static CORE_ADDR -ppc64_standard_linkage_target (CORE_ADDR pc, unsigned int *insn) +ppc64_standard_linkage_target (struct frame_info *frame, + CORE_ADDR pc, unsigned int *insn) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame)); /* The address of the function descriptor this linkage function references. */ CORE_ADDR desc - = ((CORE_ADDR) read_register (tdep->ppc_gp0_regnum + 2) + = ((CORE_ADDR) get_frame_register_unsigned (frame, + tdep->ppc_gp0_regnum + 2) + (insn_d_field (insn[0]) << 16) + insn_ds_field (insn[2])); @@ -576,13 +578,14 @@ ppc64_standard_linkage_target (CORE_ADDR pc, unsigned int *insn) /* Given that we've begun executing a call trampoline at PC, return the entry point of the function the trampoline will go to. */ static CORE_ADDR -ppc64_skip_trampoline_code (CORE_ADDR pc) +ppc64_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { unsigned int ppc64_standard_linkage_insn[PPC64_STANDARD_LINKAGE_LEN]; if (insns_match_pattern (pc, ppc64_standard_linkage, ppc64_standard_linkage_insn)) - return ppc64_standard_linkage_target (pc, ppc64_standard_linkage_insn); + return ppc64_standard_linkage_target (frame, pc, + ppc64_standard_linkage_insn); else return 0; } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 20d76cf9ff..8e80837190 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1972,7 +1972,7 @@ rs6000_in_solib_return_trampoline (CORE_ADDR pc, char *name) code that should be skipped. */ CORE_ADDR -rs6000_skip_trampoline_code (CORE_ADDR pc) +rs6000_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { unsigned int ii, op; int rel; @@ -2009,7 +2009,7 @@ rs6000_skip_trampoline_code (CORE_ADDR pc) } /* If pc is in a shared library trampoline, return its target. */ - solib_target_pc = find_solib_trampoline_target (pc); + solib_target_pc = find_solib_trampoline_target (frame, pc); if (solib_target_pc) return solib_target_pc; @@ -2019,7 +2019,7 @@ rs6000_skip_trampoline_code (CORE_ADDR pc) if (op != trampoline_code[ii]) return 0; } - ii = read_register (11); /* r11 holds destination addr */ + ii = get_frame_register_unsigned (frame, 11); /* r11 holds destination addr */ pc = read_memory_addr (ii, gdbarch_tdep (current_gdbarch)->wordsize); /* (r11) value */ return pc; } diff --git a/gdb/symtab.h b/gdb/symtab.h index c0a83a914b..db6a0a9d71 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1191,7 +1191,7 @@ extern struct minimal_symbol *lookup_minimal_symbol_by_pc_section (CORE_ADDR, extern struct minimal_symbol *lookup_solib_trampoline_symbol_by_pc (CORE_ADDR); -extern CORE_ADDR find_solib_trampoline_target (CORE_ADDR); +extern CORE_ADDR find_solib_trampoline_target (struct frame_info *, CORE_ADDR); extern void init_minimal_symbol_collection (void); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index e03498fc6c..a4de0e90ae 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -573,7 +573,7 @@ xstormy16_find_jmp_table_entry (CORE_ADDR faddr) } static CORE_ADDR -xstormy16_skip_trampoline_code (CORE_ADDR pc) +xstormy16_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { CORE_ADDR tmp = xstormy16_resolve_jmp_table_entry (pc); -- 2.34.1