]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: use objfile::pspace in objfile::unlink
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 16 May 2024 18:04:24 +0000 (14:04 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 15 Jul 2024 18:34:12 +0000 (14:34 -0400)
I think it would make sense to use objfile::pspace instead of the
current program space here.  It reduces the risks of calling this
method with the wrong current program space set.

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

index 3d50db40241282a68838396ba54669c314d77fab..822376ba2607eab90874c848fd403ba147ee15c4 100644 (file)
@@ -463,7 +463,7 @@ objfile::make (gdb_bfd_ref_ptr bfd_, const char *name_, objfile_flags flags_,
 void
 objfile::unlink ()
 {
-  current_program_space->remove_objfile (this);
+  this->pspace ()->remove_objfile (this);
 }
 
 /* Free all separate debug objfile of OBJFILE, but don't free OBJFILE
index 320e8099c91a9b5b4a72e6867f6f34f9fff50394..b166f0e877686048da45be4378fc0ef1210a2f46 100644 (file)
@@ -439,7 +439,7 @@ public:
   static objfile *make (gdb_bfd_ref_ptr bfd_, const char *name_,
                        objfile_flags flags_, objfile *parent = nullptr);
 
-  /* Remove an objfile from the current program space, and free
+  /* Remove this objfile from its program space's objfile list, and frees
      it.  */
   void unlink ();