mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
Convert map_symbol_filenames to method
This patch changes the free function map_symbol_filenames to be a method of program_space. This seems a bit cleaner, and also lets us hoist a use of the global into the callers. Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
This commit is contained in:
@@ -160,6 +160,16 @@ program_space::iterate_over_objfiles_in_search_order
|
||||
|
||||
/* See progspace.h. */
|
||||
|
||||
void
|
||||
program_space::map_symbol_filenames (symbol_filename_listener fun,
|
||||
bool need_fullname)
|
||||
{
|
||||
for (objfile &objfile : objfiles ())
|
||||
objfile.map_symbol_filenames (fun, need_fullname);
|
||||
}
|
||||
|
||||
/* See progspace.h. */
|
||||
|
||||
void
|
||||
program_space::add_objfile (std::unique_ptr<objfile> &&objfile,
|
||||
struct objfile *before)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "solib.h"
|
||||
#include "target.h"
|
||||
#include "gdb_bfd.h"
|
||||
#include "quick-symbol.h"
|
||||
#include "registry.h"
|
||||
#include "gdbsupport/safe-iterator.h"
|
||||
#include "gdbsupport/intrusive_list.h"
|
||||
@@ -224,6 +225,12 @@ struct program_space
|
||||
(iterate_over_objfiles_in_search_order_cb_ftype cb,
|
||||
objfile *current_objfile);
|
||||
|
||||
/* Wrapper around the quick_symbol_functions map_symbol_filenames
|
||||
"method". Map function FUN over every file, in every objfile in
|
||||
this program space. See
|
||||
quick_symbol_functions.map_symbol_filenames for details. */
|
||||
void map_symbol_filenames (symbol_filename_listener fun, bool need_fullname);
|
||||
|
||||
/* Add OBJFILE to the list of objfiles, putting it just before
|
||||
BEFORE. If BEFORE is nullptr, it will go at the end of the
|
||||
list. */
|
||||
|
||||
@@ -3755,17 +3755,6 @@ symfile_free_objfile (struct objfile *objfile)
|
||||
objfile->pspace ()->remove_target_sections (objfile);
|
||||
}
|
||||
|
||||
/* Wrapper around the quick_symbol_functions map_symbol_filenames "method".
|
||||
Map function FUN over every file.
|
||||
See quick_symbol_functions.map_symbol_filenames for details. */
|
||||
|
||||
void
|
||||
map_symbol_filenames (symbol_filename_listener fun, bool need_fullname)
|
||||
{
|
||||
for (objfile &objfile : current_program_space->objfiles ())
|
||||
objfile.map_symbol_filenames (fun, need_fullname);
|
||||
}
|
||||
|
||||
#if GDB_SELF_TEST
|
||||
|
||||
namespace selftests {
|
||||
|
||||
@@ -345,8 +345,6 @@ symfile_segment_data_up get_symfile_segment_data (bfd *abfd);
|
||||
|
||||
extern scoped_restore_tmpl<int> increment_reading_symtab (void);
|
||||
|
||||
void map_symbol_filenames (symbol_filename_listener fun, bool need_fullname);
|
||||
|
||||
/* Target-agnostic function to load the sections of an executable into memory.
|
||||
|
||||
ARGS should be in the form "EXECUTABLE [OFFSET]", where OFFSET is an
|
||||
|
||||
@@ -4630,7 +4630,8 @@ info_sources_worker (struct ui_out *uiout,
|
||||
if (!group_by_objfile)
|
||||
{
|
||||
data.reset_output ();
|
||||
map_symbol_filenames (data, true /*need_fullname*/);
|
||||
current_program_space->map_symbol_filenames (data,
|
||||
true /*need_fullname*/);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6323,7 +6324,7 @@ make_source_files_completion_list (const char *text)
|
||||
datum.word = text;
|
||||
datum.text_len = text_len;
|
||||
datum.list = &list;
|
||||
map_symbol_filenames (datum, false /*need_fullname*/);
|
||||
current_program_space->map_symbol_filenames (datum, false /*need_fullname*/);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user