}
solib_ops_up
-gdbarch_make_solib_ops (struct gdbarch *gdbarch)
+gdbarch_make_solib_ops (struct gdbarch *gdbarch, program_space *pspace)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->make_solib_ops != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_make_solib_ops called\n");
- return gdbarch->make_solib_ops ();
+ return gdbarch->make_solib_ops (pspace);
}
void
/* Return a newly-allocated solib_ops object capable of providing the solibs for this architecture. */
-typedef solib_ops_up (gdbarch_make_solib_ops_ftype) ();
-extern solib_ops_up gdbarch_make_solib_ops (struct gdbarch *gdbarch);
+typedef solib_ops_up (gdbarch_make_solib_ops_ftype) (program_space *pspace);
+extern solib_ops_up gdbarch_make_solib_ops (struct gdbarch *gdbarch, program_space *pspace);
extern void set_gdbarch_make_solib_ops (struct gdbarch *gdbarch, gdbarch_make_solib_ops_ftype *make_solib_ops);
/* If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER
comment="Return a newly-allocated solib_ops object capable of providing the solibs for this architecture.",
type="solib_ops_up",
name="make_solib_ops",
- params=[],
+ params=[("program_space *", "pspace")],
predefault="make_target_solib_ops",
invalid=False,
)
if (set_pspace_solib_ops)
current_program_space->set_solib_ops
- (gdbarch_make_solib_ops (current_inferior ()->arch ()));
+ (gdbarch_make_solib_ops (current_inferior ()->arch (),
+ current_program_space));
if (current_program_space->exec_bfd ())
{
registers. */
target_find_description ();
- current_program_space->set_solib_ops
- (gdbarch_make_solib_ops (following_inferior->arch ()));
+ following_inferior->pspace->set_solib_ops
+ (gdbarch_make_solib_ops (following_inferior->arch (),
+ following_inferior->pspace));
gdb::observers::inferior_execd.notify (execing_inferior, following_inferior);
breakpoint_re_set ();
struct mips_fbsd_ilp32_solib_ops : public svr4_solib_ops
{
+ using svr4_solib_ops::svr4_solib_ops;
+
/* FreeBSD/MIPS uses a slightly different `struct link_map' than the
other FreeBSD platforms as it includes an additional `l_off' member. */
/* Return a new solib_ops for ILP32 FreeBSD/MIPS systems. */
static solib_ops_up
-make_mips_fbsd_ilp32_solib_ops ()
+make_mips_fbsd_ilp32_solib_ops (program_space *pspace)
{
- return std::make_unique<mips_fbsd_ilp32_solib_ops> ();
+ return std::make_unique<mips_fbsd_ilp32_solib_ops> (pspace);
}
/* See mips_fbsd_ilp32_solib_ops. */
struct mips_fbsd_lp64_solib_ops : public svr4_solib_ops
{
+ using svr4_solib_ops::svr4_solib_ops;
+
/* FreeBSD/MIPS uses a slightly different `struct link_map' than the
other FreeBSD platforms as it includes an additional `l_off' member. */
/* Return a new solib_ops for LP64 FreeBSD/MIPS systems. */
static solib_ops_up
-make_mips_fbsd_lp64_solib_ops ()
+make_mips_fbsd_lp64_solib_ops (program_space *pspace)
{
- return std::make_unique<mips_fbsd_lp64_solib_ops> ();
+ return std::make_unique<mips_fbsd_lp64_solib_ops> (pspace);
}
/* See mips_fbsd_lp64_solib_ops. */
template <typename Base>
struct mips_linux_svr4_solib_ops : public Base
{
+ using Base::Base;
+
bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
};
/* Return a new solib_ops for ILP32 Linux/MIPS systems. */
static solib_ops_up
-make_mips_linux_ilp32_svr4_solib_ops ()
+make_mips_linux_ilp32_svr4_solib_ops (program_space *pspace)
{
- return std::make_unique<mips_linux_ilp32_svr4_solib_ops> ();
+ return std::make_unique<mips_linux_ilp32_svr4_solib_ops> (pspace);
}
/* solib_ops for LP64 Linux/MIPS systems. */
/* Return a new solib_ops for LP64 Linux/MIPS systems. */
static solib_ops_up
-make_mips_linux_lp64_svr4_solib_ops ()
+make_mips_linux_lp64_svr4_solib_ops (program_space *pspace)
{
- return std::make_unique<mips_linux_lp64_svr4_solib_ops> ();
+ return std::make_unique<mips_linux_lp64_svr4_solib_ops> (pspace);
}
/* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c,
struct mips_nbsd_ilp32_svr4_solib_ops : public svr4_solib_ops
{
+ using svr4_solib_ops::svr4_solib_ops;
+
/* NetBSD/MIPS uses a slightly different `struct link_map' than the
other NetBSD platforms. */
link_map_offsets *fetch_link_map_offsets () const override;
/* Return a new solib_ops for ILP32 NetBSD/MIPS systems. */
static solib_ops_up
-make_mips_nbsd_ilp32_svr4_solib_ops ()
+make_mips_nbsd_ilp32_svr4_solib_ops (program_space *pspace)
{
- return std::make_unique<mips_nbsd_ilp32_svr4_solib_ops> ();
+ return std::make_unique<mips_nbsd_ilp32_svr4_solib_ops> (pspace);
}
/* See mips_nbsd_ilp32_svr4_solib_ops. */
struct mips_nbsd_lp64_svr4_solib_ops : public svr4_solib_ops
{
+ using svr4_solib_ops::svr4_solib_ops;
+
/* NetBSD/MIPS uses a slightly different `struct link_map' than the
other NetBSD platforms. */
link_map_offsets *fetch_link_map_offsets () const override;
/* Return a new solib_ops for LP64 NetBSD/MIPS systems. */
static solib_ops_up
-make_mips_nbsd_lp64_svr4_solib_ops ()
+make_mips_nbsd_lp64_svr4_solib_ops (program_space *pspace)
{
- return std::make_unique<mips_nbsd_lp64_svr4_solib_ops> ();
+ return std::make_unique<mips_nbsd_lp64_svr4_solib_ops> (pspace);
}
/* See mips_nbsd_lp64_svr4_solib_ops. */
struct ppc_linux_ilp32_svr4_solib_ops : public linux_ilp32_svr4_solib_ops
{
+ using linux_ilp32_svr4_solib_ops::linux_ilp32_svr4_solib_ops;
+
/* Check if PC is in PLT stub. For non-secure PLT, stub is in .plt
section. For secure PLT, stub is in .text and we need to check
instruction patterns. */
/* Return a new solib_ops for ILP32 PowerPC/Linux systems. */
static solib_ops_up
-make_ppc_linux_ilp32_svr4_solib_ops ()
+make_ppc_linux_ilp32_svr4_solib_ops (program_space *pspace)
{
- return std::make_unique<ppc_linux_ilp32_svr4_solib_ops> ();
+ return std::make_unique<ppc_linux_ilp32_svr4_solib_ops> (pspace);
}
/* See ppc_linux_ilp32_svr4_solib_ops. */
struct aix_solib_ops : public solib_ops
{
+ using solib_ops::solib_ops;
+
void relocate_section_addresses (solib &so, target_section *) const override;
void create_inferior_hook (int from_tty) const override;
owning_intrusive_list<solib> current_sos () const override;
/* See solib-aix.h. */
solib_ops_up
-make_aix_solib_ops ()
+make_aix_solib_ops (program_space *pspace)
{
- return std::make_unique<aix_solib_ops> ();
+ return std::make_unique<aix_solib_ops> (pspace);
}
/* Our private data in struct solib. */
/* Return a new solib_ops for AIX systems. */
-solib_ops_up make_aix_solib_ops ();
+solib_ops_up make_aix_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_AIX_H */
struct darwin_solib_ops : public solib_ops
{
+ using solib_ops::solib_ops;
+
void relocate_section_addresses (solib &so, target_section *) const override;
void clear_solib (program_space *pspace) const override;
void create_inferior_hook (int from_tty) const override;
/* See solib-darwin.h. */
solib_ops_up
-make_darwin_solib_ops ()
+make_darwin_solib_ops (program_space *pspace)
{
- return std::make_unique<darwin_solib_ops> ();
+ return std::make_unique<darwin_solib_ops> (pspace);
}
struct gdb_dyld_image_info
/* Return a new solib_ops for Darwin systems. */
-extern solib_ops_up make_darwin_solib_ops ();
+extern solib_ops_up make_darwin_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_DARWIN_H */
struct dsbt_solib_ops : public solib_ops
{
+ using solib_ops::solib_ops;
+
void relocate_section_addresses (solib &so, target_section *) const override;
void clear_solib (program_space *pspace) const override;
void create_inferior_hook (int from_tty) const override;
/* See solib-dsbt.h. */
solib_ops_up
-make_dsbt_solib_ops ()
+make_dsbt_solib_ops (program_space *pspace)
{
- return std::make_unique<dsbt_solib_ops> ();
+ return std::make_unique<dsbt_solib_ops> (pspace);
}
/* Link map info to include in an allocated solib entry */
/* Return a new solib_ops for DSBT systems. */
-solib_ops_up make_dsbt_solib_ops ();
+solib_ops_up make_dsbt_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_DSBT_H */
struct frv_solib_ops : public solib_ops
{
+ using solib_ops::solib_ops;
+
void relocate_section_addresses (solib &so, target_section *) const override;
void clear_solib (program_space *pspace) const override;
void create_inferior_hook (int from_tty) const override;
/* See solib-frv.h. */
solib_ops_up
-make_frv_solib_ops ()
+make_frv_solib_ops (program_space *pspace)
{
- return std::make_unique<frv_solib_ops> ();
+ return std::make_unique<frv_solib_ops> (pspace);
}
/* FR-V pointers are four bytes wide. */
/* Return a new solib_ops for FR-V systems. */
-solib_ops_up make_frv_solib_ops ();
+solib_ops_up make_frv_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_FRV_H */
{
/* HOST_OPS is the host solib_ops that rocm_solib_ops hijacks / wraps,
in order to provide support for ROCm code objects. */
- explicit rocm_solib_ops (solib_ops_up host_ops)
- : m_host_ops (std::move (host_ops))
+ explicit rocm_solib_ops (program_space *pspace, solib_ops_up host_ops)
+ : solib_ops (pspace), m_host_ops (std::move (host_ops))
{
}
get_solib_info (inf)->solib_list.clear ();
auto prev_ops = inf->pspace->release_solib_ops ();
- auto rocm_ops = std::make_unique<rocm_solib_ops> (std::move (prev_ops));
+ auto rocm_ops
+ = std::make_unique<rocm_solib_ops> (inf->pspace, std::move (prev_ops));
inf->pspace->set_solib_ops (std::move (rocm_ops));
rocm_update_solib_list ();
if (get_amd_dbgapi_process_id (follow_inf) == AMD_DBGAPI_PROCESS_NONE)
return;
- auto prev_ops = follow_inf->pspace->release_solib_ops ();
- auto rocm_ops = std::make_unique<rocm_solib_ops> (std::move (prev_ops));
- follow_inf->pspace->set_solib_ops (std::move (rocm_ops));
+ auto pspace = follow_inf->pspace;
+ auto prev_ops = pspace->release_solib_ops ();
+ auto rocm_ops
+ = std::make_unique<rocm_solib_ops> (pspace, std::move (prev_ops));
+ pspace->set_solib_ops (std::move (rocm_ops));
get_solib_info (exec_inf)->solib_list.clear ();
}
/* See solib-svr4-linux.h. */
solib_ops_up
-make_linux_ilp32_svr4_solib_ops ()
+make_linux_ilp32_svr4_solib_ops (program_space *pspace)
{
- return std::make_unique<linux_ilp32_svr4_solib_ops> ();
+ return std::make_unique<linux_ilp32_svr4_solib_ops> (pspace);
}
/* See solib-svr4-linux.h. */
/* See solib-svr4-linux.h. */
solib_ops_up
-make_linux_lp64_svr4_solib_ops ()
+make_linux_lp64_svr4_solib_ops (program_space *pspace)
{
- return std::make_unique<linux_lp64_svr4_solib_ops> ();
+ return std::make_unique<linux_lp64_svr4_solib_ops> (pspace);
}
/* See linux-tdep.h. */
struct linux_ilp32_svr4_solib_ops : public svr4_solib_ops
{
+ using svr4_solib_ops::svr4_solib_ops;
+
link_map_offsets *fetch_link_map_offsets () const override;
};
struct linux_lp64_svr4_solib_ops : public svr4_solib_ops
{
+ using svr4_solib_ops::svr4_solib_ops;
+
link_map_offsets *fetch_link_map_offsets () const override;
};
/* Return a new solib_ops for ILP32 Linux systems. */
-extern solib_ops_up make_linux_ilp32_svr4_solib_ops ();
+extern solib_ops_up make_linux_ilp32_svr4_solib_ops (program_space *pspace);
/* Return a new solib_ops for LP64 Linux systems. */
-extern solib_ops_up make_linux_lp64_svr4_solib_ops ();
+extern solib_ops_up make_linux_lp64_svr4_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_SVR4_LINUX_H */
/* See solib-svr4.h. */
solib_ops_up
-make_svr4_ilp32_solib_ops ()
+make_svr4_ilp32_solib_ops (program_space *pspace)
{
- return std::make_unique<ilp32_svr4_solib_ops> ();
+ return std::make_unique<ilp32_svr4_solib_ops> (pspace);
}
/* Most OS'es that have SVR4-style ELF dynamic libraries define a
struct lp64_svr4_solib_ops : public svr4_solib_ops
{
+ using svr4_solib_ops::svr4_solib_ops;
+
link_map_offsets *fetch_link_map_offsets () const override;
};
/* See solib-svr4.h. */
solib_ops_up
-make_svr4_lp64_solib_ops ()
+make_svr4_lp64_solib_ops (program_space *pspace)
{
- return std::make_unique<lp64_svr4_solib_ops> ();
+ return std::make_unique<lp64_svr4_solib_ops> (pspace);
}
/* Fetch (and possibly build) an appropriate `struct link_map_offsets'
struct svr4_solib_ops : public solib_ops
{
+ using solib_ops::solib_ops;
+
void relocate_section_addresses (solib &so, target_section *) const override;
void clear_so (const solib &so) const override;
void clear_solib (program_space *pspace) const override;
struct ilp32_svr4_solib_ops : public svr4_solib_ops
{
+ using svr4_solib_ops::svr4_solib_ops;
+
link_map_offsets *fetch_link_map_offsets () const override;
};
/* Return a new solib_ops for ILP32 SVR4 systems. */
-extern solib_ops_up make_svr4_ilp32_solib_ops ();
+extern solib_ops_up make_svr4_ilp32_solib_ops (program_space *pspace);
/* Return a new solib_ops for LP64 SVR4 systems. */
-extern solib_ops_up make_svr4_lp64_solib_ops ();
+extern solib_ops_up make_svr4_lp64_solib_ops (program_space *pspace);
/* For the MUSL C library, given link map address LM_ADDR, return the
corresponding TLS module id, or 0 if not found. */
/* See solib-target.h. */
solib_ops_up
-make_target_solib_ops ()
+make_target_solib_ops (program_space *pspace)
{
- return std::make_unique<target_solib_ops> ();
+ return std::make_unique<target_solib_ops> (pspace);
}
struct target_solib_ops : solib_ops
{
+ using solib_ops::solib_ops;
+
void relocate_section_addresses (solib &so, target_section *) const override;
owning_intrusive_list<solib> current_sos () const override;
bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
/* Return a new solib_ops for systems fetching solibs from the target. */
-solib_ops_up make_target_solib_ops ();
+solib_ops_up make_target_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_TARGET_H */
struct solib_ops
{
+ explicit solib_ops (program_space *pspace)
+ : m_pspace (pspace)
+ {}
+
virtual ~solib_ops () = default;
/* Adjust the section binding addresses by the base address at
The supports_namespaces method must return true for this to be called. */
virtual std::vector<const solib *> get_solibs_in_ns (int ns) const
{ gdb_assert_not_reached ("namespaces not supported"); }
+
+protected:
+ /* The program space for which this solib_ops was created. */
+ program_space *m_pspace;
};
/* A unique pointer to an solib_ops. */
struct windows_solib_ops : target_solib_ops
{
+ using target_solib_ops::target_solib_ops;
+
void create_inferior_hook (int from_tty) const override;
};
/* Return a new solib_ops for Windows systems. */
static solib_ops_up
-make_windows_solib_ops ()
+make_windows_solib_ops (program_space *pspace)
{
- return std::make_unique<windows_solib_ops> ();
+ return std::make_unique<windows_solib_ops> (pspace);
}
/* Implement the "solib_create_inferior_hook" solib_ops method. */