X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fprogspace.h;h=472baeb9a169d98af4d34a4fbda62f752ccf9dbd;hb=7e955d83c4128ec773d84b92487ed1cdfed09938;hp=abc53973b6fb733d75c4e32d49fc6c8928149f79;hpb=2030c079717475f5b6fad837bb81758891f3b802;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/progspace.h b/gdb/progspace.h index abc53973b6..472baeb9a1 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>> + 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;