aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-11-23 17:09:34 -0700
committerTom Tromey <tom@tromey.com>2019-01-09 18:28:14 -0700
commitcac85af2467c9bac326b397b150274d95d2916a5 (patch)
tree1e9c3722cd2e1592218f8dc5c7e31a154d848a3e /gdb/objfiles.c
parentaed57c537116ae91f553ac835b3f96d1f87b3bb0 (diff)
downloadfsf-binutils-gdb-cac85af2467c9bac326b397b150274d95d2916a5.zip
fsf-binutils-gdb-cac85af2467c9bac326b397b150274d95d2916a5.tar.gz
fsf-binutils-gdb-cac85af2467c9bac326b397b150274d95d2916a5.tar.bz2
Remove ALL_OBJFILES_SAFE
This removes the ALL_OBJFILES_SAFE macro, replacing the uses with ranged for loops. gdb/ChangeLog 2019-01-09 Tom Tromey <tom@tromey.com> * common/next-iterator.h (next_adapter): Add Iterator template parameter. * objfiles.h (ALL_OBJFILES_SAFE): Remove. (class all_objfiles_safe): New. * jit.c (jit_inferior_exit_hook): Use all_objfiles_safe. * objfiles.c (put_objfile_before): Update comment. (add_separate_debug_objfile): Likewise. (free_all_objfiles): Use all_objfiles_safe. (objfile_purge_solibs): Likewise.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index c9a727a..5d46e69 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -514,7 +514,7 @@ objfile_separate_debug_iterate (const struct objfile *parent,
/* Put one object file before a specified on in the global list.
This can be used to make sure an object file is destroyed before
- another when using ALL_OBJFILES_SAFE to free all objfiles. */
+ another when using all_objfiles_safe to free all objfiles. */
void
put_objfile_before (struct objfile *objfile, struct objfile *before_this)
{
@@ -587,7 +587,7 @@ add_separate_debug_objfile (struct objfile *objfile, struct objfile *parent)
parent->separate_debug_objfile = objfile;
/* Put the separate debug object before the normal one, this is so that
- usage of the ALL_OBJFILES_SAFE macro will stay safe. */
+ usage of all_objfiles_safe will stay safe. */
put_objfile_before (objfile, parent);
}
@@ -730,17 +730,14 @@ objfile::~objfile ()
void
free_all_objfiles (void)
{
- struct objfile *objfile, *temp;
struct so_list *so;
/* Any objfile referencewould become stale. */
for (so = master_so_list (); so; so = so->next)
gdb_assert (so->objfile == NULL);
- ALL_OBJFILES_SAFE (objfile, temp)
- {
+ for (objfile *objfile : all_objfiles_safe (current_program_space))
delete objfile;
- }
clear_symtab_users (0);
}
@@ -1047,17 +1044,14 @@ have_full_symbols (void)
void
objfile_purge_solibs (void)
{
- struct objfile *objf;
- struct objfile *temp;
-
- ALL_OBJFILES_SAFE (objf, temp)
- {
- /* We assume that the solib package has been purged already, or will
- be soon. */
+ for (objfile *objf : all_objfiles_safe (current_program_space))
+ {
+ /* We assume that the solib package has been purged already, or will
+ be soon. */
- if (!(objf->flags & OBJF_USERLOADED) && (objf->flags & OBJF_SHARED))
- delete objf;
- }
+ if (!(objf->flags & OBJF_USERLOADED) && (objf->flags & OBJF_SHARED))
+ delete objf;
+ }
}