81 bool fill_current_process_thread_frame)
85 if (fill_current_process_thread_frame) {
117 bool thread_and_frame_only_if_stopped)
119 if (exe_ctx_ref_ptr) {
122 if (!thread_and_frame_only_if_stopped ||
130llvm::Expected<StoppedExecutionContext>
136llvm::Expected<StoppedExecutionContext>
139 if (!exe_ctx_ref_ptr)
140 return llvm::createStringError(
141 "StoppedExecutionContext created with an empty ExecutionContextRef");
145 return llvm::createStringError(
146 "StoppedExecutionContext created with a null target");
149 std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
153 return llvm::createStringError(
154 "StoppedExecutionContext created with a null process");
157 if (!stop_locker.
TryLock(&process_sp->GetRunLock()))
158 return llvm::createStringError(
159 "attempted to create a StoppedExecutionContext with a running process");
162 auto frame_sp = exe_ctx_ref_ptr->
GetFrameSP();
164 std::move(api_lock), std::move(stop_locker));
194 return m_target_sp->GetArchitecture().GetAddressByteSize();
197 return sizeof(
void *);
202 return m_target_sp->GetArchitecture().GetByteOrder();
210 return m_frame_sp->GetRegisterContext().get();
309 if (get_process && target_sp)
320 m_target_sp = process_sp->GetTarget().shared_from_this();
394 return !(*
this == rhs);
455 m_tid = thread_sp->GetID();
482 SetTargetSP(process_sp->GetTarget().shared_from_this());
492 m_tid = thread_sp->GetID();
519 if (adopt_selected) {
529 if (stop_locker.
TryLock(&process_sp->GetRunLock()) &&
532 process_sp->GetThreadList().GetSelectedThread());
534 thread_sp = process_sp->GetThreadList().GetThreadAtIndex(0);
541 frame_sp = thread_sp->GetStackFrameAtIndex(0);
581 if (target_sp && !target_sp->IsValid())
588 if (process_sp && !process_sp->IsValid())
600 if (!thread_sp || !thread_sp->IsValid()) {
602 if (process_sp && process_sp->IsValid()) {
603 thread_sp = process_sp->GetThreadList().FindThreadByID(
m_tid);
612 if (thread_sp && !thread_sp->IsValid())
622 return thread_sp->GetFrameWithStackID(
m_stack_id);
Execution context objects refer to objects in the execution of the program that is being debugged.
StackID m_stack_id
The stack ID that this object refers to in case the backing object changes.
ExecutionContext Lock(bool thread_and_frame_only_if_stopped) const
Create an ExecutionContext object from this object.
void SetThreadSP(const lldb::ThreadSP &thread_sp)
Set accessor that creates a weak reference to the thread referenced in thread_sp.
void Clear()
Clear the object's state.
lldb::StackFrameSP GetFrameSP() const
Get accessor that creates a strong reference from the weak frame reference contained in this object.
void SetThreadPtr(Thread *thread)
lldb::ProcessWP m_process_wp
A weak reference to a process.
lldb::ThreadSP GetThreadSP() const
Get accessor that creates a strong reference from the weak thread reference contained in this object.
void SetFrameSP(const lldb::StackFrameSP &frame_sp)
Set accessor that creates a weak reference to the frame referenced in frame_sp.
lldb::tid_t m_tid
The thread ID that this object refers to in case the backing object changes.
lldb::TargetSP GetTargetSP() const
Get accessor that creates a strong reference from the weak target reference contained in this object.
void SetTargetPtr(Target *target, bool adopt_selected)
lldb::ProcessSP GetProcessSP() const
Get accessor that creates a strong reference from the weak process reference contained in this object...
ExecutionContextRef & operator=(const ExecutionContextRef &rhs)
Assignment operator.
void SetProcessPtr(Process *process)
void SetFramePtr(StackFrame *frame)
ExecutionContextRef()
Default Constructor.
void SetTargetSP(const lldb::TargetSP &target_sp)
Set accessor that creates a weak reference to the target referenced in target_sp.
lldb::TargetWP m_target_wp
A weak reference to a target.
void SetProcessSP(const lldb::ProcessSP &process_sp)
Set accessor that creates a weak reference to the process referenced in process_sp.
lldb::ThreadWP m_thread_wp
A weak reference to a thread.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
virtual void CalculateExecutionContext(ExecutionContext &exe_ctx)=0
Reconstruct the object's execution context into sc.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void SetFrameSP(const lldb::StackFrameSP &frame_sp)
Set accessor to set only the frame shared pointer.
bool HasThreadScope() const
Returns true the ExecutionContext object contains a valid target, process, and thread.
void SetProcessPtr(Process *process)
Set accessor to set only the process shared pointer from a process pointer.
bool HasProcessScope() const
Returns true the ExecutionContext object contains a valid target and process.
ExecutionContextScope * GetBestExecutionContextScope() const
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
void Clear()
Clear the object's state.
ExecutionContext()
Default Constructor.
uint32_t GetAddressByteSize() const
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
void SetProcessSP(const lldb::ProcessSP &process_sp)
Set accessor to set only the process shared pointer.
lldb::StackFrameSP m_frame_sp
The stack frame in thread.
bool operator==(const ExecutionContext &rhs) const
void SetThreadPtr(Thread *thread)
Set accessor to set only the thread shared pointer from a thread pointer.
lldb::ByteOrder GetByteOrder() const
void SetTargetPtr(Target *target)
Set accessor to set only the target shared pointer from a target pointer.
lldb::TargetSP m_target_sp
The target that owns the process/thread/frame.
const lldb::StackFrameSP & GetFrameSP() const
Get accessor to get the frame shared pointer.
Process & GetProcessRef() const
Returns a reference to the process object.
void SetContext(const lldb::TargetSP &target_sp, bool get_process)
void SetTargetSP(const lldb::TargetSP &target_sp)
Set accessor to set only the target shared pointer.
Target * GetTargetPtr() const
Returns a pointer to the target object.
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
void SetThreadSP(const lldb::ThreadSP &thread_sp)
Set accessor to set only the thread shared pointer.
bool HasTargetScope() const
Returns true the ExecutionContext object contains a valid target.
StackFrame & GetFrameRef() const
Returns a reference to the thread object.
bool HasFrameScope() const
Returns true the ExecutionContext object contains a valid target, process, thread and frame.
lldb::ThreadSP m_thread_sp
The thread that owns the frame.
lldb::ProcessSP m_process_sp
The process that owns the thread/frame.
bool operator!=(const ExecutionContext &rhs) const
Target & GetTargetRef() const
Returns a reference to the target object.
void SetFramePtr(StackFrame *frame)
Set accessor to set only the frame shared pointer from a frame pointer.
ExecutionContext & operator=(const ExecutionContext &rhs)
Process * GetProcessPtr() const
Returns a pointer to the process object.
Thread & GetThreadRef() const
Returns a reference to the thread object.
RegisterContext * GetRegisterContext() const
bool TryLock(ProcessRunLock *lock)
A plug-in interface definition class for debugging a process.
ProcessRunLock::ProcessRunLocker StopLocker
Target & GetTarget()
Get the target object pointer for this module.
This base class provides an interface to stack frames.
const lldb::ProcessSP & GetProcessSP() const
#define LLDB_INVALID_THREAD_ID
@ DoNoSelectMostRelevantFrame
lldb::ByteOrder InlHostByteOrder()
A class that represents a running process on the host machine.
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
llvm::Expected< StoppedExecutionContext > GetStoppedExecutionContext(const ExecutionContextRef *exe_ctx_ref_ptr)
std::weak_ptr< lldb_private::StackFrame > StackFrameWP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::Process > ProcessSP
ByteOrder
Byte ordering definitions.
std::weak_ptr< lldb_private::Process > ProcessWP
std::weak_ptr< lldb_private::Target > TargetWP
std::shared_ptr< lldb_private::Target > TargetSP
std::weak_ptr< lldb_private::Thread > ThreadWP
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP
A wrapper class representing an execution context with non-null Target and Process pointers,...
ProcessRunLock::ProcessRunLocker m_stop_locker
std::unique_lock< std::recursive_mutex > m_api_lock
std::unique_lock< std::recursive_mutex > AllowResume()
Clears this context, unlocking the ProcessRunLock and returning the locked API lock,...