+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.
+
2019-12-12 Tom Tromey <tom@tromey.com>
* progspace.c (program_space::add_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);
-}
\f
/* A helper function for objfile_relocate1 that relocates a single
symbol. */
extern void free_objfile_separate_debug (struct objfile *);
-extern void free_all_objfiles (void);
-
extern void objfile_relocate (struct objfile *, const struct section_offsets *);
extern void objfile_rebase (struct objfile *, CORE_ADDR);
#include "arch-utils.h"
#include "gdbcore.h"
#include "solib.h"
+#include "solist.h"
#include "gdbthread.h"
#include "inferior.h"
#include <algorithm>
/* See progspace.h. */
+void
+program_space::free_all_objfiles ()
+{
+ struct so_list *so;
+
+ /* Any objfile reference would become stale. */
+ for (so = master_so_list (); so; so = so->next)
+ gdb_assert (so->objfile == NULL);
+
+ while (!objfiles_list.empty ())
+ objfiles_list.front ()->unlink ();
+
+ clear_symtab_users (0);
+}
+
+/* See progspace.h. */
+
void
program_space::add_objfile (struct objfile *objfile, struct objfile *before)
{
return objfiles_list.size () > 1;
}
+ /* Free all the objfiles associated with this program space. */
+ void free_all_objfiles ();
+
/* Pointer to next in linked list. */
struct program_space *next = NULL;
objfiles get stale by free_all_objfiles. */
no_shared_libraries (NULL, from_tty);
- free_all_objfiles ();
+ current_program_space->free_all_objfiles ();
gdb_assert (symfile_objfile == NULL);
if (from_tty)