diff options
author | Tom Tromey <tom@tromey.com> | 2019-11-01 21:02:38 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-12-12 15:50:56 -0700 |
commit | 343cc95202fce70383551053f2efab09c5e02366 (patch) | |
tree | 9a6a6c1e979d520891a60e59e76e451c0645218a /gdb/progspace.c | |
parent | d0801dd8f22a3e739c6a7d126d45829df981794d (diff) | |
download | binutils-343cc95202fce70383551053f2efab09c5e02366.zip binutils-343cc95202fce70383551053f2efab09c5e02366.tar.gz binutils-343cc95202fce70383551053f2efab09c5e02366.tar.bz2 |
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
Diffstat (limited to 'gdb/progspace.c')
-rw-r--r-- | gdb/progspace.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/progspace.c b/gdb/progspace.c index d1bf0c6..3cb0d4c 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -23,6 +23,7 @@ #include "arch-utils.h" #include "gdbcore.h" #include "solib.h" +#include "solist.h" #include "gdbthread.h" #include "inferior.h" #include <algorithm> @@ -157,6 +158,23 @@ program_space::~program_space () /* 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) { if (before == nullptr) |