This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA/RESUBMIT] Multi-arch SKIP_SOLIB_RESOLVER
- From: "David S. Miller" <davem at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 21 Apr 2002 18:40:21 -0700 (PDT)
- Subject: [RFA/RESUBMIT] Multi-arch SKIP_SOLIB_RESOLVER
[ Resubmitting so that the patch is against current sources
as requested by Andrew. ]
The default is what currently the target gets if this
macro is not defined, which evalutates to '0'.
ARM is fixed up, SPARC Linux will use this too once sparc-linux-tdep.c
addition is approved.
Ok to install?
2002-04-21 David S. Miller <davem@redhat.com>
* arch-utils.c, arch-utils.h (generic_skip_solib_resolver): New.
* gdbarch.sh (SKIP_SOLIB_RESOLVER): Add, document, default to
generic_skip_solib_resolver.
* gdbarch.c, gdbarch.h: Regenerate.
* infrun.c (SKIP_SOLIB_RESOLVER): Kill define.
* arm-linux-tdep.c (arm_linux_skip_solib_resolver): Make it
static.
(arm_linux_init_abi): Pass it to set_gdbarch_skip_solib_resolver.
* config/arm/tm-linux.h (SKIP_SOLIB_RESOLVER,
arm_linux_skip_solib_resovler): Kill.
--- ./config/arm/tm-linux.h.~1~ Sat Feb 23 14:17:12 2002
+++ ./config/arm/tm-linux.h Sun Apr 21 01:33:06 2002
@@ -52,14 +52,6 @@ extern struct link_map_offsets *arm_linu
need to skip over the dynamic linker call. This function decides
when to skip, and where to skip to. See the comments for
SKIP_SOLIB_RESOLVER at the top of infrun.c. */
-extern CORE_ADDR arm_linux_skip_solib_resolver (CORE_ADDR pc);
-#define SKIP_SOLIB_RESOLVER arm_linux_skip_solib_resolver
-
-/* When we call a function in a shared library, and the PLT sends us
- into the dynamic linker to find the function's real address, we
- need to skip over the dynamic linker call. This function decides
- when to skip, and where to skip to. See the comments for
- SKIP_SOLIB_RESOLVER at the top of infrun.c. */
#if 0
#undef IN_SOLIB_DYNSYM_RESOLVE_CODE
extern CORE_ADDR arm_in_solib_dynsym_resolve_code (CORE_ADDR pc, char *name);
--- ./config/sparc/tm-linux.h.~1~ Sun Apr 21 00:55:00 2002
+++ ./config/sparc/tm-linux.h Sun Apr 21 01:30:19 2002
@@ -29,14 +29,6 @@
#include "tm-linux.h"
-/* When we call a function in a shared library, and the PLT sends us
- into the dynamic linker to find the function's real address, we
- need to skip over the dynamic linker call. This function decides
- when to skip, and where to skip to. See the comments for
- SKIP_SOLIB_RESOLVER at the top of infrun.c. */
-#define SKIP_SOLIB_RESOLVER sparc_linux_skip_solib_resolver
-extern CORE_ADDR sparc_linux_skip_solib_resolver (CORE_ADDR pc);
-
#undef SKIP_PROLOGUE_FRAMELESS_P
#define SKIP_PROLOGUE_FRAMELESS_P(PC) sparc_linux_skip_prologue_frameless_p (PC)
extern CORE_ADDR sparc_linux_skip_prologue_frameless_p (CORE_ADDR pc);
--- ./config/sparc/tm-sp64linux.h.~1~ Sun Apr 21 00:55:05 2002
+++ ./config/sparc/tm-sp64linux.h Sun Apr 21 01:30:27 2002
@@ -29,14 +29,6 @@ Foundation, Inc., 59 Temple Place - Suit
#include "tm-linux.h"
-/* When we call a function in a shared library, and the PLT sends us
- into the dynamic linker to find the function's real address, we
- need to skip over the dynamic linker call. This function decides
- when to skip, and where to skip to. See the comments for
- SKIP_SOLIB_RESOLVER at the top of infrun.c. */
-#define SKIP_SOLIB_RESOLVER sparc_linux_skip_solib_resolver
-extern CORE_ADDR sparc_linux_skip_solib_resolver (CORE_ADDR pc);
-
#undef SKIP_PROLOGUE_FRAMELESS_P
#define SKIP_PROLOGUE_FRAMELESS_P(PC) sparc_linux_skip_prologue_frameless_p (PC)
extern CORE_ADDR sparc_linux_skip_prologue_frameless_p (CORE_ADDR pc);
--- ./arch-utils.c.~1~ Sun Apr 21 00:50:49 2002
+++ ./arch-utils.c Sun Apr 21 01:20:26 2002
@@ -108,6 +108,12 @@ generic_skip_trampoline_code (CORE_ADDR
return 0;
}
+CORE_ADDR
+generic_skip_solib_resolver (CORE_ADDR pc)
+{
+ return 0;
+}
+
int
generic_in_solib_call_trampoline (CORE_ADDR pc, char *name)
{
--- ./arch-utils.h.~1~ Sun Apr 21 00:52:05 2002
+++ ./arch-utils.h Sun Apr 21 01:20:44 2002
@@ -142,6 +142,8 @@ extern gdbarch_virtual_frame_pointer_fty
extern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc);
+extern CORE_ADDR generic_skip_solib_resolver (CORE_ADDR pc);
+
extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name);
extern int generic_in_sigtramp (CORE_ADDR pc, char *name);
--- ./gdbarch.sh.~1~ Sun Apr 21 00:51:11 2002
+++ ./gdbarch.sh Sun Apr 21 01:29:11 2002
@@ -604,6 +604,10 @@ f:2:SMASH_TEXT_ADDRESS:CORE_ADDR:smash_t
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
+# If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER
+# evaluates non-zero, this is the address where the debugger will place
+# a step-resume breakpoint to get us past the dynamic linker.
+f:2:SKIP_SOLIB_RESOLVER:CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc:::generic_skip_solib_resolver::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.
--- ./gdbarch.c.~1~ Sun Apr 21 00:57:19 2002
+++ ./gdbarch.c Sun Apr 21 01:25:14 2002
@@ -249,6 +249,7 @@ struct gdbarch
gdbarch_software_single_step_ftype *software_single_step;
gdbarch_print_insn_ftype *print_insn;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
+ gdbarch_skip_solib_resolver_ftype *skip_solib_resolver;
gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline;
gdbarch_in_sigtramp_ftype *in_sigtramp;
gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p;
@@ -398,6 +399,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
generic_in_function_epilogue_p,
construct_inferior_arguments,
0,
@@ -517,6 +519,7 @@ gdbarch_alloc (const struct gdbarch_info
current_gdbarch->smash_text_address = core_addr_identity;
current_gdbarch->print_insn = legacy_print_insn;
current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
+ current_gdbarch->skip_solib_resolver = generic_skip_solib_resolver;
current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline;
current_gdbarch->in_function_epilogue_p = generic_in_function_epilogue_p;
current_gdbarch->construct_inferior_arguments = construct_inferior_arguments;
@@ -765,6 +768,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of software_single_step, has predicate */
/* Skip verify of print_insn, invalid_p == 0 */
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
+ /* Skip verify of skip_solib_resolver, invalid_p == 0 */
/* Skip verify of in_solib_call_trampoline, invalid_p == 0 */
if (gdbarch->in_sigtramp == 0)
gdbarch->in_sigtramp = generic_in_sigtramp;
@@ -1812,6 +1816,17 @@ gdbarch_dump (struct gdbarch *gdbarch, s
(long) current_gdbarch->skip_prologue
/*SKIP_PROLOGUE ()*/);
#endif
+#ifdef SKIP_SOLIB_RESOLVER
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "SKIP_SOLIB_RESOLVER(pc)",
+ XSTRING (SKIP_SOLIB_RESOLVER (pc)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: SKIP_SOLIB_RESOLVER = 0x%08lx\n",
+ (long) current_gdbarch->skip_solib_resolver
+ /*SKIP_SOLIB_RESOLVER ()*/);
+#endif
#ifdef SKIP_TRAMPOLINE_CODE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -4403,6 +4418,24 @@ set_gdbarch_skip_trampoline_code (struct
gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
{
gdbarch->skip_trampoline_code = skip_trampoline_code;
+}
+
+CORE_ADDR
+gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+ if (gdbarch->skip_solib_resolver == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_skip_solib_resolver invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_solib_resolver called\n");
+ return gdbarch->skip_solib_resolver (pc);
+}
+
+void
+set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch,
+ gdbarch_skip_solib_resolver_ftype skip_solib_resolver)
+{
+ gdbarch->skip_solib_resolver = skip_solib_resolver;
}
int
--- ./gdbarch.h.~1~ Sun Apr 21 00:56:38 2002
+++ ./gdbarch.h Sun Apr 21 01:24:33 2002
@@ -2247,6 +2247,27 @@ extern void set_gdbarch_skip_trampoline_
#endif
#endif
+/* If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER
+ evaluates non-zero, this is the address where the debugger will place
+ a step-resume breakpoint to get us past the dynamic linker. */
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (SKIP_SOLIB_RESOLVER)
+#define SKIP_SOLIB_RESOLVER(pc) (generic_skip_solib_resolver (pc))
+#endif
+
+typedef CORE_ADDR (gdbarch_skip_solib_resolver_ftype) (CORE_ADDR pc);
+extern CORE_ADDR gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc);
+extern void set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype *skip_solib_resolver);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SKIP_SOLIB_RESOLVER)
+#error "Non multi-arch definition of SKIP_SOLIB_RESOLVER"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SKIP_SOLIB_RESOLVER)
+#define SKIP_SOLIB_RESOLVER(pc) (gdbarch_skip_solib_resolver (current_gdbarch, pc))
+#endif
+#endif
+
/* 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. */
--- ./infrun.c.~1~ Sun Mar 17 18:26:31 2002
+++ ./infrun.c Sun Apr 21 01:31:36 2002
@@ -173,10 +173,6 @@ static int may_follow_exec = MAY_FOLLOW_
#define IN_SOLIB_DYNSYM_RESOLVE_CODE(pc) 0
#endif
-#ifndef SKIP_SOLIB_RESOLVER
-#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. */
--- ./sparc-linux-tdep.c.~1~ Sun Apr 21 00:54:02 2002
+++ ./sparc-linux-tdep.c Sun Apr 21 01:30:03 2002
@@ -350,11 +350,9 @@ skip_hurd_resolver (CORE_ADDR pc)
1) decides whether a PLT has sent us into the linker to resolve
a function reference, and
2) if so, tells us where to set a temporary breakpoint that will
- trigger when the dynamic linker is done.
+ trigger when the dynamic linker is done. */
- TODO Need to generically multi-arch this thing. */
-
-CORE_ADDR
+static CORE_ADDR
sparc_linux_skip_solib_resolver (CORE_ADDR pc)
{
CORE_ADDR result;
@@ -484,6 +482,7 @@ sparc_linux_gdbarch_os_init(struct gdbar
set_gdbarch_frame_saved_pc (gdbarch, sparc_linux_frame_saved_pc);
set_gdbarch_saved_pc_after_call (gdbarch, sparc_linux_saved_pc_after_call);
set_gdbarch_in_sigtramp (gdbarch, sparc_linux_in_sigtramp);
+ set_gdbarch_skip_solib_resolver (gdbarch, sparc_linux_skip_solib_resolver);
if (gdbarch_tdep (gdbarch)->intreg_size == 4)
{
--- ./arm-linux-tdep.c.~1~ Sat Feb 23 14:17:11 2002
+++ ./arm-linux-tdep.c Sun Apr 21 01:32:38 2002
@@ -418,7 +418,7 @@ skip_hurd_resolver (CORE_ADDR pc)
2) if so, tells us where to set a temporary breakpoint that will
trigger when the dynamic linker is done. */
-CORE_ADDR
+static CORE_ADDR
arm_linux_skip_solib_resolver (CORE_ADDR pc)
{
CORE_ADDR result;
@@ -537,6 +537,7 @@ arm_linux_init_abi (struct gdbarch_info
/* Shared library handling. */
set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
+ set_gdbarch_skip_solib_resolver (gdbarch, arm_linux_skip_solib_resolver);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
}