gdb/progspace: make program_space::objfiles_list private

This field is only accessed within the program_space class, make it
private.

Change-Id: I0b53d78d3d11adf0dfadfb3ecace33d2996dd87b
This commit is contained in:
Simon Marchi
2024-09-03 14:41:51 -04:00
parent fa15972b68
commit 0fb43ab598
2 changed files with 13 additions and 13 deletions

View File

@@ -127,8 +127,8 @@ program_space::~program_space ()
bool bool
program_space::multi_objfile_p () const program_space::multi_objfile_p () const
{ {
return (!objfiles_list.empty () return (!m_objfiles_list.empty ()
&& std::next (objfiles_list.begin ()) != objfiles_list.end ()); && std::next (m_objfiles_list.begin ()) != m_objfiles_list.end ());
} }
/* See progspace.h. */ /* See progspace.h. */
@@ -140,8 +140,8 @@ program_space::free_all_objfiles ()
for (const solib &so : this->solibs ()) for (const solib &so : this->solibs ())
gdb_assert (so.objfile == NULL); gdb_assert (so.objfile == NULL);
while (!objfiles_list.empty ()) while (!m_objfiles_list.empty ())
this->remove_objfile (&objfiles_list.front ()); this->remove_objfile (&m_objfiles_list.front ());
} }
/* See progspace.h. */ /* See progspace.h. */
@@ -151,12 +151,12 @@ program_space::add_objfile (std::unique_ptr<objfile> &&objfile,
struct objfile *before) struct objfile *before)
{ {
if (before == nullptr) if (before == nullptr)
objfiles_list.push_back (std::move (objfile)); m_objfiles_list.push_back (std::move (objfile));
else else
{ {
gdb_assert (before->is_linked ()); gdb_assert (before->is_linked ());
objfiles_list.insert (objfiles_list.iterator_to (*before), m_objfiles_list.insert (m_objfiles_list.iterator_to (*before),
std::move (objfile)); std::move (objfile));
} }
} }
@@ -175,7 +175,7 @@ program_space::remove_objfile (struct objfile *objfile)
symfile_object_file = NULL; symfile_object_file = NULL;
gdb_assert (objfile->is_linked ()); 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. */ /* See progspace.h. */

View File

@@ -193,7 +193,7 @@ struct program_space
for (objfile *objf : pspace->objfiles ()) { ... } */ for (objfile *objf : pspace->objfiles ()) { ... } */
objfiles_range 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<objfiles_range>; using objfiles_safe_range = basic_safe_range<objfiles_range>;
@@ -208,7 +208,7 @@ struct program_space
objfiles_safe_range objfiles_safe () objfiles_safe_range objfiles_safe ()
{ {
return objfiles_safe_range 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 /* 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). */ (e.g. the argument to the "symbol-file" or "file" command). */
struct objfile *symfile_object_file = NULL; struct objfile *symfile_object_file = NULL;
/* All known objfiles are kept in a linked list. */
owning_intrusive_list<objfile> objfiles_list;
/* List of shared objects mapped into this space. Managed by /* List of shared objects mapped into this space. Managed by
solib.c. */ solib.c. */
owning_intrusive_list<solib> so_list; owning_intrusive_list<solib> so_list;
@@ -359,6 +356,9 @@ struct program_space
registry<program_space> registry_fields; registry<program_space> registry_fields;
private: private:
/* All known objfiles are kept in a linked list. */
owning_intrusive_list<objfile> m_objfiles_list;
/* The set of target sections matching the sections mapped into /* The set of target sections matching the sections mapped into
this program space. Managed by both exec_ops and solib.c. */ this program space. Managed by both exec_ops and solib.c. */
std::vector<target_section> m_target_sections; std::vector<target_section> m_target_sections;