From: Simon Marchi Date: Wed, 17 Jul 2024 03:52:03 +0000 (-0400) Subject: gdb: add program_space parameter to get_symbol_leading_char X-Git-Tag: gdb-16-branchpoint~1180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b996cc7aee674615de57126ad4837daa4f5ac94;p=thirdparty%2Fbinutils-gdb.git gdb: add program_space parameter to get_symbol_leading_char 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 Approved-By: Andrew Burgess --- diff --git a/gdb/minsyms.c b/gdb/minsyms.c index ba9da1d81af..4c68d071ac0 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1066,20 +1066,19 @@ const struct gnu_ifunc_fns *gnu_ifunc_fns_p = &stub_gnu_ifunc_fns; -/* 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"))