From: Simon Marchi Date: Tue, 3 Sep 2024 18:41:51 +0000 (-0400) Subject: gdb/progspace: make program_space::objfiles_list private X-Git-Tag: gdb-16-branchpoint~462 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0fb43ab598d29248a80cc2b34aefa38558e64e8c;p=thirdparty%2Fbinutils-gdb.git gdb/progspace: make program_space::objfiles_list private This field is only accessed within the program_space class, make it private. Change-Id: I0b53d78d3d11adf0dfadfb3ecace33d2996dd87b --- diff --git a/gdb/progspace.c b/gdb/progspace.c index 94175d36c18..0734b44414a 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -127,8 +127,8 @@ program_space::~program_space () bool program_space::multi_objfile_p () const { - return (!objfiles_list.empty () - && std::next (objfiles_list.begin ()) != objfiles_list.end ()); + return (!m_objfiles_list.empty () + && std::next (m_objfiles_list.begin ()) != m_objfiles_list.end ()); } /* See progspace.h. */ @@ -140,8 +140,8 @@ program_space::free_all_objfiles () for (const solib &so : this->solibs ()) gdb_assert (so.objfile == NULL); - while (!objfiles_list.empty ()) - this->remove_objfile (&objfiles_list.front ()); + while (!m_objfiles_list.empty ()) + this->remove_objfile (&m_objfiles_list.front ()); } /* See progspace.h. */ @@ -151,12 +151,12 @@ program_space::add_objfile (std::unique_ptr &&objfile, struct objfile *before) { if (before == nullptr) - objfiles_list.push_back (std::move (objfile)); + m_objfiles_list.push_back (std::move (objfile)); else { gdb_assert (before->is_linked ()); - objfiles_list.insert (objfiles_list.iterator_to (*before), - std::move (objfile)); + m_objfiles_list.insert (m_objfiles_list.iterator_to (*before), + std::move (objfile)); } } @@ -175,7 +175,7 @@ program_space::remove_objfile (struct objfile *objfile) symfile_object_file = NULL; gdb_assert (objfile->is_linked ()); - objfiles_list.erase (objfiles_list.iterator_to (*objfile)); + m_objfiles_list.erase (m_objfiles_list.iterator_to (*objfile)); } /* See progspace.h. */ diff --git a/gdb/progspace.h b/gdb/progspace.h index 4f98b4576a5..d426dfaabf9 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -193,7 +193,7 @@ struct program_space for (objfile *objf : pspace->objfiles ()) { ... } */ objfiles_range objfiles () { - return objfiles_range (objfiles_iterator (objfiles_list.begin ())); + return objfiles_range (objfiles_iterator (m_objfiles_list.begin ())); } using objfiles_safe_range = basic_safe_range; @@ -208,7 +208,7 @@ struct program_space objfiles_safe_range objfiles_safe () { return objfiles_safe_range - (objfiles_range (objfiles_iterator (objfiles_list.begin ()))); + (objfiles_range (objfiles_iterator (m_objfiles_list.begin ()))); } /* Add OBJFILE to the list of objfiles, putting it just before @@ -337,9 +337,6 @@ struct program_space (e.g. the argument to the "symbol-file" or "file" command). */ struct objfile *symfile_object_file = NULL; - /* All known objfiles are kept in a linked list. */ - owning_intrusive_list objfiles_list; - /* List of shared objects mapped into this space. Managed by solib.c. */ owning_intrusive_list so_list; @@ -359,6 +356,9 @@ struct program_space registry registry_fields; private: + /* All known objfiles are kept in a linked list. */ + owning_intrusive_list m_objfiles_list; + /* The set of target sections matching the sections mapped into this program space. Managed by both exec_ops and solib.c. */ std::vector m_target_sections;