diff options
Diffstat (limited to 'include/lldb/Target/Thread.h')
-rw-r--r-- | include/lldb/Target/Thread.h | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h index 25c0c0e92bec..c6a3c8e9851a 100644 --- a/include/lldb/Target/Thread.h +++ b/include/lldb/Target/Thread.h @@ -205,22 +205,23 @@ public: void SetState (lldb::StateType state); - lldb::StateType - GetResumeState () const - { - return m_resume_state; - } - - // This sets the "external resume state" of the thread. If the thread is suspended here, it should never - // get scheduled. Note that just because a thread is marked as "running" does not mean we will let it run in - // a given bit of process control. For instance "step" tries to stay on the selected thread it was issued on, - // which may involve suspending other threads temporarily. This temporary suspension is NOT reflected in the - // state set here and reported in GetResumeState. - // - // If you are just preparing all threads to run, you should not override the threads that are - // marked as suspended by the debugger. In that case, pass override_suspend = false. If you want - // to force the thread to run (e.g. the "thread continue" command, or are resetting the state - // (e.g. in SBThread::Resume()), then pass true to override_suspend. + //------------------------------------------------------------------ + /// Sets the USER resume state for this thread. If you set a thread to suspended with + /// this API, it won't take part in any of the arbitration for ShouldResume, and will stay + /// suspended even when other threads do get to run. + /// + /// N.B. This is not the state that is used internally by thread plans to implement + /// staying on one thread while stepping over a breakpoint, etc. The is the + /// TemporaryResume state, and if you are implementing some bit of strategy in the stepping + /// machinery you should be using that state and not the user resume state. + /// + /// If you are just preparing all threads to run, you should not override the threads that are + /// marked as suspended by the debugger. In that case, pass override_suspend = false. If you want + /// to force the thread to run (e.g. the "thread continue" command, or are resetting the state + /// (e.g. in SBThread::Resume()), then pass true to override_suspend. + /// @return + /// The User resume state for this thread. + //------------------------------------------------------------------ void SetResumeState (lldb::StateType state, bool override_suspend = false) { @@ -229,6 +230,21 @@ public: m_resume_state = state; } + //------------------------------------------------------------------ + /// Gets the USER resume state for this thread. This is not the same as what + /// this thread is going to do for any particular step, however if this thread + /// returns eStateSuspended, then the process control logic will never allow this + /// thread to run. + /// + /// @return + /// The User resume state for this thread. + //------------------------------------------------------------------ + lldb::StateType + GetResumeState () const + { + return m_resume_state; + } + // This function is called on all the threads before "ShouldResume" and // "WillResume" in case a thread needs to change its state before the // ThreadList polls all the threads to figure out which ones actually @@ -1315,8 +1331,8 @@ protected: lldb::ProcessWP m_process_wp; ///< The process that owns this thread. lldb::StopInfoSP m_stop_info_sp; ///< The private stop reason for this thread uint32_t m_stop_info_stop_id; // This is the stop id for which the StopInfo is valid. Can use this so you know that - uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time the stop info was checked against the stop info override // the thread's m_stop_info_sp is current and you don't have to fetch it again + uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time the stop info was checked against the stop info override const uint32_t m_index_id; ///< A unique 1 based index assigned to each thread for easy UI/command line access. lldb::RegisterContextSP m_reg_context_sp; ///< The register context for this thread's current register state. lldb::StateType m_state; ///< The state of our process. |