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 <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
This commit is contained in:
Simon Marchi
2024-07-16 23:52:03 -04:00
parent 4144d36a68
commit 3b996cc7ae

View File

@@ -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"))