LLDB mainline
lldb_private::Thread Class Referenceabstract

#include <Thread.h>

Inheritance diagram for lldb_private::Thread:
[legend]

Classes

class  ThreadEventData
struct  ThreadStateCheckpoint

Public Types

enum  {
  eBroadcastBitStackChanged = (1 << 0) , eBroadcastBitThreadSuspended = (1 << 1) , eBroadcastBitThreadResumed = (1 << 2) , eBroadcastBitSelectedFrameChanged = (1 << 3) ,
  eBroadcastBitThreadSelected = (1 << 4)
}
 Broadcaster event bits definitions. More...

Public Member Functions

llvm::StringRef GetBroadcasterClass () const override
 This needs to be filled in if you are going to register the broadcaster with the broadcaster manager and do broadcaster class matching.
 Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id=false)
 Constructor.
 ~Thread () override
lldb::ProcessSP GetProcess () const
int GetResumeSignal () const
void SetResumeSignal (int signal)
lldb::StateType GetState () const
void SetState (lldb::StateType state)
void SetResumeState (lldb::StateType state, bool override_suspend=false)
 Sets the USER resume state for this thread.
lldb::StateType GetResumeState () const
 Gets the USER resume state for this thread.
bool SetupToStepOverBreakpointIfNeeded (lldb::RunDirection direction)
bool ShouldResume (lldb::StateType resume_state)
virtual void WillResume (lldb::StateType resume_state)
virtual void DidResume ()
virtual void DidStop ()
virtual void RefreshStateAfterStop ()=0
std::string GetStopDescription ()
std::string GetStopDescriptionRaw ()
void WillStop ()
bool ShouldStop (Event *event_ptr)
Vote ShouldReportStop (Event *event_ptr)
Vote ShouldReportRun (Event *event_ptr)
void Flush ()
virtual bool MatchesSpec (const ThreadSpec *spec)
lldb::StopInfoSP GetStopInfo ()
lldb::StopReason GetStopReason ()
bool StopInfoIsUpToDate () const
void SetStopInfoToNothing ()
bool ThreadStoppedForAReason ()
virtual const char * GetInfo ()
StructuredData::ObjectSP GetExtendedInfo ()
 Retrieve a dictionary of information about this thread.
virtual const char * GetName ()
virtual void SetName (const char *name)
virtual lldb_private::LazyBool GetAssociatedWithLibdispatchQueue ()
 Whether this thread can be associated with a libdispatch queue.
virtual void SetAssociatedWithLibdispatchQueue (lldb_private::LazyBool associated_with_libdispatch_queue)
virtual lldb::queue_id_t GetQueueID ()
 Retrieve the Queue ID for the queue currently using this Thread.
virtual void SetQueueID (lldb::queue_id_t new_val)
virtual const char * GetQueueName ()
 Retrieve the Queue name for the queue currently using this Thread.
virtual void SetQueueName (const char *name)
virtual lldb::QueueKind GetQueueKind ()
 Retrieve the Queue kind for the queue currently using this Thread.
virtual void SetQueueKind (lldb::QueueKind kind)
virtual lldb::QueueSP GetQueue ()
 Retrieve the Queue for this thread, if any.
virtual lldb::addr_t GetQueueLibdispatchQueueAddress ()
 Retrieve the address of the libdispatch_queue_t struct for queue currently using this Thread.
virtual void SetQueueLibdispatchQueueAddress (lldb::addr_t dispatch_queue_t)
void SetThreadStoppedAtUnexecutedBP (lldb::addr_t pc)
 When a thread stops at an enabled BreakpointSite that has not executed, the Process plugin should call SetThreadStoppedAtUnexecutedBP(pc).
void SetThreadHitBreakpointSite ()
virtual bool ThreadHasQueueInformation () const
 Whether this Thread already has all the Queue information cached or not.
virtual uint32_t GetStackFrameCount ()
 GetStackFrameCount can be expensive.
virtual lldb::StackFrameSP GetStackFrameAtIndex (uint32_t idx)
virtual lldb::StackFrameSP GetFrameWithConcreteFrameIndex (uint32_t unwind_idx)
bool DecrementCurrentInlinedDepth ()
uint32_t GetCurrentInlinedDepth ()
Status ReturnFromFrameWithIndex (uint32_t frame_idx, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
Status ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
Status JumpToLine (const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings=nullptr)
virtual lldb::StackFrameSP GetFrameWithStackID (const StackID &stack_id)
uint32_t GetSelectedFrameIndex (SelectMostRelevant select_most_relevant)
lldb::StackFrameSP GetSelectedFrame (SelectMostRelevant select_most_relevant)
uint32_t SetSelectedFrame (lldb_private::StackFrame *frame, bool broadcast=false)
bool SetSelectedFrameByIndex (uint32_t frame_idx, bool broadcast=false)
bool SetSelectedFrameByIndexNoisily (uint32_t frame_idx, Stream &output_stream)
void ClearSelectedFrameIndex ()
 Resets the selected frame index of this object.
void SetDefaultFileAndLineToSelectedFrame ()
virtual lldb::RegisterContextSP GetRegisterContext ()=0
virtual lldb::RegisterContextSP CreateRegisterContextForFrame (StackFrame *frame)=0
virtual void ClearStackFrames ()
void SetBackedThread (Thread &backed_thread)
 Sets the thread that is backed by this thread.
void ClearBackedThread ()
lldb::ThreadSP GetBackedThread () const
 Returns the thread that is backed by this thread, if any.
virtual bool SetBackingThread (const lldb::ThreadSP &thread_sp)
virtual lldb::ThreadSP GetBackingThread () const
virtual void ClearBackingThread ()
void DumpTraceInstructions (Stream &s, size_t count, size_t start_position=0) const
 Dump count instructions of the thread's Trace starting at the start_position position in reverse order.
bool DumpUsingFormat (Stream &strm, uint32_t frame_idx, const FormatEntity::Entry *format)
 Print a description of this thread using the provided thread format.
void DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx, bool stop_format)
bool GetDescription (Stream &s, lldb::DescriptionLevel level, bool print_json_thread, bool print_json_stopinfo)
virtual Status StepIn (bool source_step, LazyBool step_in_avoids_code_without_debug_info=eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
 Default implementation for stepping into.
virtual Status StepOver (bool source_step, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
 Default implementation for stepping over.
virtual Status StepOut (uint32_t frame_idx=0)
 Default implementation for stepping out.
virtual lldb::addr_t GetThreadPointer ()
 Retrieves the per-thread data area.
virtual lldb::addr_t GetThreadLocalData (const lldb::ModuleSP module, lldb::addr_t tls_file_addr)
 Retrieves the per-module TLS block for a thread.
virtual bool SafeToCallFunctions ()
 Check whether this thread is safe to run functions.
lldb::ThreadPlanSP QueueBasePlan (bool abort_other_plans)
 Queues the base plan for a thread.
virtual lldb::ThreadPlanSP QueueThreadPlanForStepSingleInstruction (bool step_over, bool abort_other_plans, bool stop_other_threads, Status &status)
 Queues the plan used to step one instruction from the current PC of thread.
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange (bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, Status &status, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
 Queues the plan used to step through an address range, stepping over function calls.
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange (bool abort_other_plans, const LineEntry &line_entry, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, Status &status, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange (bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, const char *step_in_target, lldb::RunMode stop_other_threads, Status &status, LazyBool step_in_avoids_code_without_debug_info=eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
 Queues the plan used to step through an address range, stepping into functions.
virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange (bool abort_other_plans, const LineEntry &line_entry, const SymbolContext &addr_context, const char *step_in_target, lldb::RunMode stop_other_threads, Status &status, LazyBool step_in_avoids_code_without_debug_info=eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut (bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote, uint32_t frame_idx, Status &status, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
 Queue the plan used to step out of the function at the current PC of thread.
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop (bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote, uint32_t frame_idx, Status &status, bool continue_to_next_branch=false)
 Queue the plan used to step out of the function at the current PC of a thread.
virtual lldb::ThreadPlanSP QueueThreadPlanForStepThrough (StackID &return_stack_id, bool abort_other_plans, bool stop_other_threads, Status &status)
 Gets the plan used to step through the code that steps from a function call site at the current PC into the actual function call.
virtual lldb::ThreadPlanSP QueueThreadPlanForRunToAddress (bool abort_other_plans, Address &target_addr, bool stop_other_threads, Status &status)
 Gets the plan used to continue from the current PC.
virtual lldb::ThreadPlanSP QueueThreadPlanForStepUntil (bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses, bool stop_others, uint32_t frame_idx, Status &status)
virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted (bool abort_other_plans, const char *class_name, StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status)
void AutoCompleteThreadPlans (CompletionRequest &request) const
 Format the thread plan information for auto completion.
ThreadPlanGetCurrentPlan () const
 Gets the plan which will execute next on the plan stack.
Status UnwindInnermostExpression ()
 Unwinds the thread stack for the innermost expression plan currently on the thread plan stack.
lldb::ThreadPlanSP GetCompletedPlan () const
 Gets the outer-most plan that was popped off the plan stack in the most recent stop.
lldb::ValueObjectSP GetReturnValueObject () const
 Gets the outer-most return value from the completed plans.
lldb::ExpressionVariableSP GetExpressionVariable () const
 Gets the outer-most expression variable from the completed plans.
bool IsThreadPlanDone (ThreadPlan *plan) const
 Checks whether the given plan is in the completed plans for this stop.
bool WasThreadPlanDiscarded (ThreadPlan *plan) const
 Checks whether the given plan is in the discarded plans for this stop.
bool CompletedPlanOverridesBreakpoint () const
 Check if we have completed plan to override breakpoint stop reason.
Status QueueThreadPlan (lldb::ThreadPlanSP &plan_sp, bool abort_other_plans)
 Queues a generic thread plan.
void DiscardThreadPlans (bool force)
 Discards the plans queued on the plan stack of the current thread.
void DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp)
 Discards the plans queued on the plan stack of the current thread up to and including up_to_plan_sp.
void DiscardThreadPlansUpToPlan (ThreadPlan *up_to_plan_ptr)
bool DiscardUserThreadPlansUpToIndex (uint32_t thread_index)
 Discards the plans queued on the plan stack of the current thread up to and including the plan in that matches thread_index counting only the non-Private plans.
virtual bool CheckpointThreadState (ThreadStateCheckpoint &saved_state)
virtual bool RestoreRegisterStateFromCheckpoint (ThreadStateCheckpoint &saved_state)
void RestoreThreadStateFromCheckpoint (ThreadStateCheckpoint &saved_state)
uint32_t GetIndexID () const
virtual uint32_t GetExtendedBacktraceOriginatingIndexID ()
virtual lldb::user_id_t GetProtocolID () const
lldb::TargetSP CalculateTarget () override
lldb::ProcessSP CalculateProcess () override
lldb::ThreadSP CalculateThread () override
lldb::StackFrameSP CalculateStackFrame () override
void CalculateExecutionContext (ExecutionContext &exe_ctx) override
 Reconstruct the object's execution context into sc.
lldb::StackFrameSP GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr)
size_t GetStatus (Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, bool stop_format, bool show_hidden, bool only_stacks=false)
size_t GetStackFrameStatus (Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, uint32_t num_frames_with_source, bool show_hidden)
bool IsValid () const
virtual lldb::StopInfoSP GetPrivateStopInfo (bool calculate=true)
void CalculatePublicStopInfo ()
virtual bool CalculateStopInfo ()=0
 Ask the thread subclass to set its stop info.
lldb::StateType GetTemporaryResumeState () const
void SetStopInfo (const lldb::StopInfoSP &stop_info_sp)
void ResetStopInfo ()
void SetShouldReportStop (Vote vote)
void SetShouldRunBeforePublicStop (bool newval)
bool ShouldRunBeforePublicStop ()
virtual void SetExtendedBacktraceToken (uint64_t token)
 Sets the extended backtrace token for this thread.
virtual uint64_t GetExtendedBacktraceToken ()
 Gets the extended backtrace token for this thread.
lldb::ValueObjectSP GetCurrentException ()
lldb::ThreadSP GetCurrentExceptionBacktrace ()
lldb::ValueObjectSP GetSiginfoValue ()
std::optional< lldb::addr_tGetPreviousFrameZeroPC ()
 Request the pc value the thread had when previously stopped.
Public Member Functions inherited from lldb_private::ThreadProperties
 ThreadProperties (bool is_global)
 ~ThreadProperties () override
const RegularExpressionGetSymbolsToAvoidRegexp ()
 The regular expression returned determines symbols that this thread won't stop in during "step-in" operations.
FileSpecList GetLibrariesToAvoid () const
bool GetTraceEnabledState () const
bool GetStepInAvoidsNoDebug () const
bool GetStepOutAvoidsNoDebug () const
uint64_t GetMaxBacktraceDepth () const
uint64_t GetSingleThreadPlanTimeout () const
Public Member Functions inherited from lldb_private::Properties
 Properties ()
 Properties (const lldb::OptionValuePropertiesSP &collection_sp)
virtual ~Properties ()
lldb::OptionValuePropertiesSP GetValueProperties () const
virtual lldb::OptionValueSP GetPropertyValue (const ExecutionContext *exe_ctx, llvm::StringRef property_path, Status &error) const
virtual Status SetPropertyValue (const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef property_path, llvm::StringRef value)
virtual Status DumpPropertyValue (const ExecutionContext *exe_ctx, Stream &strm, llvm::StringRef property_path, uint32_t dump_mask, bool is_json=false)
virtual void DumpAllPropertyValues (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask, bool is_json=false)
virtual void DumpAllDescriptions (CommandInterpreter &interpreter, Stream &strm) const
size_t Apropos (llvm::StringRef keyword, std::vector< const Property * > &matching_properties) const
template<typename T>
GetPropertyAtIndexAs (uint32_t idx, T default_value, const ExecutionContext *exe_ctx=nullptr) const
template<typename T, typename U = typename std::remove_pointer<T>::type, std::enable_if_t< std::is_pointer_v< T >, bool > = true>
const U * GetPropertyAtIndexAs (uint32_t idx, const ExecutionContext *exe_ctx=nullptr) const
template<typename T>
bool SetPropertyAtIndex (uint32_t idx, T t, const ExecutionContext *exe_ctx=nullptr) const
Public Member Functions inherited from lldb_private::UserID
 UserID (lldb::user_id_t uid=LLDB_INVALID_UID)
 Construct with optional user ID.
 ~UserID ()=default
 Destructor.
void Clear ()
 Clears the object state.
lldb::user_id_t GetID () const
 Get accessor for the user ID.
void SetID (lldb::user_id_t uid)
 Set accessor for the user ID.
Public Member Functions inherited from lldb_private::ExecutionContextScope
virtual ~ExecutionContextScope ()=default
Public Member Functions inherited from lldb_private::Broadcaster
 Broadcaster (lldb::BroadcasterManagerSP manager_sp, std::string name)
 Construct with a broadcaster with a name.
virtual ~Broadcaster ()
 Destructor.
void CheckInWithManager ()
void BroadcastEvent (lldb::EventSP &event_sp)
 Broadcast an event which has no associated data.
void BroadcastEventIfUnique (lldb::EventSP &event_sp)
void BroadcastEvent (uint32_t event_type, const lldb::EventDataSP &event_data_sp)
void BroadcastEvent (uint32_t event_type)
void BroadcastEventIfUnique (uint32_t event_type)
void Clear ()
virtual void AddInitialEventsToListener (const lldb::ListenerSP &listener_sp, uint32_t requested_events)
uint32_t AddListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask)
 Listen for any events specified by event_mask.
const std::string & GetBroadcasterName ()
 Get this broadcaster's name.
bool GetEventNames (Stream &s, const uint32_t event_mask, bool prefix_with_broadcaster_name) const
 Get the event name(s) for one or more event bits.
void SetEventName (uint32_t event_mask, const char *name)
 Set the name for an event bit.
const char * GetEventName (uint32_t event_mask) const
bool EventTypeHasListeners (uint32_t event_type)
bool RemoveListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX)
 Removes a Listener from this broadcasters list and frees the event bits specified by event_mask that were previously acquired by listener (assuming listener was listening to this object) for other listener objects to use.
bool HijackBroadcaster (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX)
 Provides a simple mechanism to temporarily redirect events from broadcaster.
bool IsHijackedForEvent (uint32_t event_mask)
void RestoreBroadcaster ()
 Restore the state of the Broadcaster from a previous hijack attempt.
lldb::BroadcasterManagerSP GetManager ()
void SetPrimaryListener (lldb::ListenerSP listener_sp)
lldb::ListenerSP GetPrimaryListener ()

Static Public Member Functions

static llvm::StringRef GetStaticBroadcasterClass ()
static void SettingsInitialize ()
static void SettingsTerminate ()
static ThreadPropertiesGetGlobalProperties ()
static std::string RunModeAsString (lldb::RunMode mode)
static std::string StopReasonAsString (lldb::StopReason reason)
Static Public Member Functions inherited from lldb_private::Properties
static llvm::StringRef GetExperimentalSettingsName ()
static bool IsSettingExperimental (llvm::StringRef setting)

Protected Member Functions

virtual void DestroyThread ()
ThreadPlanStackGetPlans () const
void PushPlan (lldb::ThreadPlanSP plan_sp)
void PopPlan ()
void DiscardPlan ()
ThreadPlanGetPreviousPlan (ThreadPlan *plan) const
virtual UnwindGetUnwinder ()
virtual bool IsStillAtLastBreakpointHit ()
virtual bool IsOperatingSystemPluginThread () const
virtual lldb_private::StructuredData::ObjectSP FetchThreadExtendedInfo ()
lldb::StackFrameListSP GetStackFrameList ()
void SetTemporaryResumeState (lldb::StateType new_state)
void FrameSelectedCallback (lldb_private::StackFrame *frame)
virtual llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > GetSiginfo (size_t max_size) const
Protected Member Functions inherited from lldb_private::Broadcaster
BroadcasterImplSP GetBroadcasterImpl ()
const char * GetHijackingListenerName ()

Protected Attributes

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
uint32_t m_stop_info_override_stop_id
bool m_should_run_before_public_stop
lldb::addr_t m_stopped_at_unexecuted_bp
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.
std::recursive_mutex m_state_mutex
 Multithreaded protection for m_state.
std::recursive_mutex m_frame_mutex
 Multithreaded protection for m_state.
lldb::StackFrameListSP m_curr_frames_sp
 The stack frames that get lazily populated after a thread stops.
lldb::StackFrameListSP m_prev_frames_sp
 The previous stack frames from the last time this thread stopped.
std::optional< lldb::addr_tm_prev_framezero_pc
 Frame 0's PC the last time this thread was stopped.
int m_resume_signal
 The signal that should be used when continuing this thread.
lldb::StateType m_resume_state
 This state is used to force a thread to be suspended from outside the ThreadPlan logic.
lldb::StateType m_temporary_resume_state
 This state records what the thread was told to do by the thread plan logic for the current resume.
std::unique_ptr< lldb_private::Unwindm_unwinder_up
 It gets set in Thread::ShouldResume.
bool m_destroy_called
LazyBool m_override_should_notify
std::unique_ptr< ThreadPlanStackm_null_plan_stack_up
lldb::ThreadWP m_backed_thread
 The Thread backed by this thread, if any.
Protected Attributes inherited from lldb_private::Properties
lldb::OptionValuePropertiesSP m_collection_sp
Protected Attributes inherited from lldb_private::UserID
lldb::user_id_t m_uid
 The user ID that uniquely identifies an object.

Private Member Functions

void BroadcastSelectedFrameChange (StackID &new_frame_id)
 Thread (const Thread &)=delete
const Threadoperator= (const Thread &)=delete

Private Attributes

bool m_extended_info_fetched
StructuredData::ObjectSP m_extended_info

Friends

class ThreadPlan
class ThreadList
class ThreadEventData
class StackFrameList
class StackFrame
class OperatingSystem

Additional Inherited Members

Protected Types inherited from lldb_private::Broadcaster
typedef std::shared_ptr< BroadcasterImplBroadcasterImplSP
typedef std::weak_ptr< BroadcasterImplBroadcasterImplWP

Detailed Description

Definition at line 65 of file Thread.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Broadcaster event bits definitions.

Enumerator
eBroadcastBitStackChanged 
eBroadcastBitThreadSuspended 
eBroadcastBitThreadResumed 
eBroadcastBitSelectedFrameChanged 
eBroadcastBitThreadSelected 

Definition at line 72 of file Thread.h.

Constructor & Destructor Documentation

◆ Thread() [1/2]

Thread::Thread ( Process & process,
lldb::tid_t tid,
bool use_invalid_index_id = false )

Constructor.

Parameters
[in]use_invalid_index_idOptional parameter, defaults to false. The only subclass that is likely to set use_invalid_index_id == true is the HistoryThread class. In that case, the Thread we are constructing represents a thread from earlier in the program execution. We may have the tid of the original thread that they represent but we don't want to reuse the IndexID of that thread, or create a new one. If a client wants to know the original thread's IndexID, they should use Thread::GetExtendedBacktraceOriginatingIndexID().

Definition at line 219 of file Thread.cpp.

References lldb_private::Broadcaster::Broadcaster(), lldb_private::Broadcaster::CheckInWithManager(), lldb_private::eLazyBoolCalculate, lldb::eStateRunning, lldb::eStateUnloaded, lldb_private::UserID::GetID(), lldb_private::GetLog(), GetStaticBroadcasterClass(), LLDB_INVALID_ADDRESS, LLDB_INVALID_INDEX32, LLDB_INVALID_SIGNAL_NUMBER, LLDB_LOGF, m_curr_frames_sp, m_destroy_called, m_extended_info, m_extended_info_fetched, m_frame_mutex, m_index_id, m_override_should_notify, m_prev_frames_sp, m_prev_framezero_pc, m_process_wp, m_reg_context_sp, m_resume_signal, m_resume_state, m_should_run_before_public_stop, m_state, m_state_mutex, m_stop_info_override_stop_id, m_stop_info_sp, m_stop_info_stop_id, m_stopped_at_unexecuted_bp, m_temporary_resume_state, m_unwinder_up, lldb_private::Object, Thread(), lldb_private::ThreadProperties::ThreadProperties(), and lldb_private::UserID::UserID().

Referenced by lldb_private::HistoryThread::HistoryThread(), operator=(), ReturnFromFrame(), lldb_private::ScriptedThread::ScriptedThread(), SetBackedThread(), lldb_private::TargetThreadWindows::TargetThreadWindows(), Thread(), Thread(), ThreadElfCore::ThreadElfCore(), ThreadFreeBSDKernel::ThreadFreeBSDKernel(), lldb_private::process_gdb_remote::ThreadGDBRemote::ThreadGDBRemote(), ThreadKDP::ThreadKDP(), ThreadMachCore::ThreadMachCore(), ThreadMemory::ThreadMemory(), lldb_private::minidump::ThreadMinidump::ThreadMinidump(), and lldb_private::ThreadPostMortemTrace::ThreadPostMortemTrace().

◆ ~Thread()

Thread::~Thread ( )
override

If you hit this assert, it means your derived class forgot to call DestroyThread in its destructor.

Definition at line 243 of file Thread.cpp.

References lldb_private::UserID::GetID(), lldb_private::GetLog(), LLDB_LOGF, m_destroy_called, and lldb_private::Object.

◆ Thread() [2/2]

lldb_private::Thread::Thread ( const Thread & )
privatedelete

References Thread().

Member Function Documentation

◆ AutoCompleteThreadPlans()

void Thread::AutoCompleteThreadPlans ( CompletionRequest & request) const

Format the thread plan information for auto completion.

Parameters
[in]requestThe reference to the completion handler.

Definition at line 1141 of file Thread.cpp.

References lldb_private::ThreadPlanStack::AnyPlans(), lldb::eDescriptionLevelInitial, lldb_private::ThreadPlanStack::GetPlanByIndex(), GetPlans(), lldb_private::StreamString::GetString(), and lldb_private::CompletionRequest::TryCompleteCurrentArg().

◆ BroadcastSelectedFrameChange()

void Thread::BroadcastSelectedFrameChange ( StackID & new_frame_id)
private

◆ CalculateExecutionContext()

void Thread::CalculateExecutionContext ( ExecutionContext & exe_ctx)
overridevirtual

Reconstruct the object's execution context into sc.

The object should fill in as much of the ExecutionContextScope as it can so function calls that require a execution context can be made for the given object.

Parameters
[out]exe_ctxA reference to an execution context object that gets filled in.

Implements lldb_private::ExecutionContextScope.

Definition at line 1435 of file Thread.cpp.

References lldb_private::ExecutionContext::SetContext().

Referenced by lldb_private::AppleThreadPlanStepThroughObjCTrampoline::InitializeFunctionCaller(), and lldb_private::AppleThreadPlanStepThroughObjCTrampoline::ShouldStop().

◆ CalculateProcess()

ProcessSP Thread::CalculateProcess ( )
overridevirtual

Implements lldb_private::ExecutionContextScope.

Definition at line 1429 of file Thread.cpp.

References GetProcess().

Referenced by ThreadKDP::CreateRegisterContextForFrame().

◆ CalculatePublicStopInfo()

void Thread::CalculatePublicStopInfo ( )

Definition at line 381 of file Thread.cpp.

References GetStopInfo(), ResetStopInfo(), and SetStopInfo().

◆ CalculateStackFrame()

StackFrameSP Thread::CalculateStackFrame ( )
overridevirtual

Implements lldb_private::ExecutionContextScope.

Definition at line 1433 of file Thread.cpp.

◆ CalculateStopInfo()

virtual bool lldb_private::Thread::CalculateStopInfo ( )
pure virtual

Ask the thread subclass to set its stop info.

Thread subclasses should call Thread::SetStopInfo(...) with the reason the thread stopped.

A thread that is sitting at a breakpoint site, but has not yet executed the breakpoint instruction, should have a breakpoint-hit StopInfo set. When execution is resumed, any thread sitting at a breakpoint site will instruction-step over the breakpoint instruction silently, and we will never record this breakpoint as being hit, updating the hit count, possibly executing breakpoint commands or conditions.

Returns
True if Thread::SetStopInfo(...) was called, false otherwise.

Implemented in lldb_private::HistoryThread, lldb_private::minidump::ThreadMinidump, lldb_private::process_gdb_remote::ThreadGDBRemote, lldb_private::ScriptedThread, lldb_private::TargetThreadWindows, lldb_private::ThreadPostMortemTrace, ThreadElfCore, ThreadFreeBSDKernel, ThreadKDP, ThreadMachCore, and ThreadMemory.

Referenced by GetPrivateStopInfo().

◆ CalculateTarget()

TargetSP Thread::CalculateTarget ( )
overridevirtual

Implements lldb_private::ExecutionContextScope.

Definition at line 1421 of file Thread.cpp.

References GetProcess().

Referenced by lldb_private::wasm::ThreadWasm::GetUnwinder().

◆ CalculateThread()

ThreadSP Thread::CalculateThread ( )
overridevirtual

Implements lldb_private::ExecutionContextScope.

Definition at line 1431 of file Thread.cpp.

◆ CheckpointThreadState()

◆ ClearBackedThread()

void lldb_private::Thread::ClearBackedThread ( )
inline

Definition at line 513 of file Thread.h.

References m_backed_thread.

◆ ClearBackingThread()

virtual void lldb_private::Thread::ClearBackingThread ( )
inlinevirtual

Reimplemented in ThreadMemory.

Definition at line 524 of file Thread.h.

◆ ClearSelectedFrameIndex()

void lldb_private::Thread::ClearSelectedFrameIndex ( )
inline

Resets the selected frame index of this object.

Definition at line 483 of file Thread.h.

References GetStackFrameList().

◆ ClearStackFrames()

◆ CompletedPlanOverridesBreakpoint()

bool Thread::CompletedPlanOverridesBreakpoint ( ) const

Check if we have completed plan to override breakpoint stop reason.

Returns
Returns true if completed plan stack is not empty false otherwise.

Definition at line 1181 of file Thread.cpp.

References lldb_private::ThreadPlanStack::AnyCompletedPlans(), and GetPlans().

◆ CreateRegisterContextForFrame()

◆ DecrementCurrentInlinedDepth()

bool lldb_private::Thread::DecrementCurrentInlinedDepth ( )
inline

Definition at line 438 of file Thread.h.

References GetStackFrameList().

◆ DestroyThread()

◆ DidResume()

void Thread::DidResume ( )
virtual

Reimplemented in ThreadMemory.

Definition at line 749 of file Thread.cpp.

References LLDB_INVALID_SIGNAL_NUMBER, SetResumeSignal(), and SetShouldRunBeforePublicStop().

◆ DidStop()

void Thread::DidStop ( )
virtual

Reimplemented in lldb_private::TargetThreadWindows.

Definition at line 755 of file Thread.cpp.

References lldb::eStateStopped, and SetState().

◆ DiscardPlan()

void Thread::DiscardPlan ( )
protected

◆ DiscardThreadPlans()

void Thread::DiscardThreadPlans ( bool force)

Discards the plans queued on the plan stack of the current thread.

This is arbitrated by the "Controlling" ThreadPlans, using the "OkayToDiscard" call.

Definition at line 1242 of file Thread.cpp.

References lldb_private::ThreadPlanStack::DiscardAllPlans(), lldb_private::ThreadPlanStack::DiscardConsultingControllingPlans(), lldb_private::UserID::GetID(), lldb_private::GetLog(), GetPlans(), LLDB_LOGF, and lldb_private::Step.

Referenced by QueueThreadPlan(), and lldb_private::ThreadPlanBase::ShouldStop().

◆ DiscardThreadPlansUpToPlan() [1/2]

void Thread::DiscardThreadPlansUpToPlan ( lldb::ThreadPlanSP & up_to_plan_sp)

Discards the plans queued on the plan stack of the current thread up to and including up_to_plan_sp.

Definition at line 1229 of file Thread.cpp.

References DiscardThreadPlansUpToPlan().

Referenced by DiscardThreadPlansUpToPlan(), DiscardUserThreadPlansUpToIndex(), QueueThreadPlan(), and UnwindInnermostExpression().

◆ DiscardThreadPlansUpToPlan() [2/2]

void Thread::DiscardThreadPlansUpToPlan ( ThreadPlan * up_to_plan_ptr)

◆ DiscardUserThreadPlansUpToIndex()

bool Thread::DiscardUserThreadPlansUpToIndex ( uint32_t thread_index)

Discards the plans queued on the plan stack of the current thread up to and including the plan in that matches thread_index counting only the non-Private plans.

Parameters
[in]thread_indexDiscard all plans up to and including this user plan given by this index.
Returns
true if there was a thread plan with that user index, false otherwise.

Definition at line 1217 of file Thread.cpp.

References DiscardThreadPlansUpToPlan(), lldb_private::ThreadPlanStack::GetPlanByIndex(), GetPlans(), and ThreadPlan.

◆ DumpTraceInstructions()

void lldb_private::Thread::DumpTraceInstructions ( Stream & s,
size_t count,
size_t start_position = 0 ) const

Dump count instructions of the thread's Trace starting at the start_position position in reverse order.

The instructions are indexed in reverse order, which means that the start_position 0 represents the last instruction of the trace chronologically.

Parameters
[in]sThe stream object where the instructions are printed.
[in]countThe number of instructions to print.
[in]start_positionThe position of the first instruction to print.

References lldb_private::eLazyBoolCalculate, and ThreadPlan.

◆ DumpUsingFormat()

bool Thread::DumpUsingFormat ( Stream & strm,
uint32_t frame_idx,
const FormatEntity::Entry * format )

Print a description of this thread using the provided thread format.

Parameters
[out]strmThe Stream to print the description to.
[in]frame_idxIf not LLDB_INVALID_FRAME_ID, then use this frame index as context to generate the description.
[in]formatThe input format.
Returns
true if and only if dumping with the given format worked.

Definition at line 1644 of file Thread.cpp.

References lldb_private::FormatEntity::Format(), lldb_private::ExecutionContext::GetProcessPtr(), GetStackFrameAtIndex(), LLDB_INVALID_FRAME_ID, and lldb_private::ExecutionContext::SetFrameSP().

Referenced by DumpUsingSettingsFormat().

◆ DumpUsingSettingsFormat()

void Thread::DumpUsingSettingsFormat ( Stream & strm,
uint32_t frame_idx,
bool stop_format )

◆ FetchThreadExtendedInfo()

virtual lldb_private::StructuredData::ObjectSP lldb_private::Thread::FetchThreadExtendedInfo ( )
inlineprotectedvirtual

Reimplemented in lldb_private::process_gdb_remote::ThreadGDBRemote, and lldb_private::ScriptedThread.

Definition at line 1335 of file Thread.h.

Referenced by GetExtendedInfo().

◆ Flush()

void Thread::Flush ( )

◆ FrameSelectedCallback()

◆ GetAssociatedWithLibdispatchQueue()

virtual lldb_private::LazyBool lldb_private::Thread::GetAssociatedWithLibdispatchQueue ( )
inlinevirtual

Whether this thread can be associated with a libdispatch queue.

The Thread may know if it is associated with a libdispatch queue, it may know definitively that it is NOT associated with a libdispatch queue, or it may be unknown whether it is associated with a libdispatch queue.

Returns
eLazyBoolNo if this thread is definitely not associated with a libdispatch queue (e.g. on a non-Darwin system where GCD aka libdispatch is not available).

eLazyBoolYes this thread is associated with a libdispatch queue.

eLazyBoolCalculate this thread may be associated with a libdispatch queue but the thread doesn't know one way or the other.

Reimplemented in lldb_private::process_gdb_remote::ThreadGDBRemote, ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 306 of file Thread.h.

References lldb_private::eLazyBoolNo.

◆ GetBackedThread()

lldb::ThreadSP lldb_private::Thread::GetBackedThread ( ) const
inline

Returns the thread that is backed by this thread, if any.

Definition at line 516 of file Thread.h.

References m_backed_thread.

◆ GetBackingThread()

virtual lldb::ThreadSP lldb_private::Thread::GetBackingThread ( ) const
inlinevirtual

Reimplemented in ThreadMemory.

Definition at line 522 of file Thread.h.

Referenced by CommandObjectThreadInfo::HandleOneThread(), SetBackedThread(), and ShouldResume().

◆ GetBroadcasterClass()

llvm::StringRef lldb_private::Thread::GetBroadcasterClass ( ) const
inlineoverridevirtual

This needs to be filled in if you are going to register the broadcaster with the broadcaster manager and do broadcaster class matching.

FIXME: Probably should make a ManagedBroadcaster subclass with all the bits needed to work with the BroadcasterManager, so that it is clearer how to add one.

Reimplemented from lldb_private::Broadcaster.

Definition at line 82 of file Thread.h.

References GetStaticBroadcasterClass().

◆ GetCompletedPlan()

ThreadPlanSP Thread::GetCompletedPlan ( ) const

Gets the outer-most plan that was popped off the plan stack in the most recent stop.

Useful for printing the stop reason accurately.

Returns
A pointer to the last completed plan.

Definition at line 1161 of file Thread.cpp.

References lldb_private::ThreadPlanStack::GetCompletedPlan(), and GetPlans().

Referenced by GetStopInfo(), and ShouldReportRun().

◆ GetCurrentException()

ValueObjectSP Thread::GetCurrentException ( )

Definition at line 2060 of file Thread.cpp.

References GetProcess(), and GetStackFrameAtIndex().

Referenced by GetCurrentExceptionBacktrace().

◆ GetCurrentExceptionBacktrace()

ThreadSP Thread::GetCurrentExceptionBacktrace ( )

Definition at line 2076 of file Thread.cpp.

References GetCurrentException(), and GetProcess().

◆ GetCurrentInlinedDepth()

uint32_t lldb_private::Thread::GetCurrentInlinedDepth ( )
inline

Definition at line 442 of file Thread.h.

References GetStackFrameList().

Referenced by CheckpointThreadState().

◆ GetCurrentPlan()

ThreadPlan * Thread::GetCurrentPlan ( ) const

Gets the plan which will execute next on the plan stack.

Returns
A pointer to the next executed plan.

Definition at line 1157 of file Thread.cpp.

References lldb_private::ThreadPlanStack::GetCurrentPlan(), GetPlans(), and ThreadPlan.

Referenced by GetPrivateStopInfo(), lldb_private::ThreadPlanSingleThreadTimeout::HandleEvent(), SetupToStepOverBreakpointIfNeeded(), ShouldReportRun(), ShouldReportStop(), ShouldResume(), ShouldStop(), and WillStop().

◆ GetDescription()

◆ GetExpressionVariable()

ExpressionVariableSP Thread::GetExpressionVariable ( ) const

Gets the outer-most expression variable from the completed plans.

Returns
A ExpressionVariableSP, either empty if there is no plan completed an expression during the current stop or the expression variable that was made for the completed expression.

Definition at line 1169 of file Thread.cpp.

References lldb_private::ThreadPlanStack::GetExpressionVariable(), and GetPlans().

Referenced by GetStopInfo().

◆ GetExtendedBacktraceOriginatingIndexID()

virtual uint32_t lldb_private::Thread::GetExtendedBacktraceOriginatingIndexID ( )
inlinevirtual

Reimplemented in lldb_private::HistoryThread.

Definition at line 1153 of file Thread.h.

References GetIndexID().

◆ GetExtendedBacktraceToken()

virtual uint64_t lldb_private::Thread::GetExtendedBacktraceToken ( )
inlinevirtual

Gets the extended backtrace token for this thread.

Some Thread subclasses may maintain a token to help with providing an extended backtrace. The SystemRuntime plugin will set/request this.

Returns
The token needed by the SystemRuntime to create an extended backtrace. LLDB_INVALID_ADDRESS is returned if no token is available.

Reimplemented in lldb_private::HistoryThread.

Definition at line 1280 of file Thread.h.

References LLDB_INVALID_ADDRESS.

◆ GetExtendedInfo()

StructuredData::ObjectSP lldb_private::Thread::GetExtendedInfo ( )
inline

Retrieve a dictionary of information about this thread.

On Mac OS X systems there may be voucher information. The top level dictionary returned will have an "activity" key and the value of the activity is a dictionary. Keys in that dictionary will be "name" and "id", among others. There may also be "trace_messages" (an array) with each entry in that array being a dictionary (keys include "message" with the text of the trace message).

Definition at line 278 of file Thread.h.

References FetchThreadExtendedInfo(), m_extended_info, and m_extended_info_fetched.

Referenced by GetDescription().

◆ GetFrameWithConcreteFrameIndex()

lldb::StackFrameSP Thread::GetFrameWithConcreteFrameIndex ( uint32_t unwind_idx)
virtual

Definition at line 1473 of file Thread.cpp.

References GetStackFrameList().

◆ GetFrameWithStackID()

virtual lldb::StackFrameSP lldb_private::Thread::GetFrameWithStackID ( const StackID & stack_id)
inlinevirtual

Definition at line 457 of file Thread.h.

References GetStackFrameList(), and lldb_private::StackID::IsValid().

◆ GetGlobalProperties()

◆ GetIndexID()

uint32_t Thread::GetIndexID ( ) const

Definition at line 1419 of file Thread.cpp.

References m_index_id.

Referenced by GetExtendedBacktraceOriginatingIndexID(), and ShouldReportRun().

◆ GetInfo()

virtual const char * lldb_private::Thread::GetInfo ( )
inlinevirtual

Reimplemented in lldb_private::ScriptedThread, and ThreadMemory.

Definition at line 266 of file Thread.h.

◆ GetName()

◆ GetPlans()

◆ GetPreviousFrameZeroPC()

std::optional< addr_t > Thread::GetPreviousFrameZeroPC ( )

Request the pc value the thread had when previously stopped.

When the thread performs execution, it copies the current RegisterContext GetPC() value. This method returns that value, if it is available.

Returns
The PC value before execution was resumed. May not be available; an empty std::optional is returned in that case.

Definition at line 1449 of file Thread.cpp.

References m_prev_framezero_pc.

◆ GetPreviousPlan()

ThreadPlan * Thread::GetPreviousPlan ( ThreadPlan * plan) const
protected

◆ GetPrivateStopInfo()

◆ GetProcess()

lldb::ProcessSP lldb_private::Thread::GetProcess ( ) const
inline

Definition at line 158 of file Thread.h.

References m_process_wp.

Referenced by CalculateProcess(), lldb_private::process_gdb_remote::ThreadGDBRemote::CalculateStopInfo(), lldb_private::ScriptedThread::CalculateStopInfo(), ThreadElfCore::CalculateStopInfo(), ThreadKDP::CalculateStopInfo(), ThreadMachCore::CalculateStopInfo(), ThreadMemory::CalculateStopInfo(), CalculateTarget(), CheckpointThreadState(), lldb_private::minidump::ThreadMinidump::CreateRegisterContextForFrame(), lldb_private::process_gdb_remote::ThreadGDBRemote::CreateRegisterContextForFrame(), lldb_private::ThreadPostMortemTrace::CreateRegisterContextForFrame(), lldb_private::wasm::ThreadWasm::CreateRegisterContextForFrame(), ThreadElfCore::CreateRegisterContextForFrame(), ThreadFreeBSDKernel::CreateRegisterContextForFrame(), ThreadMachCore::CreateRegisterContextForFrame(), lldb_private::ThreadPlanShouldStopHere::DefaultShouldStopHereCallback(), lldb_private::ThreadPlanShouldStopHere::DefaultStepFromHereCallback(), lldb_private::AppleThreadPlanStepThroughDirectDispatch::DoPlanExplainsStop(), lldb_private::TargetThreadWindows::DoResume(), lldb_private::StopInfoWatchpoint::ThreadPlanStepOverWatchpoint::DoWillResume(), lldb_private::process_gdb_remote::ThreadGDBRemote::FetchThreadExtendedInfo(), FrameSelectedCallback(), GetCurrentException(), GetCurrentExceptionBacktrace(), lldb_private::HistoryThread::GetExtendedBacktraceOriginatingIndexID(), GetPlans(), GetPrivateStopInfo(), lldb_private::process_gdb_remote::ThreadGDBRemote::GetQueue(), lldb_private::process_gdb_remote::ThreadGDBRemote::GetQueueID(), lldb_private::process_gdb_remote::ThreadGDBRemote::GetQueueKind(), lldb_private::process_gdb_remote::ThreadGDBRemote::GetQueueLibdispatchQueueAddress(), lldb_private::process_gdb_remote::ThreadGDBRemote::GetQueueName(), lldb_private::HistoryThread::GetRegisterContext(), lldb_private::process_gdb_remote::ThreadGDBRemote::GetSiginfo(), GetSiginfoValue(), GetStatus(), GetStopInfo(), GetThreadLocalData(), lldb_private::wasm::ThreadWasm::GetWasmCallStack(), IsStillAtLastBreakpointHit(), lldb_private::ScriptedThread::LoadArtificialStackFrames(), lldb_private::StopInfoWatchpoint::ThreadPlanStepOverWatchpoint::ResetWatchpoint(), lldb_private::ExpressionParser::RunStaticInitializers(), SafeToCallFunctions(), SetSelectedFrameByIndexNoisily(), SetStopInfo(), SetupToStepOverBreakpointIfNeeded(), ShouldResume(), lldb_private::AppleThreadPlanStepThroughDirectDispatch::ShouldStop(), lldb_private::AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(), ShouldStop(), StepIn(), StepOut(), StepOver(), StopInfoIsUpToDate(), lldb_private::process_gdb_remote::ThreadGDBRemote::WillResume(), and lldb_private::process_gdb_remote::ThreadGDBRemote::~ThreadGDBRemote().

◆ GetProtocolID()

virtual lldb::user_id_t lldb_private::Thread::GetProtocolID ( ) const
inlinevirtual

◆ GetQueue()

virtual lldb::QueueSP lldb_private::Thread::GetQueue ( )
inlinevirtual

Retrieve the Queue for this thread, if any.

Returns
A QueueSP for the queue that is currently associated with this thread. An empty shared pointer indicates that this thread is not associated with a queue, or libdispatch queues are not supported on this target.

Reimplemented in lldb_private::process_gdb_remote::ThreadGDBRemote, ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 364 of file Thread.h.

◆ GetQueueID()

virtual lldb::queue_id_t lldb_private::Thread::GetQueueID ( )
inlinevirtual

Retrieve the Queue ID for the queue currently using this Thread.

If this Thread is doing work on behalf of a libdispatch/GCD queue, retrieve the QueueID.

This is a unique identifier for the libdispatch/GCD queue in a process. Often starting at 1 for the initial system-created queues and incrementing, a QueueID will not be reused for a different queue during the lifetime of a process.

Returns
A QueueID if the Thread subclass implements this, else LLDB_INVALID_QUEUE_ID.

Reimplemented in lldb_private::HistoryThread, lldb_private::process_gdb_remote::ThreadGDBRemote, ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 326 of file Thread.h.

References LLDB_INVALID_QUEUE_ID.

◆ GetQueueKind()

virtual lldb::QueueKind lldb_private::Thread::GetQueueKind ( )
inlinevirtual

Retrieve the Queue kind for the queue currently using this Thread.

If this Thread is doing work on behalf of a libdispatch/GCD queue, retrieve the Queue kind - either eQueueKindSerial or eQueueKindConcurrent, indicating that this queue processes work items serially or concurrently.

Returns
The Queue kind, if the Thread subclass implements this, else eQueueKindUnknown.

Reimplemented in lldb_private::process_gdb_remote::ThreadGDBRemote, ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 352 of file Thread.h.

References lldb::eQueueKindUnknown.

◆ GetQueueLibdispatchQueueAddress()

virtual lldb::addr_t lldb_private::Thread::GetQueueLibdispatchQueueAddress ( )
inlinevirtual

Retrieve the address of the libdispatch_queue_t struct for queue currently using this Thread.

If this Thread is doing work on behalf of a libdispatch/GCD queue, retrieve the address of the libdispatch_queue_t structure describing the queue.

This address may be reused for different queues later in the Process lifetime and should not be used to identify a queue uniquely. Use the GetQueueID() call for that.

Returns
The Queue's libdispatch_queue_t address if the Thread subclass implements this, else LLDB_INVALID_ADDRESS.

Reimplemented in lldb_private::process_gdb_remote::ThreadGDBRemote, ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 380 of file Thread.h.

References LLDB_INVALID_ADDRESS.

◆ GetQueueName()

virtual const char * lldb_private::Thread::GetQueueName ( )
inlinevirtual

Retrieve the Queue name for the queue currently using this Thread.

If this Thread is doing work on behalf of a libdispatch/GCD queue, retrieve the Queue name.

Returns
The Queue name, if the Thread subclass implements this, else nullptr.

Reimplemented in lldb_private::HistoryThread, lldb_private::process_gdb_remote::ThreadGDBRemote, lldb_private::ScriptedThread, ThreadKDP, ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 338 of file Thread.h.

◆ GetRegisterContext()

◆ GetResumeSignal()

int lldb_private::Thread::GetResumeSignal ( ) const
inline

Definition at line 160 of file Thread.h.

References m_resume_signal.

Referenced by lldb_private::process_gdb_remote::ThreadGDBRemote::WillResume().

◆ GetResumeState()

lldb::StateType lldb_private::Thread::GetResumeState ( ) const
inline

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.

Returns
The User resume state for this thread.

Definition at line 202 of file Thread.h.

References m_resume_state.

Referenced by SetupToStepOverBreakpointIfNeeded(), ShouldReportRun(), ShouldReportStop(), and ShouldStop().

◆ GetReturnValueObject()

ValueObjectSP Thread::GetReturnValueObject ( ) const

Gets the outer-most return value from the completed plans.

Returns
A ValueObjectSP, either empty if there is no return value, or containing the return value.

Definition at line 1165 of file Thread.cpp.

References GetPlans(), and lldb_private::ThreadPlanStack::GetReturnValueObject().

Referenced by GetStopInfo().

◆ GetSelectedFrame()

lldb::StackFrameSP Thread::GetSelectedFrame ( SelectMostRelevant select_most_relevant)

Definition at line 272 of file Thread.cpp.

References FrameSelectedCallback(), and GetStackFrameList().

Referenced by SetSelectedFrameByIndexNoisily().

◆ GetSelectedFrameIndex()

uint32_t lldb_private::Thread::GetSelectedFrameIndex ( SelectMostRelevant select_most_relevant)
inline

Definition at line 467 of file Thread.h.

References GetStackFrameList().

◆ GetSiginfo()

virtual llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > lldb_private::Thread::GetSiginfo ( size_t max_size) const
inlineprotectedvirtual

Reimplemented in lldb_private::process_gdb_remote::ThreadGDBRemote, and ThreadElfCore.

Definition at line 1348 of file Thread.h.

Referenced by GetSiginfoValue().

◆ GetSiginfoValue()

◆ GetStackFrameAtIndex()

◆ GetStackFrameCount()

virtual uint32_t lldb_private::Thread::GetStackFrameCount ( )
inlinevirtual

GetStackFrameCount can be expensive.

Stacks can get very deep, and they require memory reads for each frame. So only use GetStackFrameCount when you need to know the depth of the stack. When iterating over frames, its better to generate the frames one by one with GetFrameAtIndex, and when that returns NULL, you are at the end of the stack. That way your loop will only do the work it needs to, without forcing lldb to realize StackFrames you weren't going to look at.

Definition at line 427 of file Thread.h.

References GetStackFrameList().

◆ GetStackFrameList()

◆ GetStackFrameSPForStackFramePtr()

lldb::StackFrameSP Thread::GetStackFrameSPForStackFramePtr ( StackFrame * stack_frame_ptr)

Definition at line 1722 of file Thread.cpp.

References GetStackFrameList(), and StackFrame.

◆ GetStackFrameStatus()

size_t Thread::GetStackFrameStatus ( Stream & strm,
uint32_t first_frame,
uint32_t num_frames,
bool show_frame_info,
uint32_t num_frames_with_source,
bool show_hidden )

Definition at line 1925 of file Thread.cpp.

References GetStackFrameList().

◆ GetState()

StateType Thread::GetState ( ) const

Definition at line 568 of file Thread.cpp.

References m_state, and m_state_mutex.

Referenced by lldb_private::TargetThreadWindows::DoResume().

◆ GetStaticBroadcasterClass()

llvm::StringRef Thread::GetStaticBroadcasterClass ( )
static

◆ GetStatus()

◆ GetStopDescription()

std::string Thread::GetStopDescription ( )

Definition at line 579 of file Thread.cpp.

References GetStackFrameAtIndex(), and GetStopDescriptionRaw().

◆ GetStopDescriptionRaw()

std::string Thread::GetStopDescriptionRaw ( )

Definition at line 599 of file Thread.cpp.

References lldb::eStopReasonNone, and GetStopInfo().

Referenced by GetStopDescription().

◆ GetStopInfo()

◆ GetStopReason()

lldb::StopReason Thread::GetStopReason ( )

Definition at line 442 of file Thread.cpp.

References lldb::eStopReasonNone, and GetStopInfo().

◆ GetTemporaryResumeState()

lldb::StateType lldb_private::Thread::GetTemporaryResumeState ( ) const
inline

◆ GetThreadLocalData()

addr_t Thread::GetThreadLocalData ( const lldb::ModuleSP module,
lldb::addr_t tls_file_addr )
virtual

Retrieves the per-module TLS block for a thread.

Parameters
[in]moduleThe module to query TLS data for.
[in]tls_file_addrThe thread local address in module
Returns
If the thread has TLS data allocated for the module, the address of the TLS block. Otherwise LLDB_INVALID_ADDRESS is returned.

Definition at line 1694 of file Thread.cpp.

References GetProcess(), lldb_private::DynamicLoader::GetThreadLocalData(), and LLDB_INVALID_ADDRESS.

◆ GetThreadPointer()

lldb::addr_t Thread::GetThreadPointer ( )
virtual

Retrieves the per-thread data area.

Most OSs maintain a per-thread pointer (e.g. the FS register on x64), which we return the value of here.

Returns
LLDB_INVALID_ADDRESS if not supported, otherwise the thread pointer value.

Definition at line 1688 of file Thread.cpp.

References LLDB_INVALID_ADDRESS, and m_reg_context_sp.

◆ GetUnwinder()

◆ IsOperatingSystemPluginThread()

virtual bool lldb_private::Thread::IsOperatingSystemPluginThread ( ) const
inlineprotectedvirtual

Reimplemented in ThreadMemory.

Definition at line 1331 of file Thread.h.

◆ IsStillAtLastBreakpointHit()

bool Thread::IsStillAtLastBreakpointHit ( )
protectedvirtual

◆ IsThreadPlanDone()

bool Thread::IsThreadPlanDone ( ThreadPlan * plan) const

Checks whether the given plan is in the completed plans for this stop.

Parameters
[in]planPointer to the plan you're checking.
Returns
Returns true if the input plan is in the completed plan stack, false otherwise.

Definition at line 1173 of file Thread.cpp.

References GetPlans(), lldb_private::ThreadPlanStack::IsPlanDone(), and ThreadPlan.

◆ IsValid()

bool lldb_private::Thread::IsValid ( ) const
inline

Definition at line 1189 of file Thread.h.

References m_destroy_called.

◆ JumpToLine()

◆ MatchesSpec()

bool Thread::MatchesSpec ( const ThreadSpec * spec)
virtual

Definition at line 1088 of file Thread.cpp.

References lldb_private::ThreadSpec::ThreadPassesBasicTests().

◆ operator=()

const Thread & lldb_private::Thread::operator= ( const Thread & )
privatedelete

References Thread().

◆ PopPlan()

void Thread::PopPlan ( )
protected

◆ PushPlan()

◆ QueueBasePlan()

ThreadPlanSP Thread::QueueBasePlan ( bool abort_other_plans)

Queues the base plan for a thread.

The version returned by Process does some things that are useful, like handle breakpoints and signals, so if you return a plugin specific one you probably want to call through to the Process one for anything your plugin doesn't explicitly handle.

Parameters
[in]abort_other_planstrue if we discard the currently queued plans and replace them with this one. Otherwise this plan will go on the end of the plan stack.
Returns
A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.

Definition at line 1270 of file Thread.cpp.

References QueueThreadPlan().

◆ QueueThreadPlan()

Status Thread::QueueThreadPlan ( lldb::ThreadPlanSP & plan_sp,
bool abort_other_plans )

Queues a generic thread plan.

Parameters
[in]plan_spThe plan to queue.
[in]abort_other_planstrue if we discard the currently queued plans and replace them with this one. Otherwise this plan will go on the end of the plan stack.
Returns
A pointer to the last completed plan.

Definition at line 1189 of file Thread.cpp.

References DiscardThreadPlans(), DiscardThreadPlansUpToPlan(), lldb_private::StreamString::GetString(), PushPlan(), and lldb_private::Status.

Referenced by QueueBasePlan(), QueueThreadPlanForRunToAddress(), QueueThreadPlanForStepInRange(), QueueThreadPlanForStepOut(), QueueThreadPlanForStepOutNoShouldStop(), QueueThreadPlanForStepOverRange(), QueueThreadPlanForStepScripted(), QueueThreadPlanForStepSingleInstruction(), QueueThreadPlanForStepThrough(), QueueThreadPlanForStepUntil(), SetupToStepOverBreakpointIfNeeded(), and lldb_private::AppleThreadPlanStepThroughDirectDispatch::ShouldStop().

◆ QueueThreadPlanForRunToAddress()

ThreadPlanSP Thread::QueueThreadPlanForRunToAddress ( bool abort_other_plans,
Address & target_addr,
bool stop_other_threads,
Status & status )
virtual

Gets the plan used to continue from the current PC.

This is a simple plan, mostly useful as a backstop when you are continuing for some particular purpose.

Parameters
[in]abort_other_planstrue if we discard the currently queued plans and replace them with this one. Otherwise this plan will go on the end of the plan stack.
[in]target_addrThe address to which we're running.
[in]stop_other_threadstrue if we will stop other threads while we single step this one.
[out]statusA status with an error if queuing failed.
Returns
A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.

Definition at line 1386 of file Thread.cpp.

References QueueThreadPlan().

◆ QueueThreadPlanForStepInRange() [1/2]

ThreadPlanSP Thread::QueueThreadPlanForStepInRange ( bool abort_other_plans,
const AddressRange & range,
const SymbolContext & addr_context,
const char * step_in_target,
lldb::RunMode stop_other_threads,
Status & status,
LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate )
virtual

Queues the plan used to step through an address range, stepping into functions.

Parameters
[in]abort_other_planstrue if we discard the currently queued plans and replace them with this one. Otherwise this plan will go on the end of the plan stack.
[in]typeType of step to do, only eStepTypeInto and eStepTypeOver are supported by this plan.
[in]rangeThe address range to step through.
[in]addr_contextWhen dealing with stepping through inlined functions the current PC is not enough information to know what "step" means. For instance a series of nested inline functions might start at the same address. is supposed to be out of.
[in]step_in_targetName if function we are trying to step into. We will step out if we don't land in that function.
[in]stop_other_threadstrue if we will stop other threads while we single step this one.
[out]statusA status with an error if queuing failed.
[in]step_in_avoids_code_without_debug_infoIf eLazyBoolYes we will step out if we step into code with no debug info. If eLazyBoolCalculate we will consult the default set in the thread.
[in]step_out_avoids_code_without_debug_infoIf eLazyBoolYes, if the step over steps out it will continue to step out till it comes to a frame with debug info. If eLazyBoolCalculate, it will consult the default set in the thread.
Returns
A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.

Definition at line 1312 of file Thread.cpp.

References QueueThreadPlan().

Referenced by lldb_private::ThreadPlanShouldStopHere::DefaultStepFromHereCallback(), QueueThreadPlanForStepInRange(), and StepIn().

◆ QueueThreadPlanForStepInRange() [2/2]

ThreadPlanSP Thread::QueueThreadPlanForStepInRange ( bool abort_other_plans,
const LineEntry & line_entry,
const SymbolContext & addr_context,
const char * step_in_target,
lldb::RunMode stop_other_threads,
Status & status,
LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate )
virtual

◆ QueueThreadPlanForStepOut()

ThreadPlanSP Thread::QueueThreadPlanForStepOut ( bool abort_other_plans,
SymbolContext * addr_context,
bool first_insn,
bool stop_other_threads,
Vote report_stop_vote,
Vote report_run_vote,
uint32_t frame_idx,
Status & status,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate )
virtual

Queue the plan used to step out of the function at the current PC of thread.

Parameters
[in]abort_other_planstrue if we discard the currently queued plans and replace them with this one. Otherwise this plan will go on the end of the plan stack.
[in]addr_contextWhen dealing with stepping through inlined functions the current PC is not enough information to know what "step" means. For instance a series of nested inline functions might start at the same address. is supposed to be out of.
[in]first_insntrue if this is the first instruction of a function.
[in]stop_other_threadstrue if we will stop other threads while we single step this one.
[in]report_stop_voteSee standard meanings for the stop & run votes in ThreadPlan.h.
[in]report_run_voteSee standard meanings for the stop & run votes in ThreadPlan.h.
[out]statusA status with an error if queuing failed.
[in]step_out_avoids_code_without_debug_infoIf eLazyBoolYes, if the step over steps out it will continue to step out till it comes to a frame with debug info. If eLazyBoolCalculate, it will consult the default set in the thread.
Returns
A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.

Definition at line 1342 of file Thread.cpp.

References QueueThreadPlan().

Referenced by lldb_private::ThreadPlanCallOnFunctionExit::DidPush(), and StepOut().

◆ QueueThreadPlanForStepOutNoShouldStop()

ThreadPlanSP Thread::QueueThreadPlanForStepOutNoShouldStop ( bool abort_other_plans,
SymbolContext * addr_context,
bool first_insn,
bool stop_other_threads,
Vote report_stop_vote,
Vote report_run_vote,
uint32_t frame_idx,
Status & status,
bool continue_to_next_branch = false )
virtual

Queue the plan used to step out of the function at the current PC of a thread.

This version does not consult the should stop here callback, and should only be used by other thread plans when they need to retain control of the step out.

Parameters
[in]abort_other_planstrue if we discard the currently queued plans and replace them with this one. Otherwise this plan will go on the end of the plan stack.
[in]addr_contextWhen dealing with stepping through inlined functions the current PC is not enough information to know what "step" means. For instance a series of nested inline functions might start at the same address. is supposed to be out of.
[in]first_insntrue if this is the first instruction of a function.
[in]stop_other_threadstrue if we will stop other threads while we single step this one.
[in]report_stop_voteSee standard meanings for the stop & run votes in ThreadPlan.h.
[in]report_run_voteSee standard meanings for the stop & run votes in ThreadPlan.h.
[in]frame_idxThe frame index.
[out]statusA status with an error if queuing failed.
[in]continue_to_next_branchNormally this will enqueue a plan that will put a breakpoint on the return address and continue to there. If continue_to_next_branch is true, this is an operation not involving the user – e.g. stepping "next" in a source line and we instruction stepped into another function – so instead of putting a breakpoint on the return address, advance the breakpoint to the end of the source line that is doing the call, or until the next flow control instruction. If the return value from the function call is to be retrieved / displayed to the user, you must stop on the return address. The return value may be stored in volatile registers which are overwritten before the next branch instruction.
Returns
A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.

Definition at line 1355 of file Thread.cpp.

References lldb_private::ThreadPlanShouldStopHere::ClearShouldStopHereCallbacks(), and QueueThreadPlan().

Referenced by lldb_private::ThreadPlanShouldStopHere::DefaultStepFromHereCallback(), and lldb_private::AppleThreadPlanStepThroughObjCTrampoline::ShouldStop().

◆ QueueThreadPlanForStepOverRange() [1/2]

ThreadPlanSP Thread::QueueThreadPlanForStepOverRange ( bool abort_other_plans,
const AddressRange & range,
const SymbolContext & addr_context,
lldb::RunMode stop_other_threads,
Status & status,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate )
virtual

Queues the plan used to step through an address range, stepping over function calls.

Parameters
[in]abort_other_planstrue if we discard the currently queued plans and replace them with this one. Otherwise this plan will go on the end of the plan stack.
[in]typeType of step to do, only eStepTypeInto and eStepTypeOver are supported by this plan.
[in]rangeThe address range to step through.
[in]addr_contextWhen dealing with stepping through inlined functions the current PC is not enough information to know what "step" means. For instance a series of nested inline functions might start at the same address. is supposed to be out of.
[in]stop_other_threadstrue if we will stop other threads while we single step this one.
[out]statusA status with an error if queuing failed.
[in]step_out_avoids_code_without_debug_infoIf eLazyBoolYes, if the step over steps out it will continue to step out till it comes to a frame with debug info. If eLazyBoolCalculate, we will consult the default set in the thread.
Returns
A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.

Definition at line 1285 of file Thread.cpp.

References QueueThreadPlan().

Referenced by QueueThreadPlanForStepOverRange(), and StepOver().

◆ QueueThreadPlanForStepOverRange() [2/2]

ThreadPlanSP Thread::QueueThreadPlanForStepOverRange ( bool abort_other_plans,
const LineEntry & line_entry,
const SymbolContext & addr_context,
lldb::RunMode stop_other_threads,
Status & status,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate )
virtual

◆ QueueThreadPlanForStepScripted()

lldb::ThreadPlanSP Thread::QueueThreadPlanForStepScripted ( bool abort_other_plans,
const char * class_name,
StructuredData::ObjectSP extra_args_sp,
bool stop_other_threads,
Status & status )
virtual

Definition at line 1407 of file Thread.cpp.

References QueueThreadPlan().

◆ QueueThreadPlanForStepSingleInstruction()

ThreadPlanSP Thread::QueueThreadPlanForStepSingleInstruction ( bool step_over,
bool abort_other_plans,
bool stop_other_threads,
Status & status )
virtual

Queues the plan used to step one instruction from the current PC of thread.

Parameters
[in]step_overtrue if we step over calls to functions, false if we step in.
[in]abort_other_planstrue if we discard the currently queued plans and replace them with this one. Otherwise this plan will go on the end of the plan stack.
[in]stop_other_threadstrue if we will stop other threads while we single step this one.
[out]statusA status with an error if queuing failed.
Returns
A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.

Definition at line 1276 of file Thread.cpp.

References lldb_private::eVoteNoOpinion, and QueueThreadPlan().

Referenced by StepIn(), and StepOver().

◆ QueueThreadPlanForStepThrough()

ThreadPlanSP Thread::QueueThreadPlanForStepThrough ( StackID & return_stack_id,
bool abort_other_plans,
bool stop_other_threads,
Status & status )
virtual

Gets the plan used to step through the code that steps from a function call site at the current PC into the actual function call.

Parameters
[in]return_stack_idThe stack id that we will return to (by setting backstop breakpoints on the return address to that frame) if we fail to step through.
[in]abort_other_planstrue if we discard the currently queued plans and replace them with this one. Otherwise this plan will go on the end of the plan stack.
[in]stop_other_threadstrue if we will stop other threads while we single step this one.
[out]statusA status with an error if queuing failed.
Returns
A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.

Definition at line 1373 of file Thread.cpp.

References QueueThreadPlan().

◆ QueueThreadPlanForStepUntil()

ThreadPlanSP Thread::QueueThreadPlanForStepUntil ( bool abort_other_plans,
lldb::addr_t * address_list,
size_t num_addresses,
bool stop_others,
uint32_t frame_idx,
Status & status )
virtual

Definition at line 1397 of file Thread.cpp.

References QueueThreadPlan().

◆ RefreshStateAfterStop()

◆ ResetStopInfo()

void Thread::ResetStopInfo ( )

Definition at line 458 of file Thread.cpp.

References m_stop_info_sp.

Referenced by CalculatePublicStopInfo().

◆ RestoreRegisterStateFromCheckpoint()

bool Thread::RestoreRegisterStateFromCheckpoint ( ThreadStateCheckpoint & saved_state)
virtual

◆ RestoreThreadStateFromCheckpoint()

◆ ReturnFromFrame()

◆ ReturnFromFrameWithIndex()

Status Thread::ReturnFromFrameWithIndex ( uint32_t frame_idx,
lldb::ValueObjectSP return_value_sp,
bool broadcast = false )

◆ RunModeAsString()

std::string Thread::RunModeAsString ( lldb::RunMode mode)
static

Definition at line 1767 of file Thread.cpp.

References lldb::eAllThreads, lldb::eOnlyDuringStepping, and lldb::eOnlyThisThread.

◆ SafeToCallFunctions()

bool Thread::SafeToCallFunctions ( )
virtual

Check whether this thread is safe to run functions.

The SystemRuntime may know of certain thread states (functions in process of execution, for instance) which can make it unsafe for functions to be called.

Returns
True if it is safe to call functions on this thread. False if function calls should be avoided on this thread.

Definition at line 1706 of file Thread.cpp.

References GetProcess(), lldb_private::Process::GetSystemRuntime(), lldb_private::DynamicLoader::IsFullyInitialized(), and lldb_private::SystemRuntime::SafeToCallFunctionsOnThisThread().

◆ SetAssociatedWithLibdispatchQueue()

virtual void lldb_private::Thread::SetAssociatedWithLibdispatchQueue ( lldb_private::LazyBool associated_with_libdispatch_queue)
inlinevirtual

◆ SetBackedThread()

void lldb_private::Thread::SetBackedThread ( Thread & backed_thread)
inline

Sets the thread that is backed by this thread.

If backed_thread.GetBackedThread() is null, this method also calls backed_thread.SetBackingThread(this). If backed_thread.GetBackedThread() is non-null, asserts that it is equal to this.

Definition at line 503 of file Thread.h.

References GetBackingThread(), m_backed_thread, SetBackingThread(), and Thread().

◆ SetBackingThread()

virtual bool lldb_private::Thread::SetBackingThread ( const lldb::ThreadSP & thread_sp)
inlinevirtual

Reimplemented in ThreadMemory.

Definition at line 518 of file Thread.h.

Referenced by SetBackedThread().

◆ SetDefaultFileAndLineToSelectedFrame()

void lldb_private::Thread::SetDefaultFileAndLineToSelectedFrame ( )
inline

Definition at line 487 of file Thread.h.

References GetStackFrameList().

◆ SetExtendedBacktraceToken()

virtual void lldb_private::Thread::SetExtendedBacktraceToken ( uint64_t token)
inlinevirtual

Sets the extended backtrace token for this thread.

Some Thread subclasses may maintain a token to help with providing an extended backtrace. The SystemRuntime plugin will set/request this.

Parameters
[in]tokenThe extended backtrace token.

Reimplemented in lldb_private::HistoryThread.

Definition at line 1270 of file Thread.h.

◆ SetName()

virtual void lldb_private::Thread::SetName ( const char * name)
inlinevirtual

◆ SetQueueID()

virtual void lldb_private::Thread::SetQueueID ( lldb::queue_id_t new_val)
inlinevirtual

Reimplemented in lldb_private::HistoryThread, ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 328 of file Thread.h.

◆ SetQueueKind()

virtual void lldb_private::Thread::SetQueueKind ( lldb::QueueKind kind)
inlinevirtual

Reimplemented in ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 354 of file Thread.h.

◆ SetQueueLibdispatchQueueAddress()

virtual void lldb_private::Thread::SetQueueLibdispatchQueueAddress ( lldb::addr_t dispatch_queue_t)
inlinevirtual

◆ SetQueueName()

virtual void lldb_private::Thread::SetQueueName ( const char * name)
inlinevirtual

Reimplemented in lldb_private::HistoryThread, ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 340 of file Thread.h.

◆ SetResumeSignal()

void lldb_private::Thread::SetResumeSignal ( int signal)
inline

Definition at line 162 of file Thread.h.

References m_resume_signal.

Referenced by DidResume().

◆ SetResumeState()

void lldb_private::Thread::SetResumeState ( lldb::StateType state,
bool override_suspend = false )
inline

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.

Definition at line 188 of file Thread.h.

References lldb::eStateSuspended, and m_resume_state.

◆ SetSelectedFrame()

uint32_t Thread::SetSelectedFrame ( lldb_private::StackFrame * frame,
bool broadcast = false )

◆ SetSelectedFrameByIndex()

bool Thread::SetSelectedFrameByIndex ( uint32_t frame_idx,
bool broadcast = false )

◆ SetSelectedFrameByIndexNoisily()

◆ SetShouldReportStop()

◆ SetShouldRunBeforePublicStop()

void lldb_private::Thread::SetShouldRunBeforePublicStop ( bool newval)
inline

Definition at line 1256 of file Thread.h.

References m_should_run_before_public_stop.

Referenced by DidResume(), and ShouldStop().

◆ SetState()

void Thread::SetState ( lldb::StateType state)

Definition at line 574 of file Thread.cpp.

References m_state, and m_state_mutex.

Referenced by DidStop(), and lldb_private::TargetThreadWindows::RefreshStateAfterStop().

◆ SetStopInfo()

◆ SetStopInfoToNothing()

void Thread::SetStopInfoToNothing ( )

◆ SetTemporaryResumeState()

void lldb_private::Thread::SetTemporaryResumeState ( lldb::StateType new_state)
inlineprotected

Definition at line 1341 of file Thread.h.

References m_temporary_resume_state.

Referenced by ShouldResume().

◆ SetThreadHitBreakpointSite()

void lldb_private::Thread::SetThreadHitBreakpointSite ( )
inline

Definition at line 402 of file Thread.h.

References LLDB_INVALID_ADDRESS, and m_stopped_at_unexecuted_bp.

◆ SetThreadStoppedAtUnexecutedBP()

void lldb_private::Thread::SetThreadStoppedAtUnexecutedBP ( lldb::addr_t pc)
inline

When a thread stops at an enabled BreakpointSite that has not executed, the Process plugin should call SetThreadStoppedAtUnexecutedBP(pc).

If that BreakpointSite was actually triggered (the instruction was executed, for a software breakpoint), regardless of whether the breakpoint is valid for this thread, SetThreadHitBreakpointSite() should be called to record that fact.

Depending on the structure of the Process plugin, it may be easiest to call SetThreadStoppedAtUnexecutedBP(pc) unconditionally when at a BreakpointSite, and later when it is known that it was triggered, SetThreadHitBreakpointSite() can be called. These two methods overwrite the same piece of state in the Thread, the last one called on a Thread wins.

Definition at line 399 of file Thread.h.

References m_stopped_at_unexecuted_bp, and pc.

Referenced by lldb_private::ScriptedThread::CalculateStopInfo().

◆ SettingsInitialize()

void Thread::SettingsInitialize ( )
static

Definition at line 1684 of file Thread.cpp.

Referenced by lldb_private::Process::SettingsInitialize().

◆ SettingsTerminate()

void Thread::SettingsTerminate ( )
static

Definition at line 1686 of file Thread.cpp.

Referenced by lldb_private::Process::SettingsTerminate().

◆ SetupToStepOverBreakpointIfNeeded()

◆ ShouldReportRun()

◆ ShouldReportStop()

◆ ShouldResume()

◆ ShouldRunBeforePublicStop()

bool lldb_private::Thread::ShouldRunBeforePublicStop ( )
inline

Definition at line 1260 of file Thread.h.

References m_should_run_before_public_stop.

◆ ShouldStop()

◆ StepIn()

Status Thread::StepIn ( bool source_step,
LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate )
virtual

Default implementation for stepping into.

This function is designed to be used by commands where the process is publicly stopped.

Parameters
[in]source_stepIf true and the frame has debug info, then do a source level step in, else do a single instruction step in.
[in]step_in_avoids_code_without_debug_infoIf true, then avoid stepping into code that doesn't have debug info, else step into any code regardless of whether it has debug info.
[in]step_out_avoids_code_without_debug_infoIf true, then if you step out to code with no debug info, keep stepping out till you get to code with debug info.
Returns
An error that describes anything that went wrong

Definition at line 1967 of file Thread.cpp.

References lldb::eOnlyThisThread, error(), lldb_private::Status::FromErrorString(), lldb_private::UserID::GetID(), GetProcess(), GetStackFrameAtIndex(), lldb_private::Process::GetState(), lldb_private::Process::GetThreadList(), lldb_private::SymbolContext::line_entry, QueueThreadPlanForStepInRange(), QueueThreadPlanForStepSingleInstruction(), lldb_private::Process::Resume(), lldb_private::ThreadList::SetSelectedThreadByID(), and lldb_private::StateIsStoppedState().

◆ StepOut()

Status Thread::StepOut ( uint32_t frame_idx = 0)
virtual

Default implementation for stepping out.

This function is designed to be used by commands where the process is publicly stopped.

Parameters
[in]frame_idxThe frame index to step out of.
Returns
An error that describes anything that went wrong

Definition at line 2036 of file Thread.cpp.

References error(), lldb_private::eVoteNoOpinion, lldb_private::eVoteYes, lldb_private::Status::FromErrorString(), lldb_private::UserID::GetID(), GetProcess(), lldb_private::Process::GetState(), lldb_private::Process::GetThreadList(), QueueThreadPlanForStepOut(), lldb_private::Process::Resume(), lldb_private::ThreadList::SetSelectedThreadByID(), and lldb_private::StateIsStoppedState().

◆ StepOver()

Status Thread::StepOver ( bool source_step,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate )
virtual

Default implementation for stepping over.

This function is designed to be used by commands where the process is publicly stopped.

Parameters
[in]source_stepIf true and the frame has debug info, then do a source level step over, else do a single instruction step over.
Returns
An error that describes anything that went wrong

Definition at line 2003 of file Thread.cpp.

References lldb::eOnlyThisThread, error(), lldb_private::Status::FromErrorString(), lldb_private::UserID::GetID(), GetProcess(), GetStackFrameAtIndex(), lldb_private::Process::GetState(), lldb_private::Process::GetThreadList(), lldb_private::SymbolContext::line_entry, QueueThreadPlanForStepOverRange(), QueueThreadPlanForStepSingleInstruction(), lldb_private::Process::Resume(), lldb_private::ThreadList::SetSelectedThreadByID(), and lldb_private::StateIsStoppedState().

◆ StopInfoIsUpToDate()

bool Thread::StopInfoIsUpToDate ( ) const

Definition at line 449 of file Thread.cpp.

References GetProcess(), and m_stop_info_stop_id.

◆ StopReasonAsString()

◆ ThreadHasQueueInformation()

virtual bool lldb_private::Thread::ThreadHasQueueInformation ( ) const
inlinevirtual

Whether this Thread already has all the Queue information cached or not.

A Thread may be associated with a libdispatch work Queue at a given public stop event. If so, the thread can satisify requests like GetQueueLibdispatchQueueAddress, GetQueueKind, GetQueueName, and GetQueueID either from information from the remote debug stub when it is initially created, or it can query the SystemRuntime for that information.

This method allows the SystemRuntime to discover if a thread has this information already, instead of calling the thread to get the information and having the thread call the SystemRuntime again.

Reimplemented in lldb_private::process_gdb_remote::ThreadGDBRemote, ThreadMemory, and ThreadMemoryProvidingNameAndQueue.

Definition at line 418 of file Thread.h.

◆ ThreadStoppedForAReason()

bool Thread::ThreadStoppedForAReason ( )

Definition at line 505 of file Thread.cpp.

References GetPrivateStopInfo().

Referenced by ShouldReportStop(), and ShouldStop().

◆ UnwindInnermostExpression()

Status Thread::UnwindInnermostExpression ( )

Unwinds the thread stack for the innermost expression plan currently on the thread plan stack.

Returns
An error if the thread plan could not be unwound.

Definition at line 1258 of file Thread.cpp.

References DiscardThreadPlansUpToPlan(), error(), lldb_private::Status::FromErrorString(), lldb_private::ThreadPlanStack::GetInnermostExpression(), GetPlans(), and ThreadPlan.

◆ WasThreadPlanDiscarded()

bool Thread::WasThreadPlanDiscarded ( ThreadPlan * plan) const

Checks whether the given plan is in the discarded plans for this stop.

Parameters
[in]planPointer to the plan you're checking.
Returns
Returns true if the input plan is in the discarded plan stack, false otherwise.

Definition at line 1177 of file Thread.cpp.

References GetPlans(), ThreadPlan, and lldb_private::ThreadPlanStack::WasPlanDiscarded().

◆ WillResume()

virtual void lldb_private::Thread::WillResume ( lldb::StateType resume_state)
inlinevirtual

◆ WillStop()

void Thread::WillStop ( )

Definition at line 611 of file Thread.cpp.

References GetCurrentPlan(), ThreadPlan, and lldb_private::ThreadPlan::WillStop().

◆ OperatingSystem

friend class OperatingSystem
friend

Definition at line 1304 of file Thread.h.

References OperatingSystem, and ThreadPlan.

Referenced by ThreadMemory::CalculateStopInfo(), and OperatingSystem.

◆ StackFrame

◆ StackFrameList

friend class StackFrameList
friend

Definition at line 1302 of file Thread.h.

References StackFrameList.

Referenced by StackFrameList.

◆ ThreadEventData

friend class ThreadEventData
friend

Definition at line 1301 of file Thread.h.

◆ ThreadList

friend class ThreadList
friend

Definition at line 1300 of file Thread.h.

References ThreadList.

Referenced by ThreadList.

◆ ThreadPlan

Member Data Documentation

◆ m_backed_thread

lldb::ThreadWP lldb_private::Thread::m_backed_thread
protected

The Thread backed by this thread, if any.

Definition at line 1401 of file Thread.h.

Referenced by ClearBackedThread(), GetBackedThread(), and SetBackedThread().

◆ m_curr_frames_sp

lldb::StackFrameListSP lldb_private::Thread::m_curr_frames_sp
protected

The stack frames that get lazily populated after a thread stops.

Definition at line 1377 of file Thread.h.

Referenced by ClearStackFrames(), DestroyThread(), GetStackFrameList(), and Thread().

◆ m_destroy_called

bool lldb_private::Thread::m_destroy_called
protected

Definition at line 1395 of file Thread.h.

Referenced by DestroyThread(), GetPrivateStopInfo(), GetStopInfo(), IsValid(), Thread(), and ~Thread().

◆ m_extended_info

StructuredData::ObjectSP lldb_private::Thread::m_extended_info
private

Definition at line 1406 of file Thread.h.

Referenced by ClearStackFrames(), GetExtendedInfo(), and Thread().

◆ m_extended_info_fetched

bool lldb_private::Thread::m_extended_info_fetched
private

Definition at line 1404 of file Thread.h.

Referenced by ClearStackFrames(), GetExtendedInfo(), and Thread().

◆ m_frame_mutex

std::recursive_mutex lldb_private::Thread::m_frame_mutex
mutableprotected

Multithreaded protection for m_state.

Definition at line 1376 of file Thread.h.

Referenced by ClearStackFrames(), DestroyThread(), GetStackFrameList(), and Thread().

◆ m_index_id

const uint32_t lldb_private::Thread::m_index_id
protected

A unique 1 based index assigned to each thread for easy UI/command line access.

Definition at line 1368 of file Thread.h.

Referenced by GetIndexID(), and Thread().

◆ m_null_plan_stack_up

std::unique_ptr<ThreadPlanStack> lldb_private::Thread::m_null_plan_stack_up
mutableprotected

Definition at line 1398 of file Thread.h.

Referenced by GetPlans().

◆ m_override_should_notify

LazyBool lldb_private::Thread::m_override_should_notify
protected

Definition at line 1397 of file Thread.h.

Referenced by SetShouldReportStop(), SetStopInfo(), ShouldResume(), and Thread().

◆ m_prev_frames_sp

lldb::StackFrameListSP lldb_private::Thread::m_prev_frames_sp
protected

The previous stack frames from the last time this thread stopped.

Definition at line 1379 of file Thread.h.

Referenced by ClearStackFrames(), DestroyThread(), GetStackFrameList(), and Thread().

◆ m_prev_framezero_pc

std::optional<lldb::addr_t> lldb_private::Thread::m_prev_framezero_pc
protected

Frame 0's PC the last time this thread was stopped.

Definition at line 1382 of file Thread.h.

Referenced by ClearStackFrames(), DestroyThread(), GetPreviousFrameZeroPC(), and Thread().

◆ m_process_wp

lldb::ProcessWP lldb_private::Thread::m_process_wp
protected

The process that owns this thread.

Definition at line 1353 of file Thread.h.

Referenced by GetProcess(), and Thread().

◆ m_reg_context_sp

◆ m_resume_signal

int lldb_private::Thread::m_resume_signal
protected

The signal that should be used when continuing this thread.

Definition at line 1384 of file Thread.h.

Referenced by GetResumeSignal(), SetResumeSignal(), and Thread().

◆ m_resume_state

lldb::StateType lldb_private::Thread::m_resume_state
protected

This state is used to force a thread to be suspended from outside the ThreadPlan logic.

Definition at line 1386 of file Thread.h.

Referenced by GetResumeState(), SetResumeState(), and Thread().

◆ m_should_run_before_public_stop

bool lldb_private::Thread::m_should_run_before_public_stop
protected

Definition at line 1362 of file Thread.h.

Referenced by SetShouldRunBeforePublicStop(), ShouldRunBeforePublicStop(), and Thread().

◆ m_state

lldb::StateType lldb_private::Thread::m_state
protected

The state of our process.

Definition at line 1372 of file Thread.h.

Referenced by GetState(), SetState(), and Thread().

◆ m_state_mutex

std::recursive_mutex lldb_private::Thread::m_state_mutex
mutableprotected

Multithreaded protection for m_state.

Definition at line 1374 of file Thread.h.

Referenced by GetState(), SetState(), and Thread().

◆ m_stop_info_override_stop_id

uint32_t lldb_private::Thread::m_stop_info_override_stop_id
protected

Definition at line 1359 of file Thread.h.

Referenced by GetPrivateStopInfo(), and Thread().

◆ m_stop_info_sp

◆ m_stop_info_stop_id

uint32_t lldb_private::Thread::m_stop_info_stop_id
protected

◆ m_stopped_at_unexecuted_bp

◆ m_temporary_resume_state

lldb::StateType lldb_private::Thread::m_temporary_resume_state
protected

This state records what the thread was told to do by the thread plan logic for the current resume.

Definition at line 1389 of file Thread.h.

Referenced by GetTemporaryResumeState(), SetTemporaryResumeState(), and Thread().

◆ m_unwinder_up


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