From: Michael Snyder Date: Tue, 20 Aug 2002 23:01:29 +0000 (+0000) Subject: 2002-08-20 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d50355b63cf93537c82e0eeb1b680acf493e7e73;p=binutils-gdb.git 2002-08-20 Michael Snyder * gdbarch.sh (IN_SOLIB_RETURN_TRAMPOLINE): Add. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c, arch-utils.h (generic_in_solib_return_trampoline): Add. * infrun.c (IN_SOLIB_RETURN_TRAMPOLINE): Delete default definition. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bac226654e2..a01c38fc6c5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2002-08-20 Michael Snyder + + * gdbarch.sh (IN_SOLIB_RETURN_TRAMPOLINE): Add. + * gdbarch.c, gdbarch.h: Regenerate. + * arch-utils.c, arch-utils.h (generic_in_solib_return_trampoline): + Add. + * infrun.c (IN_SOLIB_RETURN_TRAMPOLINE): Delete default definition. + 2002-08-20 Michael Snyder * mips-tdep.c (mips_skip_stub, mips_in_call_stub): Make static. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 170be862eaf..c11c39cf949 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -141,6 +141,12 @@ generic_in_solib_call_trampoline (CORE_ADDR pc, char *name) return 0; } +int +generic_in_solib_return_trampoline (CORE_ADDR pc, char *name) +{ + return 0; +} + int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) { diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 5fb3ece302d..3552cd8e3a1 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -144,6 +144,8 @@ extern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc); extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name); +extern int generic_in_solib_return_trampoline (CORE_ADDR pc, char *name); + extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc); /* Assume that the world is sane, a registers raw and virtual size diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index c8e3c17234d..3c2df6d5c2b 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -256,6 +256,7 @@ struct gdbarch gdbarch_print_insn_ftype *print_insn; gdbarch_skip_trampoline_code_ftype *skip_trampoline_code; gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline; + gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline; gdbarch_pc_in_sigtramp_ftype *pc_in_sigtramp; gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p; gdbarch_construct_inferior_arguments_ftype *construct_inferior_arguments; @@ -408,6 +409,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, generic_in_function_epilogue_p, construct_inferior_arguments, 0, @@ -536,6 +538,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->print_insn = legacy_print_insn; current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code; current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline; + current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline; current_gdbarch->pc_in_sigtramp = legacy_pc_in_sigtramp; current_gdbarch->in_function_epilogue_p = generic_in_function_epilogue_p; current_gdbarch->construct_inferior_arguments = construct_inferior_arguments; @@ -780,6 +783,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of print_insn, invalid_p == 0 */ /* Skip verify of skip_trampoline_code, invalid_p == 0 */ /* Skip verify of in_solib_call_trampoline, invalid_p == 0 */ + /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */ /* Skip verify of pc_in_sigtramp, invalid_p == 0 */ /* Skip verify of in_function_epilogue_p, invalid_p == 0 */ /* Skip verify of construct_inferior_arguments, invalid_p == 0 */ @@ -1411,6 +1415,17 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->in_solib_call_trampoline /*IN_SOLIB_CALL_TRAMPOLINE ()*/); #endif +#ifdef IN_SOLIB_RETURN_TRAMPOLINE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "IN_SOLIB_RETURN_TRAMPOLINE(pc, name)", + XSTRING (IN_SOLIB_RETURN_TRAMPOLINE (pc, name))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: IN_SOLIB_RETURN_TRAMPOLINE = 0x%08lx\n", + (long) current_gdbarch->in_solib_return_trampoline + /*IN_SOLIB_RETURN_TRAMPOLINE ()*/); +#endif #ifdef MAX_REGISTER_RAW_SIZE fprintf_unfiltered (file, "gdbarch_dump: MAX_REGISTER_RAW_SIZE # %s\n", @@ -4663,6 +4678,25 @@ set_gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, gdbarch->in_solib_call_trampoline = in_solib_call_trampoline; } +int +gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->in_solib_return_trampoline == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_in_solib_return_trampoline invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_return_trampoline called\n"); + return gdbarch->in_solib_return_trampoline (pc, name); +} + +void +set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, + gdbarch_in_solib_return_trampoline_ftype in_solib_return_trampoline) +{ + gdbarch->in_solib_return_trampoline = in_solib_return_trampoline; +} + int gdbarch_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc, char *name) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index ccdc0502a98..f9f631314c2 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -2268,7 +2268,7 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s /* For SVR4 shared libraries, each call goes through a small piece of trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates - to nonzero if we are current stopped in one of these. */ + to nonzero if we are currently stopped in one of these. */ /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (IN_SOLIB_CALL_TRAMPOLINE) @@ -2287,6 +2287,25 @@ extern void set_gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, gdbar #endif #endif +/* Some systems also have trampoline code for returning from shared libs. */ + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (IN_SOLIB_RETURN_TRAMPOLINE) +#define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) (generic_in_solib_return_trampoline (pc, name)) +#endif + +typedef int (gdbarch_in_solib_return_trampoline_ftype) (CORE_ADDR pc, char *name); +extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name); +extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (IN_SOLIB_RETURN_TRAMPOLINE) +#error "Non multi-arch definition of IN_SOLIB_RETURN_TRAMPOLINE" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (IN_SOLIB_RETURN_TRAMPOLINE) +#define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) (gdbarch_in_solib_return_trampoline (current_gdbarch, pc, name)) +#endif +#endif + /* Sigtramp is a routine that the kernel calls (which then calls the signal handler). On most machines it is a library routine that is linked into the executable. diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 87700da48e7..94d4c25fdc4 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -600,10 +600,16 @@ f:2:SMASH_TEXT_ADDRESS:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr:::core_a F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p::0:0 f:2:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, disassemble_info *info:vma, info:::legacy_print_insn::0 f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0 + + # For SVR4 shared libraries, each call goes through a small piece of # trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates -# to nonzero if we are current stopped in one of these. +# to nonzero if we are currently stopped in one of these. f:2:IN_SOLIB_CALL_TRAMPOLINE:int:in_solib_call_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_call_trampoline::0 + +# Some systems also have trampoline code for returning from shared libs. +f:2:IN_SOLIB_RETURN_TRAMPOLINE:int:in_solib_return_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_return_trampoline::0 + # Sigtramp is a routine that the kernel calls (which then calls the # signal handler). On most machines it is a library routine that is # linked into the executable. diff --git a/gdb/infrun.c b/gdb/infrun.c index 98867cc9a46..70fa5343c18 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -173,13 +173,6 @@ static int may_follow_exec = MAY_FOLLOW_EXEC; #define SKIP_SOLIB_RESOLVER(pc) 0 #endif -/* In some shared library schemes, the return path from a shared library - call may need to go through a trampoline too. */ - -#ifndef IN_SOLIB_RETURN_TRAMPOLINE -#define IN_SOLIB_RETURN_TRAMPOLINE(pc,name) 0 -#endif - /* This function returns TRUE if pc is the address of an instruction that lies within the dynamic linker (such as the event hook, or the dld itself).