LLDB mainline
lldb_private::StoppedExecutionContext Struct Reference

A wrapper class representing an execution context with non-null Target and Process pointers, a locked API mutex and a locked ProcessRunLock. More...

#include <ExecutionContext.h>

Inheritance diagram for lldb_private::StoppedExecutionContext:
[legend]

Public Member Functions

 StoppedExecutionContext (lldb::TargetSP &target_sp, lldb::ProcessSP &process_sp, lldb::ThreadSP &thread_sp, lldb::StackFrameSP &frame_sp, TargetAPIMutex api_mutex, std::unique_lock< TargetAPIMutex > locker, ProcessRunLock::ProcessRunLocker stop_locker)
 locker is consumed purely for its side effect: moving a std::unique_lock disarms the source, so the caller's own locker (which referenced api_mutex before it was moved here) stops believing it owns the lock, without an explicit release() call at the call site.
 StoppedExecutionContext (StoppedExecutionContext &&other)
 Transfers ownership of the locks from other to this, making other unusable.
TargetAPIMutex AllowResume ()
 Clears this context, unlocking the ProcessRunLock and returning the locked API lock, allowing callers to resume the process.
Public Member Functions inherited from lldb_private::ExecutionContext
 ExecutionContext ()
 Default Constructor.
 ExecutionContext (const ExecutionContext &rhs)
 ExecutionContext (Target *t, bool fill_current_process_thread_frame=true)
 ExecutionContext (const lldb::TargetSP &target_sp, bool get_process)
 ExecutionContext (const lldb::ProcessSP &process_sp)
 ExecutionContext (const lldb::ThreadSP &thread_sp)
 ExecutionContext (const lldb::StackFrameSP &frame_sp)
 ExecutionContext (const lldb::TargetWP &target_wp, bool get_process)
 ExecutionContext (const lldb::ProcessWP &process_wp)
 ExecutionContext (const lldb::ThreadWP &thread_wp)
 ExecutionContext (const lldb::StackFrameWP &frame_wp)
 ExecutionContext (const ExecutionContextRef &exe_ctx_ref)
 ExecutionContext (const ExecutionContextRef *exe_ctx_ref, bool thread_and_frame_only_if_stopped=false)
 ExecutionContext (ExecutionContextScope *exe_scope)
 ExecutionContext (ExecutionContextScope &exe_scope)
 ExecutionContext (Process *process, Thread *thread=nullptr, StackFrame *frame=nullptr)
 Construct with process, thread, and frame index.
 ~ExecutionContext ()
ExecutionContextoperator= (const ExecutionContext &rhs)
bool operator== (const ExecutionContext &rhs) const
bool operator!= (const ExecutionContext &rhs) const
void Clear ()
 Clear the object's state.
RegisterContextGetRegisterContext () const
ExecutionContextScopeGetBestExecutionContextScope () const
uint32_t GetAddressByteSize () const
lldb::ByteOrder GetByteOrder () const
TargetGetTargetPtr () const
 Returns a pointer to the target object.
ProcessGetProcessPtr () const
 Returns a pointer to the process object.
ThreadGetThreadPtr () const
 Returns a pointer to the thread object.
StackFrameGetFramePtr () const
 Returns a pointer to the frame object.
TargetGetTargetRef () const
 Returns a reference to the target object.
ProcessGetProcessRef () const
 Returns a reference to the process object.
ThreadGetThreadRef () const
 Returns a reference to the thread object.
StackFrameGetFrameRef () const
 Returns a reference to the thread object.
const lldb::TargetSPGetTargetSP () const
 Get accessor to get the target shared pointer.
const lldb::ProcessSPGetProcessSP () const
 Get accessor to get the process shared pointer.
const lldb::ThreadSPGetThreadSP () const
 Get accessor to get the thread shared pointer.
const lldb::StackFrameSPGetFrameSP () const
 Get accessor to get the frame shared pointer.
void SetTargetSP (const lldb::TargetSP &target_sp)
 Set accessor to set only the target shared pointer.
void SetProcessSP (const lldb::ProcessSP &process_sp)
 Set accessor to set only the process shared pointer.
void SetThreadSP (const lldb::ThreadSP &thread_sp)
 Set accessor to set only the thread shared pointer.
void SetFrameSP (const lldb::StackFrameSP &frame_sp)
 Set accessor to set only the frame shared pointer.
