Change all_objfiles_safe adapter to be a method on program_space
This changes the all_objfiles_safe range adapter to be a method on the program space, and fixes up all the users. gdb/ChangeLog 2019-01-15 Tom Tromey <tom@tromey.com> * progspace.h (program_space) <objfiles_safe_range>: New typedef. <objfiles_safe>: New method. * objfiles.h (class all_objfiles_safe): Remove. * objfiles.c (free_all_objfiles, objfile_purge_solibs): Update. * jit.c (jit_inferior_exit_hook): Update.
This commit is contained in:
parent
2030c07971
commit
7e955d83c4
5 changed files with 33 additions and 28 deletions
|
@ -26,6 +26,8 @@
|
|||
#include "gdb_bfd.h"
|
||||
#include "gdb_vecs.h"
|
||||
#include "registry.h"
|
||||
#include "common/next-iterator.h"
|
||||
#include "common/safe-iterator.h"
|
||||
|
||||
struct target_ops;
|
||||
struct bfd;
|
||||
|
@ -148,6 +150,22 @@ struct program_space
|
|||
return objfiles_range (objfiles_head);
|
||||
}
|
||||
|
||||
typedef next_adapter<struct objfile,
|
||||
basic_safe_iterator<next_iterator<objfile>>>
|
||||
objfiles_safe_range;
|
||||
|
||||
/* An iterable object that can be used to iterate over all objfiles.
|
||||
The basic use is in a foreach, like:
|
||||
|
||||
for (objfile *objf : pspace->objfiles_safe ()) { ... }
|
||||
|
||||
This variant uses a basic_safe_iterator so that objfiles can be
|
||||
deleted during iteration. */
|
||||
objfiles_safe_range objfiles_safe ()
|
||||
{
|
||||
return objfiles_safe_range (objfiles_head);
|
||||
}
|
||||
|
||||
/* Pointer to next in linked list. */
|
||||
struct program_space *next = NULL;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue