diff options
Diffstat (limited to 'lldb/include/lldb/Target/ThreadPlan.h')
-rw-r--r-- | lldb/include/lldb/Target/ThreadPlan.h | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/lldb/include/lldb/Target/ThreadPlan.h b/lldb/include/lldb/Target/ThreadPlan.h index ff87ed23cda5..8c2f9776eeb3 100644 --- a/lldb/include/lldb/Target/ThreadPlan.h +++ b/lldb/include/lldb/Target/ThreadPlan.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_ThreadPlan_h_ -#define liblldb_ThreadPlan_h_ +#ifndef LLDB_TARGET_THREADPLAN_H +#define LLDB_TARGET_THREADPLAN_H #include <mutex> #include <string> @@ -251,7 +251,7 @@ namespace lldb_private { // However, if the plan doesn't want to be // the stop reason, then it can call SetPlanComplete and pass in "false" for // the "success" parameter. In that case, -// the real stop reason will be used instead. One exapmle of this is the +// the real stop reason will be used instead. One example of this is the // "StepRangeStepIn" thread plan. If it stops // because of a crash or breakpoint hit, it wants to unship itself, because it // isn't so useful to have step in keep going @@ -369,16 +369,16 @@ public: /// /// \return /// A pointer to the thread plan's owning thread. - Thread &GetThread() { return m_thread; } + Thread &GetThread(); - const Thread &GetThread() const { return m_thread; } + Target &GetTarget(); - Target &GetTarget() { return m_thread.GetProcess()->GetTarget(); } - - const Target &GetTarget() const { return m_thread.GetProcess()->GetTarget(); } + const Target &GetTarget() const; /// Print a description of this thread to the stream \a s. - /// \a thread. + /// \a thread. Don't expect that the result of GetThread is valid in + /// the description method. This might get called when the underlying + /// Thread has not been reported, so we only know the TID and not the thread. /// /// \param[in] s /// The stream to which to print the description. @@ -461,8 +461,12 @@ public: virtual void WillPop(); // This pushes a plan onto the plan stack of the current plan's thread. + // Also sets the plans to private and not master plans. A plan pushed by + // another thread plan is never either of the above. void PushPlan(lldb::ThreadPlanSP &thread_plan_sp) { - m_thread.PushPlan(thread_plan_sp); + GetThread().PushPlan(thread_plan_sp); + thread_plan_sp->SetPrivate(false); + thread_plan_sp->SetIsMasterPlan(false); } ThreadPlanKind GetKind() const { return m_kind; } @@ -493,7 +497,9 @@ public: // original stop reason so that stopping and calling a few functions won't // lose the history of the run. This call can be implemented to get you back // to the real stop info. - virtual lldb::StopInfoSP GetRealStopInfo() { return m_thread.GetStopInfo(); } + virtual lldb::StopInfoSP GetRealStopInfo() { + return GetThread().GetStopInfo(); + } // If the completion of the thread plan stepped out of a function, the return // value of the function might have been captured by the thread plan @@ -556,17 +562,17 @@ protected: // This is mostly a formal requirement, it allows us to make the Thread's // GetPreviousPlan protected, but only friend ThreadPlan to thread. - ThreadPlan *GetPreviousPlan() { return m_thread.GetPreviousPlan(this); } + ThreadPlan *GetPreviousPlan() { return GetThread().GetPreviousPlan(this); } // This forwards the private Thread::GetPrivateStopInfo which is generally // what ThreadPlan's need to know. lldb::StopInfoSP GetPrivateStopInfo() { - return m_thread.GetPrivateStopInfo(); + return GetThread().GetPrivateStopInfo(); } void SetStopInfo(lldb::StopInfoSP stop_reason_sp) { - m_thread.SetStopInfo(stop_reason_sp); + GetThread().SetStopInfo(stop_reason_sp); } void CachePlanExplainsStop(bool does_explain) { @@ -582,7 +588,8 @@ protected: bool IsUsuallyUnexplainedStopReason(lldb::StopReason); Status m_status; - Thread &m_thread; + Process &m_process; + lldb::tid_t m_tid; Vote m_stop_vote; Vote m_run_vote; bool m_takes_iteration_count; @@ -593,6 +600,9 @@ private: // For ThreadPlan only static lldb::user_id_t GetNextID(); + Thread *m_thread; // Stores a cached value of the thread, which is set to + // nullptr when the thread resumes. Don't use this anywhere + // but ThreadPlan::GetThread(). ThreadPlanKind m_kind; std::string m_name; std::recursive_mutex m_plan_complete_mutex; @@ -605,8 +615,8 @@ private: lldb::ThreadPlanTracerSP m_tracer_sp; -private: - DISALLOW_COPY_AND_ASSIGN(ThreadPlan); + ThreadPlan(const ThreadPlan &) = delete; + const ThreadPlan &operator=(const ThreadPlan &) = delete; }; // ThreadPlanNull: @@ -641,9 +651,10 @@ protected: lldb::StateType GetPlanRunState() override; - DISALLOW_COPY_AND_ASSIGN(ThreadPlanNull); + ThreadPlanNull(const ThreadPlanNull &) = delete; + const ThreadPlanNull &operator=(const ThreadPlanNull &) = delete; }; } // namespace lldb_private -#endif // liblldb_ThreadPlan_h_ +#endif // LLDB_TARGET_THREADPLAN_H |