aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-07-20 09:09:58 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2020-07-20 09:10:18 -0700
commited810cc7d3252bd8bfdb4303ee6b44293fe6214e (patch)
tree93cc390389149769497f84234c5ef0be3b4f092f /gdb
parentae5369e773c341ab55a130fffb4678bb3595d692 (diff)
downloadgdb-ed810cc7d3252bd8bfdb4303ee6b44293fe6214e.zip
gdb-ed810cc7d3252bd8bfdb4303ee6b44293fe6214e.tar.gz
gdb-ed810cc7d3252bd8bfdb4303ee6b44293fe6214e.tar.bz2
Implement the skip_solib_resolver gdbarch hook for FreeBSD architectures.
The ELF runtime linker on all FreeBSD architectures uses the "_rtld_bind" entry point for unresolved PTL entries. FreeBSD/mips has an additional entry point called "_mips_rtld_bind". gdb/ChangeLog: * fbsd-tdep.c (fbsd_skip_solib_resolver): New function. (fbsd_init_abi): Install gdbarch "skip_solib_resolver" method. * fbsd-tdep.h (fbsd_skip_solib_resolver): New prototype. * mips-fbsd-tdep.c (mips_fbsd_skip_solib_resolver): New function. (mips_fbsd_init_abi): Install gdbarch "skip_solib_resolver" method.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/fbsd-tdep.c14
-rw-r--r--gdb/fbsd-tdep.h5
-rw-r--r--gdb/mips-fbsd-tdep.c16
4 files changed, 44 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 30ef2c8..fad4608 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2020-07-20 John Baldwin <jhb@FreeBSD.org>
+
+ * fbsd-tdep.c (fbsd_skip_solib_resolver): New function.
+ (fbsd_init_abi): Install gdbarch "skip_solib_resolver" method.
+ * fbsd-tdep.h (fbsd_skip_solib_resolver): New prototype.
+ * mips-fbsd-tdep.c (mips_fbsd_skip_solib_resolver): New function.
+ (mips_fbsd_init_abi): Install gdbarch "skip_solib_resolver"
+ method.
+
2020-07-20 Ludovic Courtès <ludo@gnu.org>
* guile/scm-math.c (vlscm_integer_fits_p): Use 'uintmax_t'
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 557c5d3..ca397fa 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -21,6 +21,7 @@
#include "auxv.h"
#include "gdbcore.h"
#include "inferior.h"
+#include "objfiles.h"
#include "regcache.h"
#include "regset.h"
#include "gdbthread.h"
@@ -2071,6 +2072,18 @@ fbsd_get_thread_local_address (struct gdbarch *gdbarch, CORE_ADDR dtv_addr,
return addr + offset;
}
+/* See fbsd-tdep.h. */
+
+CORE_ADDR
+fbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+ struct bound_minimal_symbol msym = lookup_bound_minimal_symbol ("_rtld_bind");
+ if (msym.minsym != nullptr && BMSYMBOL_VALUE_ADDRESS (msym) == pc)
+ return frame_unwind_caller_pc (get_current_frame ());
+
+ return 0;
+}
+
/* To be called from GDB_OSABI_FREEBSD handlers. */
void
@@ -2085,6 +2098,7 @@ fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_get_siginfo_type (gdbarch, fbsd_get_siginfo_type);
set_gdbarch_gdb_signal_from_target (gdbarch, fbsd_gdb_signal_from_target);
set_gdbarch_gdb_signal_to_target (gdbarch, fbsd_gdb_signal_to_target);
+ set_gdbarch_skip_solib_resolver (gdbarch, fbsd_skip_solib_resolver);
/* `catch syscall' */
set_xml_syscall_file_name (gdbarch, "syscalls/freebsd.xml");
diff --git a/gdb/fbsd-tdep.h b/gdb/fbsd-tdep.h
index 5dd8203..e8e49dc 100644
--- a/gdb/fbsd-tdep.h
+++ b/gdb/fbsd-tdep.h
@@ -71,4 +71,9 @@ extern CORE_ADDR fbsd_get_thread_local_address (struct gdbarch *gdbarch,
CORE_ADDR lm_addr,
CORE_ADDR offset);
+/* Implement the "skip_solib_resolver" gdbarch method. */
+
+extern CORE_ADDR fbsd_skip_solib_resolver (struct gdbarch *gdbarch,
+ CORE_ADDR pc);
+
#endif /* fbsd-tdep.h */
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index abaf7f2..ba666f1 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -462,6 +462,20 @@ static const struct tramp_frame mips64_fbsd_sigframe =
/* Shared library support. */
+/* FreeBSD/mips can use an alternate routine in the runtime linker to
+ resolve functions. */
+
+static CORE_ADDR
+mips_fbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+ struct bound_minimal_symbol msym
+ = lookup_bound_minimal_symbol ("_mips_rtld_bind");
+ if (msym.minsym != nullptr && BMSYMBOL_VALUE_ADDRESS (msym) == pc)
+ return frame_unwind_caller_pc (get_current_frame ());
+
+ return fbsd_skip_solib_resolver (gdbarch, pc);
+}
+
/* FreeBSD/mips uses a slightly different `struct link_map' than the
other FreeBSD platforms as it includes an additional `l_off'
member. */
@@ -546,6 +560,8 @@ mips_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_iterate_over_regset_sections
(gdbarch, mips_fbsd_iterate_over_regset_sections);
+ set_gdbarch_skip_solib_resolver (gdbarch, mips_fbsd_skip_solib_resolver);
+
/* FreeBSD/mips has SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, (gdbarch_ptr_bit (gdbarch) == 32 ?