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.
This commit is contained in:
John Baldwin
2020-07-20 09:09:58 -07:00
parent ae5369e773
commit ed810cc7d3
4 changed files with 44 additions and 0 deletions

View File

@@ -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");