gdb: pass program space to objfile::objfile

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>
This commit is contained in:
Simon Marchi 2024-05-16 17:28:13 -04:00 committed by Simon Marchi
parent d1e4438fa1
commit da877546db
2 changed files with 7 additions and 4 deletions

View 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);

View 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: