Index: lldb/include/lldb/Target/TargetList.h =================================================================== --- lldb/include/lldb/Target/TargetList.h +++ lldb/include/lldb/Target/TargetList.h @@ -14,6 +14,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/Broadcaster.h" +#include "lldb/Utility/Iterable.h" namespace lldb_private { @@ -42,6 +43,11 @@ return GetStaticBroadcasterClass(); } + typedef std::vector collection; + typedef LockingAdaptedIterable + TargetIterable; + /// Create a new Target. /// /// Clients must use this function to create a Target. This allows @@ -179,14 +185,15 @@ lldb::TargetSP GetSelectedTarget(); -protected: - typedef std::vector collection; - // Member variables. + TargetIterable Targets() { + return TargetIterable(m_target_list, m_target_list_mutex); + } + +private: collection m_target_list; mutable std::recursive_mutex m_target_list_mutex; uint32_t m_selected_target_idx; -private: static Status CreateTargetInternal( Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, LoadDependentFiles load_dependent_files,