diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2024-07-16 23:52:03 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2024-08-12 10:37:06 -0400 |
commit | 3b996cc7aee674615de57126ad4837daa4f5ac94 (patch) | |
tree | 97ff2834a772b705d20d2239e56935970482be4d | |
parent | 4144d36a68bda0f20c02e6a4444052b44a462155 (diff) | |
download | binutils-3b996cc7aee674615de57126ad4837daa4f5ac94.zip binutils-3b996cc7aee674615de57126ad4837daa4f5ac94.tar.gz binutils-3b996cc7aee674615de57126ad4837daa4f5ac94.tar.bz2 |
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>
-rw-r--r-- | gdb/minsyms.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c index ba9da1d..4c68d07 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")) |