diff options
Diffstat (limited to 'gdb/progspace.h')
-rw-r--r-- | gdb/progspace.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/progspace.h b/gdb/progspace.h index abc53973b6f..472baeb9a16 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -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; |