aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Target/ThreadList.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Target/ThreadList.h')
-rw-r--r--include/lldb/Target/ThreadList.h43
1 files changed, 41 insertions, 2 deletions
diff --git a/include/lldb/Target/ThreadList.h b/include/lldb/Target/ThreadList.h
index e6489b25e558..140fdaa444d0 100644
--- a/include/lldb/Target/ThreadList.h
+++ b/include/lldb/Target/ThreadList.h
@@ -10,12 +10,14 @@
#ifndef liblldb_ThreadList_h_
#define liblldb_ThreadList_h_
+#include <mutex>
#include <vector>
#include "lldb/lldb-private.h"
#include "lldb/Core/UserID.h"
#include "lldb/Utility/Iterable.h"
#include "lldb/Target/ThreadCollection.h"
+#include "lldb/Target/Thread.h"
namespace lldb_private {
@@ -44,7 +46,43 @@ public:
// selected at index 0.
lldb::ThreadSP
GetSelectedThread ();
+
+ // Manage the thread to use for running expressions. This is usually the Selected thread,
+ // but sometimes (e.g. when evaluating breakpoint conditions & stop hooks) it isn't.
+ class ExpressionExecutionThreadPusher
+ {
+ public:
+ ExpressionExecutionThreadPusher(ThreadList &thread_list, lldb::tid_t tid) :
+ m_thread_list(&thread_list),
+ m_tid(tid)
+ {
+ m_thread_list->PushExpressionExecutionThread(m_tid);
+ }
+
+ ExpressionExecutionThreadPusher(lldb::ThreadSP thread_sp);
+
+ ~ExpressionExecutionThreadPusher()
+ {
+ if (m_thread_list && m_tid != LLDB_INVALID_THREAD_ID)
+ m_thread_list->PopExpressionExecutionThread(m_tid);
+ }
+
+ private:
+ ThreadList *m_thread_list;
+ lldb::tid_t m_tid;
+ };
+ lldb::ThreadSP
+ GetExpressionExecutionThread();
+
+protected:
+ void
+ PushExpressionExecutionThread(lldb::tid_t tid);
+
+ void
+ PopExpressionExecutionThread(lldb::tid_t tid);
+
+public:
bool
SetSelectedThreadByID (lldb::tid_t tid, bool notify = false);
@@ -127,9 +165,9 @@ public:
void
SetStopID (uint32_t stop_id);
- Mutex &
+ std::recursive_mutex &
GetMutex() override;
-
+
void
Update (ThreadList &rhs);
@@ -147,6 +185,7 @@ protected:
Process *m_process; ///< The process that manages this thread list.
uint32_t m_stop_id; ///< The process stop ID that this thread list is valid for.
lldb::tid_t m_selected_tid; ///< For targets that need the notion of a current thread.
+ std::vector<lldb::tid_t> m_expression_tid_stack;
private: