93 std::unique_lock<std::recursive_mutex> lock;
111 return this->
operator bool();
113SBThread::operator bool()
const {
116 std::unique_lock<std::recursive_mutex> lock;
121 if (target && process) {
124 return m_opaque_sp->GetThreadSP().get() !=
nullptr;
140 std::unique_lock<std::recursive_mutex> lock;
156 std::unique_lock<std::recursive_mutex> lock;
164 StopReason reason = stop_info_sp->GetStopReason();
179 break_id_t site_id = stop_info_sp->GetValue();
184 return bp_site_sp->GetNumberOfConstituents() * 2;
216 std::unique_lock<std::recursive_mutex> lock;
225 StopReason reason = stop_info_sp->GetStopReason();
240 break_id_t site_id = stop_info_sp->GetValue();
245 uint32_t bp_index = idx / 2;
247 bp_site_sp->GetConstituentAtIndex(bp_index));
251 return bp_loc_sp->GetID();
254 return bp_loc_sp->GetBreakpoint().GetID();
262 return stop_info_sp->GetValue();
265 return stop_info_sp->GetValue();
268 return stop_info_sp->GetValue();
271 return stop_info_sp->GetValue();
274 return stop_info_sp->GetValue();
277 return stop_info_sp->GetValue();
290 std::unique_lock<std::recursive_mutex> lock;
312 std::unique_lock<std::recursive_mutex> lock;
325 threads = process_sp->GetInstrumentationRuntime(type)
326 ->GetBacktracesFromExtendedStopInfo(info);
333 std::unique_lock<std::recursive_mutex> lock;
347 if (thread_stop_desc.empty())
351 return ::snprintf(dst, dst_len,
"%s", thread_stop_desc.c_str()) + 1;
355 return thread_stop_desc.size() + 1;
362 std::unique_lock<std::recursive_mutex> lock;
375 return SBValue(return_valobj_sp);
387 return thread_sp->GetID();
396 return thread_sp->GetIndexID();
403 std::unique_lock<std::recursive_mutex> lock;
419 std::unique_lock<std::recursive_mutex> lock;
436 std::unique_lock<std::recursive_mutex> lock;
452 bool success =
false;
453 std::unique_lock<std::recursive_mutex> lock;
463 info_root_sp->GetObjectForDotSeparatedPath(path);
466 strm.
ref() << node->GetAsString()->GetValue();
470 strm.Printf(
"0x%" PRIx64, node->GetUnsignedIntegerValue());
474 strm.Printf(
"0x%f", node->GetAsFloat()->GetValue());
478 if (node->GetAsBoolean()->GetValue())
481 strm.Printf(
"false");
514 if (new_plan !=
nullptr) {
540 std::unique_lock<std::recursive_mutex> lock;
544 error.SetErrorString(
"this SBThread object is invalid");
549 bool abort_other_plans =
false;
555 if (frame_sp->HasDebugInformation()) {
557 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
559 abort_other_plans, sc.
line_entry, sc, stop_other_threads,
560 new_plan_status, avoid_no_debug);
563 true, abort_other_plans, stop_other_threads, new_plan_status);
572 StepInto(
nullptr, stop_other_threads);
587 std::unique_lock<std::recursive_mutex> lock;
591 error.SetErrorString(
"this SBThread object is invalid");
595 bool abort_other_plans =
false;
602 if (frame_sp && frame_sp->HasDebugInformation()) {
603 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
612 const LazyBool step_out_avoids_code_without_debug_info =
614 const LazyBool step_in_avoids_code_without_debug_info =
617 abort_other_plans, range, sc, target_name, stop_other_threads,
618 new_plan_status, step_in_avoids_code_without_debug_info,
619 step_out_avoids_code_without_debug_info);
622 false, abort_other_plans, stop_other_threads, new_plan_status);
641 std::unique_lock<std::recursive_mutex> lock;
645 error.SetErrorString(
"this SBThread object is invalid");
649 bool abort_other_plans =
false;
650 bool stop_other_threads =
false;
657 abort_other_plans,
nullptr,
false, stop_other_threads,
eVoteYes,
676 std::unique_lock<std::recursive_mutex> lock;
680 error.SetErrorString(
"passed invalid SBFrame object");
687 error.SetErrorString(
"this SBThread object is invalid");
691 bool abort_other_plans =
false;
692 bool stop_other_threads =
false;
695 error.SetErrorString(
"passed a frame from another thread");
701 abort_other_plans,
nullptr,
false, stop_other_threads,
eVoteYes,
720 std::unique_lock<std::recursive_mutex> lock;
724 error.SetErrorString(
"this SBThread object is invalid");
731 step_over,
false,
true, new_plan_status));
749 std::unique_lock<std::recursive_mutex> lock;
753 error.SetErrorString(
"this SBThread object is invalid");
757 bool abort_other_plans =
false;
758 bool stop_other_threads =
true;
766 abort_other_plans, target_addr, stop_other_threads, new_plan_status));
781 std::unique_lock<std::recursive_mutex> lock;
812 frame_sc = frame_sp->GetSymbolContext(
813 eSymbolContextCompUnit | eSymbolContextFunction |
814 eSymbolContextLineEntry | eSymbolContextSymbol);
817 sb_error.SetErrorStringWithFormat(
818 "frame %u doesn't have debug information", frame_sp->GetFrameIndex());
825 step_file_spec = sb_file_spec.
ref();
830 sb_error.
SetErrorString(
"invalid file argument or no file for frame");
840 bool all_in_function =
true;
843 std::vector<addr_t> step_over_until_addrs;
844 const bool abort_other_plans =
false;
845 const bool stop_other_threads =
false;
848 step_file_spec, line, std::nullopt,
true,
853 eSymbolContextLineEntry, sc_list);
856 sc.line_entry.range.GetBaseAddress().GetLoadAddress(target);
859 step_over_until_addrs.push_back(step_addr);
861 all_in_function =
false;
865 if (step_over_until_addrs.empty()) {
866 if (all_in_function) {
867 step_file_spec.
GetPath(path,
sizeof(path));
868 sb_error.SetErrorStringWithFormat(
"No line entries for %s:%u", path,
871 sb_error.
SetErrorString(
"step until target not in current function");
875 abort_other_plans, &step_over_until_addrs[0],
876 step_over_until_addrs.size(), stop_other_threads,
877 frame_sp->GetFrameIndex(), new_plan_status));
897 bool resume_immediately) {
907 bool resume_immediately) {
912 std::unique_lock<std::recursive_mutex> lock;
916 error.SetErrorString(
"this SBThread object is invalid");
925 false, script_class_name, obj_sp,
false, new_plan_status);
927 if (new_plan_status.
Fail()) {
932 if (!resume_immediately)
948 std::unique_lock<std::recursive_mutex> lock;
968 std::unique_lock<std::recursive_mutex> lock;
985 std::unique_lock<std::recursive_mutex> lock;
1008 std::unique_lock<std::recursive_mutex> lock;
1011 bool result =
false;
1018 error.SetErrorString(
"process is running");
1021 error.SetErrorString(
"this SBThread object is invalid");
1035 std::unique_lock<std::recursive_mutex> lock;
1038 bool result =
false;
1042 const bool override_suspend =
true;
1046 error.SetErrorString(
"process is running");
1049 error.SetErrorString(
"this SBThread object is invalid");
1056 std::unique_lock<std::recursive_mutex> lock;
1067 std::unique_lock<std::recursive_mutex> lock;
1079 std::unique_lock<std::recursive_mutex> lock;
1094 uint32_t num_frames = 0;
1095 std::unique_lock<std::recursive_mutex> lock;
1113 std::unique_lock<std::recursive_mutex> lock;
1132 std::unique_lock<std::recursive_mutex> lock;
1152 std::unique_lock<std::recursive_mutex> lock;
1207 std::unique_lock<std::recursive_mutex> lock;
1230 std::unique_lock<std::recursive_mutex> lock;
1248 error.SetErrorString(
"The provided SBFormat object is invalid");
1252 std::unique_lock<std::recursive_mutex> lock;
1262 error.SetErrorStringWithFormat(
1263 "It was not possible to generate a thread description with the given "
1264 "format string '%s'",
1272 std::unique_lock<std::recursive_mutex> lock;
1288 if (new_thread_sp) {
1292 sb_origin_thread.
SetThread(new_thread_sp);
1300 return sb_origin_thread;
1308 return thread_sp->GetExtendedBacktraceOriginatingIndexID();
1319 return SBValue(thread_sp->GetCurrentException());
1329 return SBThread(thread_sp->GetCurrentExceptionBacktrace());
1337 return thread_sp->SafeToCallFunctions();
1357 return thread_sp->GetSiginfoValue();
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT()
#define LLDB_INSTRUMENT_VA(...)
void SetErrorString(const char *err_str)
void SetError(uint32_t err, lldb::ErrorType type)
lldb_private::Status & ref()
lldb_private::Event * get() const
const lldb_private::FileSpec & ref() const
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
lldb::SBThread GetThread() const
lldb::StackFrameSP GetFrameSP() const
void SetSP(const lldb::ProcessSP &process_sp)
void SetQueue(const lldb::QueueSP &queue_sp)
lldb_private::Stream & ref()
StructuredDataImplUP m_impl_up
size_t GetStopDescription(char *dst_or_null, size_t dst_len)
static const char * GetBroadcasterClassName()
void StepInto(lldb::RunMode stop_other_threads=lldb::eOnlyDuringStepping)
bool Suspend()
LLDB currently supports process centric debugging which means when any thread in a process stops,...
const char * GetName() const
const lldb::SBThread & operator=(const lldb::SBThread &rhs)
lldb::SBFrame SetSelectedFrame(uint32_t frame_idx)
SBError UnwindInnermostExpression()
SBError ResumeNewPlan(lldb_private::ExecutionContext &exe_ctx, lldb_private::ThreadPlan *new_plan)
friend class SBThreadCollection
const char * GetQueueName() const
uint32_t GetIndexID() const
bool GetDescription(lldb::SBStream &description) const
static bool EventIsThreadEvent(const SBEvent &event)
lldb_private::Thread * operator->()
lldb_private::Thread * get()
void StepOutOfFrame(SBFrame &frame)
bool GetStatus(lldb::SBStream &status) const
static SBFrame GetStackFrameFromEvent(const SBEvent &event)
lldb::queue_id_t GetQueueID() const
bool GetInfoItemByPathAsString(const char *path, SBStream &strm)
lldb::SBFrame GetSelectedFrame()
bool operator!=(const lldb::SBThread &rhs) const
SBError StepUsingScriptedThreadPlan(const char *script_class_name)
lldb::tid_t GetThreadID() const
lldb::SBFrame GetFrameAtIndex(uint32_t idx)
uint32_t GetExtendedBacktraceOriginatingIndexID()
lldb::SBQueue GetQueue() const
bool SafeToCallFunctions()
lldb::SBProcess GetProcess()
size_t GetStopReasonDataCount()
Get the number of words associated with the stop reason.
void StepInstruction(bool step_over)
SBThread GetCurrentExceptionBacktrace()
static SBThread GetThreadFromEvent(const SBEvent &event)
bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream)
lldb::StopReason GetStopReason()
SBValue GetStopReturnValue()
void StepOver(lldb::RunMode stop_other_threads=lldb::eOnlyDuringStepping)
SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line)
SBError GetDescriptionWithFormat(const SBFormat &format, SBStream &output)
Similar to GetDescription() but the format of the description can be configured via the format parame...
SBThreadCollection GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type)
SBValue GetCurrentException()
void SetThread(const lldb::ThreadSP &lldb_object_sp)
lldb::ThreadSP GetSP() const
SBThread GetExtendedBacktraceThread(const char *type)
lldb::ExecutionContextRefSP m_opaque_sp
void RunToAddress(lldb::addr_t addr)
uint64_t GetStopReasonDataAtIndex(uint32_t idx)
Get information associated with a stop reason.
SBError ReturnFromFrame(SBFrame &frame, SBValue &return_value)
bool operator==(const lldb::SBThread &rhs) const
SBError StepOverUntil(lldb::SBFrame &frame, lldb::SBFileSpec &file_spec, uint32_t line)
lldb::ValueObjectSP GetSP() const
Same as the protected version of GetSP that takes a locker, except that we make the locker locally in...
A section + offset based address range class.
bool ContainsLoadAddress(const Address &so_addr, Target *target) const
Check if a section offset so_addr when represented as a load address is contained within this object'...
A section + offset based address class.
void ResolveSymbolContext(const SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list, RealpathPrefixes *realpath_prefixes=nullptr)
Resolve symbol contexts by file and line.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
Execution context objects refer to objects in the execution of the program that is being debugged.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool HasThreadScope() const
Returns true the ExecutionContext object contains a valid target, process, and thread.
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
Target * GetTargetPtr() const
Returns a pointer to the target object.
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
Process * GetProcessPtr() const
Returns a pointer to the process object.
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
const AddressRange & GetAddressRange()
bool TryLock(ProcessRunLock *lock)
A plug-in interface definition class for debugging a process.
StopPointSiteList< lldb_private::BreakpointSite > & GetBreakpointSiteList()
ThreadList & GetThreadList()
Status Resume()
Resumes all of a process's threads as configured using the Thread run control functions.
virtual SystemRuntime * GetSystemRuntime()
Get the system runtime plug-in for this process.
ThreadList & GetExtendedThreadList()
Status ResumeSynchronous(Stream *stream)
Resume a process, and wait for it to stop.
ProcessRunLock & GetRunLock()
Target & GetTarget()
Get the target object pointer for this module.
"lldb/Core/SourceLocationSpec.h" A source location specifier class.
bool Fail() const
Test for error condition.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
bool Success() const
Test for success condition.
static lldb::ValueObjectSP GetReturnValueObject(lldb::StopInfoSP &stop_info_sp)
StopPointSiteSP FindByID(typename StopPointSite::SiteID site_id)
Returns a shared pointer to the site with id site_id.
A stream class that can stream formatted output to a file.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
std::shared_ptr< Object > ObjectSP
Defines a list of symbol context objects.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
LineEntry line_entry
The LineEntry for a given query.
bool GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, Status &error)
A plug-in interface definition class for system runtimes.
virtual lldb::ThreadSP GetExtendedBacktraceThread(lldb::ThreadSP thread, ConstString type)
Return a Thread which shows the origin of this thread's creation.
void AddThread(const lldb::ThreadSP &thread_sp)
bool SetSelectedThreadByID(lldb::tid_t tid, bool notify=false)
void SetOkayToDiscard(bool value)
bool SetIsControllingPlan(bool value)
static const ThreadEventData * GetEventDataFromEvent(const Event *event_ptr)
static lldb::ThreadSP GetThreadFromEvent(const Event *event_ptr)
static lldb::StackFrameSP GetStackFrameFromEvent(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.
Status UnwindInnermostExpression()
Unwinds the thread stack for the innermost expression plan currently on the thread plan stack.
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
virtual const char * GetQueueName()
Retrieve the Queue name for the queue currently using this Thread.
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)
Status ReturnFromFrame(lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
StructuredData::ObjectSP GetExtendedInfo()
Retrieve a dictionary of information about this thread.
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.
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 const char * GetName()
static llvm::StringRef GetStaticBroadcasterClass()
virtual lldb::QueueSP GetQueue()
Retrieve the Queue for this thread, if any.
lldb::StateType GetResumeState() const
Gets the USER resume state for this thread.
uint32_t SetSelectedFrame(lldb_private::StackFrame *frame, bool broadcast=false)
void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, bool stop_format)
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.
lldb::StateType GetState() const
virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status)
bool SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast=false)
lldb::StopReason GetStopReason()
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.
Status JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings=nullptr)
bool DumpUsingFormat(Stream &strm, uint32_t frame_idx, const FormatEntity::Entry *format)
Print a description of this thread using the provided thread format.
virtual lldb::queue_id_t GetQueueID()
Retrieve the Queue ID for the queue currently using this 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.
std::string GetStopDescription()
lldb::StopInfoSP GetStopInfo()
virtual uint32_t GetStackFrameCount()
GetStackFrameCount can be expensive.
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)
#define LLDB_INVALID_QUEUE_ID
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_LINE_NUMBER
#define LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_INDEX32
#define LLDB_INVALID_ADDRESS
@ DoNoSelectMostRelevantFrame
@ SelectMostRelevantFrame
A class that represents a running process on the host machine.
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::Queue > QueueSP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::BreakpointSite > BreakpointSiteSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
@ eStateRunning
Process or thread is running and can't be examined.
std::shared_ptr< lldb_private::Process > ProcessSP
InstrumentationRuntimeType
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
StopReason
Thread stop reasons.
@ eStopReasonInstrumentation
@ eStopReasonPlanComplete
@ eStopReasonExec
Program was re-exec'ed.
@ eStopReasonInterrupt
Thread requested interrupt.
@ eStopReasonProcessorTrace
@ eStopReasonThreadExiting
@ eStructuredDataTypeFloat
@ eStructuredDataTypeInteger
@ eStructuredDataTypeNull
@ eStructuredDataTypeBoolean
@ eStructuredDataTypeString
bool IsValid() const
Check if a line entry object is valid.
AddressRange range
The section offset address range for this line entry.
const FileSpec & GetFile() const
Helper to access the file.
lldb::user_id_t GetID() const
Get accessor for the user ID.