tdep->jb_pc_offset = 56;
- set_solib_ops (gdbarch, &darwin_so_ops);
+ set_gdbarch_so_ops (gdbarch, &darwin_so_ops);
}
void _initialize_amd64_darwin_tdep ();
#include "reggroups.h"
#include "auxv.h"
#include "observable.h"
+#include "solib-target.h"
#include "gdbsupport/version.h"
void
dicos_init_abi (struct gdbarch *gdbarch)
{
- set_solib_ops (gdbarch, &solib_target_so_ops);
+ set_gdbarch_so_ops (gdbarch, &solib_target_so_ops);
/* Every process, although has its own address space, sees the same
list of shared libraries. There's no "main executable" in DICOS,
set_gdbarch_convert_from_func_ptr_addr (gdbarch,
frv_convert_from_func_ptr_addr);
- set_solib_ops (gdbarch, &frv_so_ops);
+ set_gdbarch_so_ops (gdbarch, &frv_so_ops);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
invalid=False,
)
+Value(
+ comment="Vtable of solib operations functions.",
+ type="const struct target_so_ops *",
+ name="so_ops",
+ postdefault="&solib_target_so_ops",
+ printer="host_address_to_string (gdbarch->so_ops)",
+)
+
Method(
comment="""
If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER
extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR pc);
extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code);
+/* Vtable of solib operations functions. */
+
+extern const struct target_so_ops * gdbarch_so_ops (struct gdbarch *gdbarch);
+extern void set_gdbarch_so_ops (struct gdbarch *gdbarch, const struct target_so_ops * so_ops);
+
/* 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. */
gdbarch_single_step_through_delay_ftype *single_step_through_delay = nullptr;
gdbarch_print_insn_ftype *print_insn = nullptr;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code = nullptr;
+ const struct target_so_ops * so_ops = 0;
gdbarch_skip_solib_resolver_ftype *skip_solib_resolver = nullptr;
gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline = nullptr;
gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk = nullptr;
/* Skip verify of single_step_through_delay, has predicate. */
/* Skip verify of print_insn, invalid_p == 0 */
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
+ if (gdbarch->so_ops == 0)
+ gdbarch->so_ops = &solib_target_so_ops;
/* Skip verify of skip_solib_resolver, invalid_p == 0 */
/* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
/* Skip verify of in_indirect_branch_thunk, invalid_p == 0 */
gdb_printf (file,
"gdbarch_dump: skip_trampoline_code = <%s>\n",
host_address_to_string (gdbarch->skip_trampoline_code));
+ gdb_printf (file,
+ "gdbarch_dump: so_ops = %s\n",
+ host_address_to_string (gdbarch->so_ops));
gdb_printf (file,
"gdbarch_dump: skip_solib_resolver = <%s>\n",
host_address_to_string (gdbarch->skip_solib_resolver));
gdbarch->skip_trampoline_code = skip_trampoline_code;
}
+const struct target_so_ops *
+gdbarch_so_ops (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch_debug >= 2)
+ gdb_printf (gdb_stdlog, "gdbarch_so_ops called\n");
+ return gdbarch->so_ops;
+}
+
+void
+set_gdbarch_so_ops (struct gdbarch *gdbarch,
+ const struct target_so_ops * so_ops)
+{
+ gdbarch->so_ops = so_ops;
+}
+
CORE_ADDR
gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
{
alignment. */
set_gdbarch_long_double_bit (gdbarch, 128);
- set_solib_ops (gdbarch, &darwin_so_ops);
+ set_gdbarch_so_ops (gdbarch, &darwin_so_ops);
}
static enum gdb_osabi
nto_svr4_so_ops.in_dynsym_resolve_code
= nto_in_dynsym_resolve_code;
}
- set_solib_ops (gdbarch, &nto_svr4_so_ops);
+ set_gdbarch_so_ops (gdbarch, &nto_svr4_so_ops);
set_gdbarch_wchar_bit (gdbarch, 32);
set_gdbarch_wchar_signed (gdbarch, 0);
mips_svr4_so_ops.in_dynsym_resolve_code
= mips_linux_in_dynsym_resolve_code;
}
- set_solib_ops (gdbarch, &mips_svr4_so_ops);
+ set_gdbarch_so_ops (gdbarch, &mips_svr4_so_ops);
set_gdbarch_write_pc (gdbarch, mips_linux_write_pc);
powerpc_so_ops.in_dynsym_resolve_code =
powerpc_linux_in_dynsym_resolve_code;
}
- set_solib_ops (gdbarch, &powerpc_so_ops);
+ set_gdbarch_so_ops (gdbarch, &powerpc_so_ops);
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
}
set_gdbarch_wchar_signed (gdbarch, 0);
set_gdbarch_auto_wide_charset (gdbarch, rs6000_aix_auto_wide_charset);
- set_solib_ops (gdbarch, &solib_aix_so_ops);
+ set_gdbarch_so_ops (gdbarch, &solib_aix_so_ops);
frame_unwind_append_unwinder (gdbarch, &aix_sighandle_frame_unwind);
}
ops->fetch_link_map_offsets = flmo;
- set_solib_ops (gdbarch, &svr4_so_ops);
+ set_gdbarch_so_ops (gdbarch, &svr4_so_ops);
set_gdbarch_iterate_over_objfiles_in_search_order
(gdbarch, svr4_iterate_over_objfiles_in_search_order);
}
/* Architecture-specific operations. */
-/* Per-architecture data key. */
-static const registry<gdbarch>::key<const struct target_so_ops,
- gdb::noop_deleter<const struct target_so_ops>>
- solib_data;
-
-static const struct target_so_ops *
-solib_ops (struct gdbarch *gdbarch)
-{
- const struct target_so_ops *result = solib_data.get (gdbarch);
- if (result == nullptr)
- {
- result = &solib_target_so_ops;
- set_solib_ops (gdbarch, &solib_target_so_ops);
- }
- return result;
-}
-
-/* Set the solib operations for GDBARCH to NEW_OPS. */
-
-void
-set_solib_ops (struct gdbarch *gdbarch, const struct target_so_ops *new_ops)
-{
- solib_data.set (gdbarch, new_ops);
-}
\f
/* external data declarations */
static gdb::unique_xmalloc_ptr<char>
solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
int found_file = -1;
gdb::unique_xmalloc_ptr<char> temp_pathname;
const char *fskind = effective_target_file_system_kind ();
static int
solib_map_sections (struct so_list *so)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (so->so_name));
gdb_bfd_ref_ptr abfd (ops->bfd_open (filename.get ()));
static void
clear_so (struct so_list *so)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
delete so->sections;
so->sections = NULL;
void
free_so (struct so_list *so)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
clear_so (so);
ops->free_so (so);
void
update_solib_list (int from_tty)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
struct so_list *inferior = ops->current_sos();
struct so_list *gdb, **gdb_link;
bool
solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
if (ops->keep_data_in_core)
return ops->keep_data_in_core (vaddr, size) != 0;
void
clear_solib (void)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
disable_breakpoints_in_shlibs ();
void
solib_create_inferior_hook (int from_tty)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
ops->solib_create_inferior_hook (from_tty);
}
bool
in_solib_dynsym_resolve_code (CORE_ADDR pc)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
return ops->in_dynsym_resolve_code (pc) != 0;
}
void
update_solib_breakpoints (void)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
if (ops->update_breakpoints != NULL)
ops->update_breakpoints ();
void
handle_solib_event (void)
{
- const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
if (ops->handle_event != NULL)
ops->handle_event ();
reload_shared_libraries_1 (from_tty);
- ops = solib_ops (target_gdbarch ());
+ ops = gdbarch_so_ops (target_gdbarch ());
/* Creating inferior hooks here has two purposes. First, if we reload
shared libraries then the address of solib breakpoint we've computed
extern void no_shared_libraries (const char *ignored, int from_tty);
-/* Set the solib operations for GDBARCH to NEW_OPS. */
-
-extern void set_solib_ops (struct gdbarch *gdbarch,
- const struct target_so_ops *new_ops);
-
/* Synchronize GDB's shared object list with inferior's.
Extract the list of currently loaded shared objects from the
linux_init_abi (info, gdbarch, 0);
/* Shared library handling. */
- set_solib_ops (gdbarch, &dsbt_so_ops);
+ set_gdbarch_so_ops (gdbarch, &dsbt_so_ops);
tdep->syscall_next_pc = tic6x_linux_syscall_next_pc;
windows_so_ops = solib_target_so_ops;
windows_so_ops.solib_create_inferior_hook
= windows_solib_create_inferior_hook;
- set_solib_ops (gdbarch, &windows_so_ops);
+ set_gdbarch_so_ops (gdbarch, &windows_so_ops);
set_gdbarch_get_siginfo_type (gdbarch, windows_get_siginfo_type);
}