+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'
#include "auxv.h"
#include "gdbcore.h"
#include "inferior.h"
+#include "objfiles.h"
#include "regcache.h"
#include "regset.h"
#include "gdbthread.h"
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
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");
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 */
/* 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. */
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 ?