]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: add program_space parameter to get_symbol_leading_char
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Jul 2024 03:52:03 +0000 (23:52 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 12 Aug 2024 14:37:06 +0000 (10:37 -0400)
Make the current_program_space references bubble up one level.  In this
case, I think it makes sense to use m_objfile's program space.

Change-Id: Ibecb89b5e8a0363328240f1675d0fb95ff99c99a
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/minsyms.c

index ba9da1d81af5f6c30365ea6f28ab92521657500a..4c68d071ac0598c5c3775efb38b8c7134afa7928 100644 (file)
@@ -1066,20 +1066,19 @@ const struct gnu_ifunc_fns *gnu_ifunc_fns_p = &stub_gnu_ifunc_fns;
 
 \f
 
-/* Return leading symbol character for a BFD.  If BFD is NULL,
-   return the leading symbol character from the main objfile.  */
+/* Return the leading symbol character for BFD ABFD.  If ABFD is nullptr,
+   return the leading symbol character from the the main objfile of PSPACE..  */
 
 static int
-get_symbol_leading_char (bfd *abfd)
+get_symbol_leading_char (program_space *pspace, bfd *abfd)
 {
   if (abfd != NULL)
     return bfd_get_symbol_leading_char (abfd);
-  if (current_program_space->symfile_object_file != NULL)
-    {
-      objfile *objf = current_program_space->symfile_object_file;
-      if (objf->obfd != NULL)
-       return bfd_get_symbol_leading_char (objf->obfd.get ());
-    }
+
+  if (objfile *objf = pspace->symfile_object_file;
+      objf != nullptr && objf->obfd != nullptr)
+    return bfd_get_symbol_leading_char (objf->obfd.get ());
+
   return 0;
 }
 
@@ -1194,7 +1193,8 @@ minimal_symbol_reader::record_full (std::string_view name,
 
   /* It's safe to strip the leading char here once, since the name
      is also stored stripped in the minimal symbol table.  */
-  if (name[0] == get_symbol_leading_char (m_objfile->obfd.get ()))
+  if (name[0] == get_symbol_leading_char (m_objfile->pspace (),
+                                         m_objfile->obfd.get ()))
     name = name.substr (1);
 
   if (ms_type == mst_file_text && startswith (name, "__gnu_compiled"))