diff options
Diffstat (limited to 'lldb/include')
-rw-r--r-- | lldb/include/lldb/Target/ExecutionContext.h | 36 | ||||
-rw-r--r-- | lldb/include/lldb/Target/Process.h | 15 | ||||
-rw-r--r-- | lldb/include/lldb/Target/Thread.h | 2 |
3 files changed, 28 insertions, 25 deletions
diff --git a/lldb/include/lldb/Target/ExecutionContext.h b/lldb/include/lldb/Target/ExecutionContext.h index 880de01c689..354c8b62905 100644 --- a/lldb/include/lldb/Target/ExecutionContext.h +++ b/lldb/include/lldb/Target/ExecutionContext.h @@ -37,6 +37,7 @@ #include "lldb/lldb-private.h" #include "lldb/Target/StackID.h" +#include "lldb/Host/Mutex.h" namespace lldb_private { @@ -254,10 +255,7 @@ public: /// A shared pointer to a target that is not guaranteed to be valid. //------------------------------------------------------------------ lldb::TargetSP - GetTargetSP () const - { - return m_target_wp.lock(); - } + GetTargetSP () const; //------------------------------------------------------------------ /// Get accessor that creates a strong reference from the weak process @@ -267,10 +265,7 @@ public: /// A shared pointer to a process that is not guaranteed to be valid. //------------------------------------------------------------------ lldb::ProcessSP - GetProcessSP () const - { - return m_process_wp.lock(); - } + GetProcessSP () const; //------------------------------------------------------------------ /// Get accessor that creates a strong reference from the weak thread @@ -410,6 +405,11 @@ public: ExecutionContext (const lldb::StackFrameWP &frame_wp); ExecutionContext (const ExecutionContextRef &exe_ctx_ref); ExecutionContext (const ExecutionContextRef *exe_ctx_ref); + + // These two variants take in a locker, and grab the target, lock the API mutex into locker, then + // fill in the rest of the shared pointers. + ExecutionContext (const ExecutionContextRef &exe_ctx_ref, Mutex::Locker &locker); + ExecutionContext (const ExecutionContextRef *exe_ctx_ref, Mutex::Locker &locker); //------------------------------------------------------------------ // Create execution contexts from execution context scopes //------------------------------------------------------------------ @@ -727,10 +727,7 @@ public: /// GetTargetRef() do not need to be checked for validity. //------------------------------------------------------------------ bool - HasTargetScope () const - { - return (bool) m_target_sp; - } + HasTargetScope () const; //------------------------------------------------------------------ /// Returns true the ExecutionContext object contains a valid @@ -742,10 +739,7 @@ public: /// need to be checked for validity. //------------------------------------------------------------------ bool - HasProcessScope () const - { - return m_target_sp && m_process_sp; - } + HasProcessScope () const; //------------------------------------------------------------------ /// Returns true the ExecutionContext object contains a valid @@ -757,10 +751,7 @@ public: /// and GetThreadRef() do not need to be checked for validity. //------------------------------------------------------------------ bool - HasThreadScope () const - { - return m_target_sp && m_process_sp && m_thread_sp; - } + HasThreadScope () const; //------------------------------------------------------------------ /// Returns true the ExecutionContext object contains a valid @@ -773,10 +764,7 @@ public: /// to be checked for validity. //------------------------------------------------------------------ bool - HasFrameScope () const - { - return m_target_sp && m_process_sp && m_thread_sp && m_frame_sp; - } + HasFrameScope () const; protected: //------------------------------------------------------------------ diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 6bd9c8a2f8e..b6e87855d8e 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -1563,6 +1563,20 @@ public: //------------------------------------------------------------------ virtual void Finalize(); + + + //------------------------------------------------------------------ + /// Return whether this object is valid (i.e. has not been finalized.) + /// + /// @return + /// Returns \b true if this Process has not been finalized + /// and \b false otherwise. + //------------------------------------------------------------------ + bool + IsValid() const + { + return !m_finalize_called; + } //------------------------------------------------------------------ /// Launch a new process. @@ -3366,6 +3380,7 @@ protected: std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions; ReadWriteLock m_run_lock; Predicate<bool> m_currently_handling_event; + bool m_finalize_called; enum { eCanJITDontKnow= 0, diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 6049dce9884..b8d4859a8cf 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -692,7 +692,7 @@ public: bool IsValid () const { - return m_destroy_called; + return !m_destroy_called; } // When you implement this method, make sure you don't overwrite the m_actual_stop_info if it claims to be |