Move free_all_objfiles to program_space

This changes free_all_objfiles to be a method on program_space, in
line with the other changes to treat program_space as a container for
objfiles.

gdb/ChangeLog
2019-12-12  Tom Tromey  <tom@tromey.com>

	* symfile.c (symbol_file_clear): Update.
	* progspace.h (struct program_space) <free_all_objfiles>: Declare
	method.
	* progspace.c (program_space::free_all_objfiles): New method.
	* objfiles.h (free_all_objfiles): Don't declare.
	* objfiles.c (free_all_objfiles): Move to program_space.

Change-Id: I908b549d2981b6005f7ca181fc0e6d24fc8b7b6f
This commit is contained in:
Tom Tromey
2019-11-01 21:02:38 -06:00
parent d0801dd8f2
commit 343cc95202
6 changed files with 31 additions and 18 deletions

View File

@@ -618,21 +618,6 @@ objfile::~objfile ()
get_objfile_pspace_data (pspace)->section_map_dirty = 1;
}
/* Free all the object files at once and clean up their users. */
void
free_all_objfiles (void)
{
struct so_list *so;
/* Any objfile reference would become stale. */
for (so = master_so_list (); so; so = so->next)
gdb_assert (so->objfile == NULL);
for (objfile *objfile : current_program_space->objfiles_safe ())
objfile->unlink ();
clear_symtab_users (0);
}
/* A helper function for objfile_relocate1 that relocates a single
symbol. */