]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: pass program space to objfile::objfile
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 16 May 2024 21:28:13 +0000 (17:28 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 15 Jul 2024 18:34:12 +0000 (14:34 -0400)
Make the current program space reference bubble up one level.

Change-Id: I81e45e89e0cfd87c308f801d49ae811a941348b7
Approved-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
gdb/objfiles.c
gdb/objfiles.h

index f54813d9f8f272377ff177a0b07e092843d7fcd9..2d6a49ce54319c8fe020f9b57327081f8f18a72a 100644 (file)
@@ -306,9 +306,10 @@ build_objfile_section_table (struct objfile *objfile)
    requests for specific operations.  Other bits like OBJF_SHARED are
    simply copied through to the new objfile flags member.  */
 
-objfile::objfile (gdb_bfd_ref_ptr bfd_, const char *name, objfile_flags flags_)
+objfile::objfile (gdb_bfd_ref_ptr bfd_, program_space *pspace,
+                 const char *name, objfile_flags flags_)
   : flags (flags_),
-    m_pspace (current_program_space),
+    m_pspace (pspace),
     obfd (std::move (bfd_))
 {
   const char *expanded_name;
@@ -444,7 +445,8 @@ objfile *
 objfile::make (gdb_bfd_ref_ptr bfd_, const char *name_, objfile_flags flags_,
               objfile *parent)
 {
-  objfile *result = new objfile (std::move (bfd_), name_, flags_);
+  objfile *result
+    = new objfile (std::move (bfd_), current_program_space, name_, flags_);
   if (parent != nullptr)
     add_separate_debug_objfile (result, parent);
 
index 9143fbf4a91dc593befc0c1239802e886ff8636e..e43669c995960bfa28172615ce1d18ff7e57b3b6 100644 (file)
@@ -423,7 +423,8 @@ struct objfile
 private:
 
   /* The only way to create an objfile is to call objfile::make.  */
-  objfile (gdb_bfd_ref_ptr, const char *, objfile_flags);
+  objfile (gdb_bfd_ref_ptr, program_space *pspace, const char *,
+          objfile_flags);
 
 public: