]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/progspace: make program_space::objfiles_list private
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 3 Sep 2024 18:41:51 +0000 (14:41 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 11 Nov 2024 16:28:24 +0000 (11:28 -0500)
This field is only accessed within the program_space class, make it
private.

Change-Id: I0b53d78d3d11adf0dfadfb3ecace33d2996dd87b

gdb/progspace.c
gdb/progspace.h

index 94175d36c186b732877c3a6b8333bf361d01a971..0734b44414ada0359b1c8f42815b21e0f8cb8ff4 100644 (file)
@@ -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> &&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.  */
index 4f98b4576a52a419b861a3b2eb42d28e000c276b..d426dfaabf97a5a41822ee3bcc00ec8e9ff0f67e 100644 (file)
@@ -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<objfiles_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<objfile> objfiles_list;
-
   /* List of shared objects mapped into this space.  Managed by
      solib.c.  */
   owning_intrusive_list<solib> so_list;
@@ -359,6 +356,9 @@ struct program_space
   registry<program_space> registry_fields;
 
 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
      this program space.  Managed by both exec_ops and solib.c.  */
   std::vector<target_section> m_target_sections;