aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2025-07-21 11:38:30 -0400
committerSimon Marchi <simon.marchi@efficios.com>2025-08-22 10:45:47 -0400
commit0dd741f753c7f93dd25afe621cb626cce6ed0284 (patch)
tree3fba84ed8acb6a8b04de2d5b438a4b085cd1e052
parent8a729432af7fe9e9f07036e2d0a5c66439de8bf9 (diff)
downloadbinutils-0dd741f753c7f93dd25afe621cb626cce6ed0284.zip
binutils-0dd741f753c7f93dd25afe621cb626cce6ed0284.tar.gz
binutils-0dd741f753c7f93dd25afe621cb626cce6ed0284.tar.bz2
gdb/solib: save program space in solib_ops
In some subsequent patches, solib_ops methods will need to access the program space they were created for. We currently access the program space using "current_program_space", but it would better to remember the program space at construction time instead. Change-Id: Icf2809435a23c47ddeeb75e603863b201eff2e58 Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
-rw-r--r--gdb/gdbarch-gen.c4
-rw-r--r--gdb/gdbarch-gen.h4
-rw-r--r--gdb/gdbarch_components.py2
-rw-r--r--gdb/infcmd.c3
-rw-r--r--gdb/infrun.c5
-rw-r--r--gdb/mips-fbsd-tdep.c12
-rw-r--r--gdb/mips-linux-tdep.c10
-rw-r--r--gdb/mips-netbsd-tdep.c12
-rw-r--r--gdb/ppc-linux-tdep.c6
-rw-r--r--gdb/solib-aix.c6
-rw-r--r--gdb/solib-aix.h2
-rw-r--r--gdb/solib-darwin.c6
-rw-r--r--gdb/solib-darwin.h2
-rw-r--r--gdb/solib-dsbt.c6
-rw-r--r--gdb/solib-dsbt.h2
-rw-r--r--gdb/solib-frv.c6
-rw-r--r--gdb/solib-frv.h2
-rw-r--r--gdb/solib-rocm.c15
-rw-r--r--gdb/solib-svr4-linux.c8
-rw-r--r--gdb/solib-svr4-linux.h8
-rw-r--r--gdb/solib-svr4.c10
-rw-r--r--gdb/solib-svr4.h8
-rw-r--r--gdb/solib-target.c4
-rw-r--r--gdb/solib-target.h4
-rw-r--r--gdb/solib.h8
-rw-r--r--gdb/windows-tdep.c6
26 files changed, 104 insertions, 57 deletions
diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c
index 8f7d359..75956e2 100644
--- a/gdb/gdbarch-gen.c
+++ b/gdb/gdbarch-gen.c
@@ -3470,13 +3470,13 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
}
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
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 148abfa..fba62e1 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -820,8 +820,8 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s
/* 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
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index ae9e14a..dac3ce1 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -1435,7 +1435,7 @@ Function(
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,
)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 89f9205..a785ae3 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -261,7 +261,8 @@ post_create_inferior (int from_tty, bool set_pspace_solib_ops)
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 ())
{
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 051236e..3b5cff7 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1381,8 +1381,9 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
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 ();
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index 879058c..dc549b5 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -480,6 +480,8 @@ mips_fbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
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. */
@@ -489,9 +491,9 @@ struct mips_fbsd_ilp32_solib_ops : public svr4_solib_ops
/* 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. */
@@ -528,6 +530,8 @@ mips_fbsd_ilp32_solib_ops::fetch_link_map_offsets () const
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. */
@@ -537,9 +541,9 @@ struct mips_fbsd_lp64_solib_ops : public svr4_solib_ops
/* 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. */
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 08dbd68..b668bcb 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -671,6 +671,8 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc)
template <typename Base>
struct mips_linux_svr4_solib_ops : public Base
{
+ using Base::Base;
+
bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
};
@@ -700,9 +702,9 @@ using mips_linux_ilp32_svr4_solib_ops
/* 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. */
@@ -713,9 +715,9 @@ using mips_linux_lp64_svr4_solib_ops
/* 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,
diff --git a/gdb/mips-netbsd-tdep.c b/gdb/mips-netbsd-tdep.c
index e72ed7b..3c54c32 100644
--- a/gdb/mips-netbsd-tdep.c
+++ b/gdb/mips-netbsd-tdep.c
@@ -292,6 +292,8 @@ mipsnbsd_cannot_store_register (struct gdbarch *gdbarch, int regno)
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;
@@ -300,9 +302,9 @@ struct mips_nbsd_ilp32_svr4_solib_ops : public svr4_solib_ops
/* 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. */
@@ -340,6 +342,8 @@ mips_nbsd_ilp32_svr4_solib_ops::fetch_link_map_offsets () const
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;
@@ -348,9 +352,9 @@ struct mips_nbsd_lp64_svr4_solib_ops : public svr4_solib_ops
/* 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. */
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 5067b89..39566a4 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -309,6 +309,8 @@ static const struct ppc_insn_pattern powerpc32_plt_stub_so_2[] =
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. */
@@ -319,9 +321,9 @@ struct ppc_linux_ilp32_svr4_solib_ops : public linux_ilp32_svr4_solib_ops
/* 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. */
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index b246df8..fb81a56 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -28,6 +28,8 @@
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;
@@ -37,9 +39,9 @@ struct aix_solib_ops : public solib_ops
/* 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. */
diff --git a/gdb/solib-aix.h b/gdb/solib-aix.h
index 628b7c8..887487d 100644
--- a/gdb/solib-aix.h
+++ b/gdb/solib-aix.h
@@ -24,6 +24,6 @@ extern CORE_ADDR solib_aix_get_toc_value (CORE_ADDR pc);
/* 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 */
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index aac8ab2..6212697 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -37,6 +37,8 @@
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;
@@ -47,9 +49,9 @@ struct darwin_solib_ops : public solib_ops
/* 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
diff --git a/gdb/solib-darwin.h b/gdb/solib-darwin.h
index f5bcdd1..fc28b2c 100644
--- a/gdb/solib-darwin.h
+++ b/gdb/solib-darwin.h
@@ -24,6 +24,6 @@
/* 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 */
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 13623fc..4f2c918 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -123,6 +123,8 @@ struct dbst_ext_link_map
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;
@@ -133,9 +135,9 @@ struct dsbt_solib_ops : public solib_ops
/* 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 */
diff --git a/gdb/solib-dsbt.h b/gdb/solib-dsbt.h
index d44613c..00f7791 100644
--- a/gdb/solib-dsbt.h
+++ b/gdb/solib-dsbt.h
@@ -24,6 +24,6 @@
/* 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 */
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index b48efe5..9a9b65d 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -31,6 +31,8 @@
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;
@@ -41,9 +43,9 @@ struct frv_solib_ops : public solib_ops
/* 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. */
diff --git a/gdb/solib-frv.h b/gdb/solib-frv.h
index a2f3558..33d156c 100644
--- a/gdb/solib-frv.h
+++ b/gdb/solib-frv.h
@@ -23,6 +23,6 @@
/* 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 */
diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
index 2d26c3c..7c60ebc 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -160,8 +160,8 @@ struct rocm_solib_ops : public solib_ops
{
/* 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))
{
}
@@ -807,7 +807,8 @@ rocm_solib_target_inferior_created (inferior *inf)
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 ();
@@ -825,9 +826,11 @@ rocm_solib_target_inferior_execd (inferior *exec_inf, inferior *follow_inf)
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 ();
}
diff --git a/gdb/solib-svr4-linux.c b/gdb/solib-svr4-linux.c
index fd86cf0..fe82e5d 100644
--- a/gdb/solib-svr4-linux.c
+++ b/gdb/solib-svr4-linux.c
@@ -22,9 +22,9 @@
/* 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. */
@@ -61,9 +61,9 @@ linux_ilp32_svr4_solib_ops::fetch_link_map_offsets () const
/* 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. */
diff --git a/gdb/solib-svr4-linux.h b/gdb/solib-svr4-linux.h
index 623013c..af040ff 100644
--- a/gdb/solib-svr4-linux.h
+++ b/gdb/solib-svr4-linux.h
@@ -26,6 +26,8 @@
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;
};
@@ -33,15 +35,17 @@ struct linux_ilp32_svr4_solib_ops : public svr4_solib_ops
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 */
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index e61aeaa..ddb9c91 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -3454,9 +3454,9 @@ set_solib_svr4_ops (gdbarch *gdbarch, gdbarch_make_solib_ops_ftype make_solib_op
/* 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
@@ -3499,15 +3499,17 @@ ilp32_svr4_solib_ops::fetch_link_map_offsets () const
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'
diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h
index 7235fd9..70cb1d6 100644
--- a/gdb/solib-svr4.h
+++ b/gdb/solib-svr4.h
@@ -78,6 +78,8 @@ enum probe_action
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;
@@ -137,6 +139,8 @@ private:
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;
};
@@ -192,11 +196,11 @@ extern CORE_ADDR svr4_fetch_objfile_link_map (struct objfile *objfile);
/* 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. */
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index 770028d..f20332a 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -389,7 +389,7 @@ target_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const
/* 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);
}
diff --git a/gdb/solib-target.h b/gdb/solib-target.h
index 89ae2bc..4b8f2d6 100644
--- a/gdb/solib-target.h
+++ b/gdb/solib-target.h
@@ -26,6 +26,8 @@
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;
@@ -33,6 +35,6 @@ struct target_solib_ops : solib_ops
/* 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 */
diff --git a/gdb/solib.h b/gdb/solib.h
index f6d6de9..a6e85eb 100644
--- a/gdb/solib.h
+++ b/gdb/solib.h
@@ -133,6 +133,10 @@ using solib_up = std::unique_ptr<solib>;
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
@@ -259,6 +263,10 @@ struct solib_ops
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. */
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 05335d2..b71fad1 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -866,15 +866,17 @@ windows_get_siginfo_type (struct gdbarch *gdbarch)
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. */