9#ifndef LLDB_TARGET_THREAD_H
10#define LLDB_TARGET_THREAD_H
29#define LLDB_THREAD_MAX_STOP_EXC_DATA 8
61class Thread :
public std::enable_shared_from_this<Thread>,
126 lldb::RegisterCheckpointSP
259 virtual const char *
GetInfo() {
return nullptr; }
279 virtual const char *
GetName() {
return nullptr; }
357 virtual lldb::QueueSP
GetQueue() {
return lldb::QueueSP(); }
401 virtual lldb::StackFrameSP
413 lldb::ValueObjectSP return_value_sp,
414 bool broadcast =
false);
417 lldb::ValueObjectSP return_value_sp,
418 bool broadcast =
false);
421 bool can_leave_function, std::string *warnings =
nullptr);
426 return lldb::StackFrameSP();
441 bool broadcast =
false);
454 virtual lldb::RegisterContextSP
491 size_t start_position = 0)
const;
499 bool print_json_thread,
bool print_json_stopinfo);
647 bool step_over,
bool abort_other_plans,
bool stop_other_threads,
698 bool abort_other_plans,
const LineEntry &line_entry,
752 const SymbolContext &addr_context,
const char *step_in_target,
761 bool abort_other_plans,
const LineEntry &line_entry,
762 const SymbolContext &addr_context,
const char *step_in_target,
808 bool abort_other_plans,
SymbolContext *addr_context,
bool first_insn,
809 bool stop_other_threads,
Vote report_stop_vote,
Vote report_run_vote,
872 bool abort_other_plans,
SymbolContext *addr_context,
bool first_insn,
873 bool stop_other_threads,
Vote report_stop_vote,
Vote report_run_vote,
874 uint32_t frame_idx,
Status &status,
bool continue_to_next_branch =
false);
898 virtual lldb::ThreadPlanSP
900 bool abort_other_plans,
bool stop_other_threads,
924 virtual lldb::ThreadPlanSP
926 bool stop_other_threads,
Status &status);
929 bool abort_other_plans,
lldb::addr_t *address_list,
size_t num_addresses,
932 virtual lldb::ThreadPlanSP
935 bool stop_other_threads,
Status &status);
1102 uint32_t num_frames_with_source,
bool stop_format,
1103 bool only_stacks =
false);
1106 uint32_t num_frames,
bool show_frame_info,
1167 void SetStopInfo(
const lldb::StopInfoSP &stop_info_sp);
1220 void PushPlan(lldb::ThreadPlanSP plan_sp);
1254 virtual llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
1256 return llvm::make_error<UnimplementedError>();
1277 mutable std::recursive_mutex
1279 mutable std::recursive_mutex
A section + offset based address range class.
A section + offset based address class.
An event broadcasting class.
"lldb/Utility/ArgCompletionRequest.h"
A uniqued constant string class.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A plug-in interface definition class for halted OS helpers.
A plug-in interface definition class for debugging a process.
This base class provides an interface to stack frames.
A stream class that can stream formatted output to a file.
std::shared_ptr< Object > ObjectSP
Defines a symbol context baton that can be handed other debug core functions.
bool GetStepInAvoidsNoDebug() const
~ThreadProperties() override
const RegularExpression * GetSymbolsToAvoidRegexp()
The regular expression returned determines symbols that this thread won't stop in during "step-in" op...
bool GetTraceEnabledState() const
uint64_t GetMaxBacktraceDepth() const
FileSpecList GetLibrariesToAvoid() const
bool GetStepOutAvoidsNoDebug() const
~ThreadEventData() override
static const ThreadEventData * GetEventDataFromEvent(const Event *event_ptr)
static lldb::ThreadSP GetThreadFromEvent(const Event *event_ptr)
void Dump(Stream *s) const override
static lldb::StackFrameSP GetStackFrameFromEvent(const Event *event_ptr)
llvm::StringRef GetFlavor() const override
static llvm::StringRef GetFlavorString()
const ThreadEventData & operator=(const ThreadEventData &)=delete
StackID GetStackID() const
lldb::ThreadSP GetThread() const
ThreadEventData(const ThreadEventData &)=delete
lldb::ThreadSP m_thread_sp
static StackID GetStackIDFromEvent(const Event *event_ptr)
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.
bool IsThreadPlanDone(ThreadPlan *plan) const
Checks whether the given plan is in the completed plans for this stop.
virtual lldb::user_id_t GetProtocolID() const
lldb::ThreadSP GetCurrentExceptionBacktrace()
virtual void SetExtendedBacktraceToken(uint64_t token)
Sets the extended backtrace token for this thread.
void BroadcastSelectedFrameChange(StackID &new_frame_id)
Status UnwindInnermostExpression()
Unwinds the thread stack for the innermost expression plan currently on the thread plan stack.
bool DecrementCurrentInlinedDepth()
const uint32_t m_index_id
A unique 1 based index assigned to each thread for easy UI/command line access.
void SetShouldRunBeforePublicStop(bool newval)
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
virtual const char * GetQueueName()
Retrieve the Queue name for the queue currently using this Thread.
bool CompletedPlanOverridesBreakpoint() const
Check if we have completed plan to override breakpoint stop reason.
Thread(const Thread &)=delete
lldb::StackFrameListSP m_curr_frames_sp
The stack frames that get lazily populated after a thread stops.
virtual bool SafeToCallFunctions()
Check whether this thread is safe to run functions.
void RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state)
Status QueueThreadPlan(lldb::ThreadPlanSP &plan_sp, bool abort_other_plans)
Queues a generic thread plan.
bool WasThreadPlanDiscarded(ThreadPlan *plan) const
Checks whether the given plan is in the discarded plans for this stop.
virtual lldb::RegisterContextSP GetRegisterContext()=0
virtual lldb::addr_t GetThreadPointer()
Retrieves the per-thread data area.
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 bool RestoreRegisterStateFromCheckpoint(ThreadStateCheckpoint &saved_state)
virtual void ClearBackingThread()
uint32_t m_stop_info_stop_id
virtual bool SetBackingThread(const lldb::ThreadSP &thread_sp)
void AutoCompleteThreadPlans(CompletionRequest &request) const
Format the thread plan information for auto completion.
std::recursive_mutex m_frame_mutex
Multithreaded protection for m_state.
virtual void RefreshStateAfterStop()=0
static void SettingsInitialize()
void SetShouldReportStop(Vote vote)
virtual lldb::StopInfoSP GetPrivateStopInfo(bool calculate=true)
uint32_t GetIndexID() const
static ConstString & GetStaticBroadcasterClass()
Status ReturnFromFrame(lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
void DiscardThreadPlans(bool force)
Discards the plans queued on the plan stack of the current thread.
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp)
bool GetDescription(Stream &s, lldb::DescriptionLevel level, bool print_json_thread, bool print_json_stopinfo)
static std::string RunModeAsString(lldb::RunMode mode)
void SetTemporaryResumeState(lldb::StateType new_state)
virtual bool MatchesSpec(const ThreadSpec *spec)
lldb::ProcessSP CalculateProcess() override
StructuredData::ObjectSP GetExtendedInfo()
Retrieve a dictionary of information about this thread.
virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, lldb::addr_t tls_file_addr)
Retrieves the per-module TLS block for a thread.
void SetStopInfoToNothing()
@ eBroadcastBitSelectedFrameChanged
@ eBroadcastBitThreadSelected
@ eBroadcastBitThreadResumed
@ eBroadcastBitStackChanged
@ eBroadcastBitThreadSuspended
virtual void DestroyThread()
size_t GetStackFrameStatus(Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, uint32_t num_frames_with_source)
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 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 in...
void SetResumeState(lldb::StateType state, bool override_suspend=false)
Sets the USER resume state for this thread.
lldb::StackFrameSP GetSelectedFrame(SelectMostRelevant select_most_relevant)
virtual bool IsStillAtLastBreakpointHit()
std::recursive_mutex m_state_mutex
Multithreaded protection for m_state.
ConstString & GetBroadcasterClass() const override
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager ...
ThreadPlan * GetPreviousPlan(ThreadPlan *plan) const
virtual const char * GetName()
void PushPlan(lldb::ThreadPlanSP plan_sp)
lldb::StackFrameListSP m_prev_frames_sp
The previous stack frames from the last time this thread stopped.
virtual lldb::addr_t GetQueueLibdispatchQueueAddress()
Retrieve the address of the libdispatch_queue_t struct for queue currently using this Thread.
virtual void ClearStackFrames()
ThreadPlan * GetCurrentPlan() const
Gets the plan which will execute next on the plan stack.
virtual Unwind & GetUnwinder()
virtual const char * GetInfo()
virtual lldb::QueueKind GetQueueKind()
Retrieve the Queue kind for the queue currently using this Thread.
void SetResumeSignal(int signal)
virtual lldb::QueueSP GetQueue()
Retrieve the Queue for this thread, if any.
lldb::ValueObjectSP GetReturnValueObject() const
Gets the outer-most return value from the completed plans.
virtual lldb::ThreadSP GetBackingThread() const
lldb::ExpressionVariableSP GetExpressionVariable() const
Gets the outer-most expression variable from the completed plans.
virtual bool ThreadHasQueueInformation() const
Whether this Thread already has all the Queue information cached or not.
Vote ShouldReportRun(Event *event_ptr)
lldb::TargetSP CalculateTarget() override
static std::string StopReasonAsString(lldb::StopReason reason)
virtual void WillResume(lldb::StateType resume_state)
virtual void SetAssociatedWithLibdispatchQueue(lldb_private::LazyBool associated_with_libdispatch_queue)
virtual bool IsOperatingSystemPluginThread() const
bool ThreadStoppedForAReason()
virtual lldb_private::LazyBool GetAssociatedWithLibdispatchQueue()
Whether this thread can be associated with a libdispatch queue.
std::string GetStopDescriptionRaw()
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 tha...
bool ShouldRunBeforePublicStop()
virtual Status StepOver(bool source_step, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Default implementation for stepping over.
bool ShouldResume(lldb::StateType resume_state)
std::unique_ptr< lldb_private::Unwind > m_unwinder_up
It gets set in Thread::ShouldResume.
std::unique_ptr< ThreadPlanStack > m_null_plan_stack_up
virtual void SetQueueName(const char *name)
lldb::StateType GetTemporaryResumeState() const
void SetDefaultFileAndLineToSelectedFrame()
virtual lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame)=0
virtual bool CheckpointThreadState(ThreadStateCheckpoint &saved_state)
void SetState(lldb::StateType state)
uint32_t GetSelectedFrameIndex(SelectMostRelevant select_most_relevant)
int GetResumeSignal() const
lldb::ProcessSP GetProcess() const
lldb::StackFrameSP CalculateStackFrame() override
virtual void SetQueueKind(lldb::QueueKind kind)
lldb::StateType GetResumeState() const
Gets the USER resume state for this thread.
virtual void SetQueueID(lldb::queue_id_t new_val)
uint32_t SetSelectedFrame(lldb_private::StackFrame *frame, bool broadcast=false)
lldb::StopInfoSP m_stop_info_sp
The private stop reason for this thread.
lldb::ProcessWP m_process_wp
The process that owns this thread.
void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, bool stop_format)
LazyBool m_override_should_notify
lldb::ThreadSP CalculateThread() override
Status ReturnFromFrameWithIndex(uint32_t frame_idx, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
virtual Status StepOut(uint32_t frame_idx=0)
Default implementation for stepping out.
virtual llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > GetSiginfo(size_t max_size) const
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.
const Thread & operator=(const Thread &)=delete
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 orde...
lldb::StateType GetState() const
lldb::StateType m_state
The state of our process.
virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status)
bool m_extended_info_fetched
void CalculatePublicStopInfo()
virtual lldb_private::StructuredData::ObjectSP FetchThreadExtendedInfo()
virtual void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t)
static void SettingsTerminate()
bool SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast=false)
virtual lldb::StackFrameSP GetFrameWithStackID(const StackID &stack_id)
lldb::StopReason GetStopReason()
virtual void SetName(const char *name)
ThreadPlanStack & GetPlans() const
lldb::ValueObjectSP GetSiginfoValue()
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.
uint32_t m_stop_info_override_stop_id
int m_resume_signal
The signal that should be used when continuing this thread.
bool StopInfoIsUpToDate() const
lldb::StackFrameSP GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr)
lldb::ThreadPlanSP GetCompletedPlan() const
Gets the outer-most plan that was popped off the plan stack in the most recent stop.
lldb::ValueObjectSP GetCurrentException()
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::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx)
bool ShouldStop(Event *event_ptr)
Status JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings=nullptr)
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 FrameSelectedCallback(lldb_private::StackFrame *frame)
lldb::ThreadPlanSP QueueBasePlan(bool abort_other_plans)
Queues the base plan for a thread.
virtual lldb::queue_id_t GetQueueID()
Retrieve the Queue ID for the queue currently using this Thread.
static ThreadProperties & GetGlobalProperties()
virtual uint64_t GetExtendedBacktraceToken()
Gets the extended backtrace token for this thread.
virtual uint32_t GetExtendedBacktraceOriginatingIndexID()
uint32_t GetCurrentInlinedDepth()
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.
std::string GetStopDescription()
StructuredData::ObjectSP m_extended_info
lldb::StopInfoSP GetStopInfo()
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.
size_t GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, bool stop_format, bool only_stacks=false)
lldb::StackFrameListSP GetStackFrameList()
bool m_should_run_before_public_stop
Vote ShouldReportStop(Event *event_ptr)
bool SetSelectedFrameByIndexNoisily(uint32_t frame_idx, Stream &output_stream)
virtual bool CalculateStopInfo()=0
lldb::StateType m_resume_state
This state is used to force a thread to be suspended from outside the ThreadPlan logic.
virtual uint32_t GetStackFrameCount()
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.
lldb::RegisterContextSP m_reg_context_sp
The register context for this thread's current register state.
#define LLDB_INVALID_QUEUE_ID
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
StateType
Process and Thread States.
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
StopReason
Thread stop reasons.
A line table entry class.
uint32_t current_inlined_depth
lldb::RegisterCheckpointSP register_backup_sp
size_t m_completed_plan_checkpoint
lldb::StopInfoSP stop_info_sp
lldb::addr_t current_inlined_pc
A mix in class that contains a generic user ID.
lldb::user_id_t GetID() const
Get accessor for the user ID.