From: Simon Marchi Date: Thu, 16 May 2024 18:04:24 +0000 (-0400) Subject: gdb: use objfile::pspace in objfile::unlink X-Git-Tag: binutils-2_43~123 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=93016848f9458ebaec5a92950f7c97e66bb5732e;p=thirdparty%2Fbinutils-gdb.git gdb: use objfile::pspace in objfile::unlink 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 Reviewed-By: Thiago Jung Bauermann --- diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 3d50db40241..822376ba260 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -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 diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 320e8099c91..b166f0e8776 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -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 ();