1 //===-- ThreadList.h --------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ThreadList_h_
11 #define liblldb_ThreadList_h_
15 #include "lldb/lldb-private.h"
16 #include "lldb/Core/UserID.h"
17 #include "lldb/Utility/Iterable.h"
18 #include "lldb/Target/ThreadCollection.h"
20 namespace lldb_private {
22 // This is a thread list with lots of functionality for use only by the process
23 // for which this is the thread list. A generic container class with iterator
24 // functionality is ThreadCollection.
25 class ThreadList : public ThreadCollection
31 ThreadList (Process *process);
33 ThreadList (const ThreadList &rhs);
39 operator = (const ThreadList& rhs);
42 GetSize(bool can_update = true);
44 // Return the selected thread if there is one. Otherwise, return the thread
45 // selected at index 0.
50 SetSelectedThreadByID (lldb::tid_t tid, bool notify = false);
53 SetSelectedThreadByIndexID (uint32_t index_id, bool notify = false);
64 // Note that "idx" is not the same as the "thread_index". It is a zero
65 // based index to accessing the current threads, whereas "thread_index"
66 // is a unique index assigned
68 GetThreadAtIndex (uint32_t idx, bool can_update = true);
71 FindThreadByID (lldb::tid_t tid, bool can_update = true);
74 FindThreadByProtocolID (lldb::tid_t tid, bool can_update = true);
77 RemoveThreadByID (lldb::tid_t tid, bool can_update = true);
80 RemoveThreadByProtocolID (lldb::tid_t tid, bool can_update = true);
83 FindThreadByIndexID (uint32_t index_id, bool can_update = true);
86 GetThreadSPForThreadPtr (Thread *thread_ptr);
89 ShouldStop (Event *event_ptr);
92 ShouldReportStop (Event *event_ptr);
95 ShouldReportRun (Event *event_ptr);
98 RefreshStateAfterStop ();
100 //------------------------------------------------------------------
101 /// The thread list asks tells all the threads it is about to resume.
102 /// If a thread can "resume" without having to resume the target, it
103 /// will return false for WillResume, and then the process will not be
107 /// \b true instructs the process to resume normally,
108 /// \b false means start & stopped events will be generated, but
109 /// the process will not actually run. The thread must then return
110 /// the correct StopInfo when asked.
112 //------------------------------------------------------------------
123 DiscardThreadPlans();
129 SetStopID (uint32_t stop_id);
135 Update (ThreadList &rhs);
140 SetShouldReportStop (Vote vote);
143 NotifySelectedThreadChanged (lldb::tid_t tid);
145 //------------------------------------------------------------------
146 // Classes that inherit from Process can see and modify these
147 //------------------------------------------------------------------
148 Process *m_process; ///< The process that manages this thread list.
149 uint32_t m_stop_id; ///< The process stop ID that this thread list is valid for.
150 lldb::tid_t m_selected_tid; ///< For targets that need the notion of a current thread.
156 } // namespace lldb_private
158 #endif // liblldb_ThreadList_h_