void SetTargetPtr (Target *target)
 Set accessor to set only the target shared pointer from a target pointer.
void SetProcessPtr (Process *process)
 Set accessor to set only the process shared pointer from a process pointer.
void SetThreadPtr (Thread *thread)
 Set accessor to set only the thread shared pointer from a thread pointer.
void SetFramePtr (StackFrame *frame)
 Set accessor to set only the frame shared pointer from a frame pointer.
void SetContext (const lldb::TargetSP &target_sp, bool get_process)
void SetContext (const lldb::ProcessSP &process_sp)
void SetContext (const lldb::ThreadSP &thread_sp)
void SetContext (const lldb::StackFrameSP &frame_sp)
bool HasTargetScope () const
 Returns true the ExecutionContext object contains a valid target.
bool HasProcessScope () const
 Returns true the ExecutionContext object contains a valid target and process.
bool HasThreadScope () const
 Returns true the ExecutionContext object contains a valid target, process, and thread.
bool HasFrameScope () const
 Returns true the ExecutionContext object contains a valid target, process, thread and frame.

Private Attributes

TargetAPIMutex m_api_mutex
std::unique_lock< TargetAPIMutexm_api_locker
ProcessRunLock::ProcessRunLocker m_stop_locker

Additional Inherited Members

Protected Attributes inherited from lldb_private::ExecutionContext
lldb::TargetSP m_target_sp
 The target that owns the process/thread/frame.
lldb::ProcessSP m_process_sp
 The process that owns the thread/frame.
lldb::ThreadSP m_thread_sp
 The thread that owns the frame.
lldb::StackFrameSP m_frame_sp
 The stack frame in thread.

Detailed Description

A wrapper class representing an execution context with non-null Target and Process pointers, a locked API mutex and a locked ProcessRunLock.

The locks are private by design: to unlock them, destroy the StoppedExecutionContext.

Definition at line 568 of file ExecutionContext.h.

Constructor & Destructor Documentation

◆ StoppedExecutionContext() [1/2]

lldb_private::StoppedExecutionContext::StoppedExecutionContext ( lldb::TargetSP & target_sp,
lldb::ProcessSP & process_sp,
lldb::ThreadSP & thread_sp,
lldb::StackFrameSP & frame_sp,
TargetAPIMutex api_mutex,
std::unique_lock< TargetAPIMutex > locker,
ProcessRunLock::ProcessRunLocker stop_locker )
inline

locker is consumed purely for its side effect: moving a std::unique_lock disarms the source, so the caller's own locker (which referenced api_mutex before it was moved here) stops believing it owns the lock, without an explicit release() call at the call site.

m_api_locker re-adopts the lock against this object's own m_api_mutex, since a unique_lock can't be retargeted by moving it.

Definition at line 575 of file ExecutionContext.h.

References m_api_locker, m_api_mutex, m_stop_locker, lldb_private::ExecutionContext::SetFrameSP(), lldb_private::ExecutionContext::SetProcessSP(), lldb_private::ExecutionContext::SetTargetSP(), and lldb_private::ExecutionContext::SetThreadSP().

Referenced by StoppedExecutionContext().

◆ StoppedExecutionContext() [2/2]

lldb_private::StoppedExecutionContext::StoppedExecutionContext ( StoppedExecutionContext && other)
inline

Member Function Documentation

◆ AllowResume()

TargetAPIMutex StoppedExecutionContext::AllowResume ( )
nodiscard

Clears this context, unlocking the ProcessRunLock and returning the locked API lock, allowing callers to resume the process.

Similar to a move operation, this object is no longer usable.

Definition at line 177 of file ExecutionContext.cpp.

References lldb_private::ExecutionContext::Clear(), m_api_locker, m_api_mutex, m_stop_locker, and lldb_private::ProcessRunLock::ProcessRunLocker.

Referenced by ResumeNewPlan().

Member Data Documentation

◆ m_api_locker

std::unique_lock<TargetAPIMutex> lldb_private::StoppedExecutionContext::m_api_locker
private

◆ m_api_mutex

TargetAPIMutex lldb_private::StoppedExecutionContext::m_api_mutex
private

◆ m_stop_locker

ProcessRunLock::ProcessRunLocker lldb_private::StoppedExecutionContext::m_stop_locker
private

The documentation for this struct was generated from the following files: