Go to the documentation of this file.
56 return Thread::GetStaticBroadcasterClass().AsCString();
93 std::unique_lock<std::recursive_mutex> lock;
111 return this->
operator bool();
113 SBThread::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();
180 lldb::BreakpointSiteSP bp_site_sp(
184 return bp_site_sp->GetNumberOfOwners() * 2;
213 std::unique_lock<std::recursive_mutex> lock;
222 StopReason reason = stop_info_sp->GetStopReason();
237 break_id_t site_id = stop_info_sp->GetValue();
238 lldb::BreakpointSiteSP bp_site_sp(
243 BreakpointLocationSP bp_loc_sp(
244 bp_site_sp->GetOwnerAtIndex(bp_index));
248 return bp_loc_sp->GetID();
251 return bp_loc_sp->GetBreakpoint().GetID();
259 return stop_info_sp->GetValue();
262 return stop_info_sp->GetValue();
265 return stop_info_sp->GetValue();
268 return stop_info_sp->GetValue();
271 return stop_info_sp->GetValue();
284 std::unique_lock<std::recursive_mutex> lock;
306 std::unique_lock<std::recursive_mutex> lock;
319 threads = process_sp->GetInstrumentationRuntime(type)
320 ->GetBacktracesFromExtendedStopInfo(info);
327 std::unique_lock<std::recursive_mutex> lock;
341 if (thread_stop_desc.empty())
345 return ::snprintf(dst, dst_len,
"%s", thread_stop_desc.c_str()) + 1;
349 return thread_stop_desc.size() + 1;
355 ValueObjectSP return_valobj_sp;
356 std::unique_lock<std::recursive_mutex> lock;
364 return_valobj_sp = StopInfo::GetReturnValueObject(stop_info_sp);
369 return SBValue(return_valobj_sp);
381 return thread_sp->GetID();
390 return thread_sp->GetIndexID();
397 const char *name =
nullptr;
398 std::unique_lock<std::recursive_mutex> lock;
414 const char *name =
nullptr;
415 std::unique_lock<std::recursive_mutex> lock;
432 std::unique_lock<std::recursive_mutex> lock;
448 bool success =
false;
449 std::unique_lock<std::recursive_mutex> lock;
459 info_root_sp->GetObjectForDotSeparatedPath(path);
462 strm.
Printf(
"%s", node->GetAsString()->GetValue().str().c_str());
466 strm.
Printf(
"0x%" PRIx64, node->GetAsInteger()->GetValue());
470 strm.
Printf(
"0x%f", node->GetAsFloat()->GetValue());
474 if (node->GetAsBoolean()->GetValue())
510 if (new_plan !=
nullptr) {
536 std::unique_lock<std::recursive_mutex> lock;
540 error.SetErrorString(
"this SBThread object is invalid");
545 bool abort_other_plans =
false;
549 ThreadPlanSP new_plan_sp;
551 if (frame_sp->HasDebugInformation()) {
553 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
555 abort_other_plans, sc.
line_entry, sc, stop_other_threads,
556 new_plan_status, avoid_no_debug);
559 true, abort_other_plans, stop_other_threads, new_plan_status);
568 StepInto(
nullptr, stop_other_threads);
583 std::unique_lock<std::recursive_mutex> lock;
587 error.SetErrorString(
"this SBThread object is invalid");
591 bool abort_other_plans =
false;
595 ThreadPlanSP new_plan_sp;
598 if (frame_sp && frame_sp->HasDebugInformation()) {
599 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
608 const LazyBool step_out_avoids_code_without_debug_info =
610 const LazyBool step_in_avoids_code_without_debug_info =
613 abort_other_plans, range, sc, target_name, stop_other_threads,
614 new_plan_status, step_in_avoids_code_without_debug_info,
615 step_out_avoids_code_without_debug_info);
618 false, abort_other_plans, stop_other_threads, new_plan_status);
637 std::unique_lock<std::recursive_mutex> lock;
641 error.SetErrorString(
"this SBThread object is invalid");
645 bool abort_other_plans =
false;
646 bool stop_other_threads =
false;
653 abort_other_plans,
nullptr,
false, stop_other_threads,
eVoteYes,
672 std::unique_lock<std::recursive_mutex> lock;
676 error.SetErrorString(
"passed invalid SBFrame object");
683 error.SetErrorString(
"this SBThread object is invalid");
687 bool abort_other_plans =
false;
688 bool stop_other_threads =
false;
691 error.SetErrorString(
"passed a frame from another thread");
697 abort_other_plans,
nullptr,
false, stop_other_threads,
eVoteYes,
716 std::unique_lock<std::recursive_mutex> lock;
720 error.SetErrorString(
"this SBThread object is invalid");
727 step_over,
true,
true, new_plan_status));
745 std::unique_lock<std::recursive_mutex> lock;
749 error.SetErrorString(
"this SBThread object is invalid");
753 bool abort_other_plans =
false;
754 bool stop_other_threads =
true;
762 abort_other_plans, target_addr, stop_other_threads, new_plan_status));
777 std::unique_lock<std::recursive_mutex> lock;
804 frame_sc = frame_sp->GetSymbolContext(
805 eSymbolContextCompUnit | eSymbolContextFunction |
806 eSymbolContextLineEntry | eSymbolContextSymbol);
810 "frame %u doesn't have debug information", frame_sp->GetFrameIndex());
817 step_file_spec = sb_file_spec.
ref();
822 sb_error.
SetErrorString(
"invalid file argument or no file for frame");
832 bool all_in_function =
true;
835 std::vector<addr_t> step_over_until_addrs;
836 const bool abort_other_plans =
false;
837 const bool stop_other_threads =
false;
840 step_file_spec, line, std::nullopt,
true,
845 eSymbolContextLineEntry, sc_list);
847 if (num_matches > 0) {
849 for (
uint32_t i = 0; i < num_matches; ++i) {
855 step_over_until_addrs.push_back(step_addr);
857 all_in_function =
false;
863 if (step_over_until_addrs.empty()) {
864 if (all_in_function) {
865 step_file_spec.
GetPath(path,
sizeof(path));
869 sb_error.
SetErrorString(
"step until target not in current function");
873 abort_other_plans, &step_over_until_addrs[0],
874 step_over_until_addrs.size(), stop_other_threads,
875 frame_sp->GetFrameIndex(), new_plan_status));
895 bool resume_immediately) {
905 bool resume_immediately) {
910 std::unique_lock<std::recursive_mutex> lock;
914 error.SetErrorString(
"this SBThread object is invalid");
923 false, script_class_name, obj_sp,
false, new_plan_status);
925 if (new_plan_status.
Fail()) {
930 if (!resume_immediately)
946 std::unique_lock<std::recursive_mutex> lock;
966 std::unique_lock<std::recursive_mutex> lock;
983 std::unique_lock<std::recursive_mutex> lock;
1006 std::unique_lock<std::recursive_mutex> lock;
1009 bool result =
false;
1016 error.SetErrorString(
"process is running");
1019 error.SetErrorString(
"this SBThread object is invalid");
1033 std::unique_lock<std::recursive_mutex> lock;
1036 bool result =
false;
1040 const bool override_suspend =
true;
1044 error.SetErrorString(
"process is running");
1047 error.SetErrorString(
"this SBThread object is invalid");
1054 std::unique_lock<std::recursive_mutex> lock;
1065 std::unique_lock<std::recursive_mutex> lock;
1077 std::unique_lock<std::recursive_mutex> lock;
1093 std::unique_lock<std::recursive_mutex> lock;
1110 StackFrameSP frame_sp;
1111 std::unique_lock<std::recursive_mutex> lock;
1129 StackFrameSP frame_sp;
1130 std::unique_lock<std::recursive_mutex> lock;
1148 StackFrameSP frame_sp;
1149 std::unique_lock<std::recursive_mutex> lock;
1170 return Thread::ThreadEventData::GetEventDataFromEvent(event.
get()) !=
nullptr;
1176 return Thread::ThreadEventData::GetStackFrameFromEvent(event.
get());
1182 return Thread::ThreadEventData::GetThreadFromEvent(event.
get());
1204 std::unique_lock<std::recursive_mutex> lock;
1226 std::unique_lock<std::recursive_mutex> lock;
1244 std::unique_lock<std::recursive_mutex> lock;
1258 ThreadSP new_thread_sp(
1260 if (new_thread_sp) {
1264 sb_origin_thread.
SetThread(new_thread_sp);
1272 return sb_origin_thread;
1280 return thread_sp->GetExtendedBacktraceOriginatingIndexID();
1291 return SBValue(thread_sp->GetCurrentException());
1301 return SBThread(thread_sp->GetCurrentExceptionBacktrace());
1309 return thread_sp->SafeToCallFunctions();
1327 return thread_sp->GetSiginfoValue();
lldb::SBThread GetThread() const
SBError StepUsingScriptedThreadPlan(const char *script_class_name)
SBValue GetCurrentException()
Address & GetBaseAddress()
Get accessor for the base address of the range.
lldb::queue_id_t GetQueueID() const
@ eStructuredDataTypeBoolean
SBThread GetCurrentExceptionBacktrace()
lldb_private::Event * get() const
CompileUnit * comp_unit
The CompileUnit for a given query.
class LLDB_API SBThreadCollection
lldb::SBFrame SetSelectedFrame(uint32_t frame_idx)
lldb_private::Stream & ref()
FileSpec file
The source file, possibly mapped by the target.source-map setting.
void StepOutOfFrame(SBFrame &frame)
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
lldb_private::Thread * operator->()
void SetResumeState(lldb::StateType state, bool override_suspend=false)
Sets the USER resume state for this thread.
void SetThread(const lldb::ThreadSP &lldb_object_sp)
lldb::StackFrameSP GetFrameSP() const
void Printf(const char *format,...) __attribute__((format(printf
bool IsValid() const
Check if a line entry object is valid.
bool SafeToCallFunctions()
const AddressRange & GetAddressRange()
size_t GetStopReasonDataCount()
Get the number of words associated with the stop reason.
Process * GetProcessPtr() const
Returns a pointer to the process object.
static SBThread GetThreadFromEvent(const SBEvent &event)
@ eStructuredDataTypeString
bool operator==(const lldb::SBThread &rhs) const
void SetOkayToDiscard(bool value)
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.
Status JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings=nullptr)
bool GetDescription(lldb::SBStream &description) const
virtual lldb::queue_id_t GetQueueID()
Retrieve the Queue ID for the queue currently using this Thread.
void SetSP(const lldb::ProcessSP &process_sp)
@ eStopReasonThreadExiting
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.
lldb::StopReason GetStopReason()
BreakpointSiteList & GetBreakpointSiteList()
ThreadList & GetThreadList()
void StepInstruction(bool step_over)
Target & GetTarget()
Get the target object pointer for this module.
std::string GetStopDescription()
Status UnwindInnermostExpression()
Unwinds the thread stack for the innermost expression plan currently on the thread plan stack.
StopReason
Thread stop reasons.
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
SBThreadCollection GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type)
#define LLDB_INSTRUMENT()
SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line)
lldb::SBFrame GetSelectedFrame()
ProcessRunLock & GetRunLock()
lldb::StopReason GetStopReason()
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
lldb::StateType GetResumeState() const
Gets the USER resume state for this thread.
virtual lldb::QueueSP GetQueue()
Retrieve the Queue for this thread, if any.
StructuredDataImplUP m_impl_up
lldb::StateType GetState() const
bool SetIsControllingPlan(bool value)
static bool EventIsThreadEvent(const SBEvent &event)
virtual const char * GetName()
SBError ResumeNewPlan(lldb_private::ExecutionContext &exe_ctx, lldb_private::ThreadPlan *new_plan)
static llvm::raw_ostream & error(Stream &strm)
bool Success() const
Test for success condition.
bool SetSelectedThreadByID(lldb::tid_t tid, bool notify=false)
SBError ReturnFromFrame(SBFrame &frame, SBValue &return_value)
@ eStopReasonProcessorTrace
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
Status ReturnFromFrame(lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
bool TryLock(ProcessRunLock *lock)
bool Fail() const
Test for error condition.
std::shared_ptr< Object > ObjectSP
Function * function
The Function for a given query.
void StepOver(lldb::RunMode stop_other_threads=lldb::eOnlyDuringStepping)
@ eStopReasonInstrumentation
uint32_t GetSize() const
Get accessor for a symbol context list size.
lldb_private::Thread * get()
void SetErrorString(const char *err_str)
bool Suspend()
LLDB currently supports process centric debugging which means when any thread in a process stops,...
const lldb_private::FileSpec & ref() 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.
lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID)
Returns a shared pointer to the breakpoint site with id breakID.
static const char * GetBroadcasterClassName()
virtual uint32_t GetStackFrameCount()
StructuredData::ObjectSP GetExtendedInfo()
Retrieve a dictionary of information about this thread.
size_t GetStopDescription(char *dst, size_t dst_len)
Status ResumeSynchronous(Stream *stream)
string(SUBSTRING ${p} 10 -1 pStripped) if($
uint32_t SetSelectedFrame(lldb_private::StackFrame *frame, bool broadcast=false)
#define LLDB_INVALID_QUEUE_ID
void SetError(uint32_t err, lldb::ErrorType type)
bool HasThreadScope() const
Returns true the ExecutionContext object contains a valid target, process, and thread.
lldb::user_id_t GetID() const
Get accessor for the user ID.
#define LLDB_INVALID_LINE_NUMBER
#define LLDB_INVALID_BREAK_ID
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)
ThreadList & GetExtendedThreadList()
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
lldb::SBProcess GetProcess()
lldb::StopInfoSP GetStopInfo()
bool operator!=(const lldb::SBThread &rhs) const
@ eStopReasonExec
Program was re-exec'ed.
void RunToAddress(lldb::addr_t addr)
virtual SystemRuntime * GetSystemRuntime()
Get the system runtime plug-in for this process.
static SBFrame GetStackFrameFromEvent(const SBEvent &event)
@ eStopReasonPlanComplete
SBError UnwindInnermostExpression()
void StepInto(lldb::RunMode stop_other_threads=lldb::eOnlyDuringStepping)
bool GetStatus(lldb::SBStream &status) const
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
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::ThreadSP GetExtendedBacktraceThread(lldb::ThreadSP thread, ConstString type)
Return a Thread which shows the origin of this thread's creation.
lldb::StackFrameSP GetSelectedFrame()
AddressRange range
The section offset address range for this line entry.
void ResolveSymbolContext(const SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list)
Resolve symbol contexts by file and line.
uint32_t GetExtendedBacktraceOriginatingIndexID()
@ eStructuredDataTypeInteger
const lldb::SBThread & operator=(const lldb::SBThread &rhs)
@ eStructuredDataTypeFloat
#define LLDB_INVALID_ADDRESS
SBValue GetStopReturnValue()
lldb::SBFrame GetFrameAtIndex(uint32_t idx)
void SetQueue(const lldb::QueueSP &queue_sp)
lldb::ValueObjectSP GetSP() const
Same as the protected version of GetSP that takes a locker, except that we make the locker locally in...
lldb_private::Status & ref()
A class that represents a running process on the host machine.
uint64_t GetStopReasonDataAtIndex(uint32_t idx)
Get information associated with a stop reason.
lldb::ExecutionContextRefSP m_opaque_sp
bool GetInfoItemByPathAsString(const char *path, SBStream &strm)
SBError StepOverUntil(lldb::SBFrame &frame, lldb::SBFileSpec &file_spec, uint32_t line)
#define LLDB_INSTRUMENT_VA(...)
virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status)
const char * GetQueueName() const
Status Resume()
Resumes all of a process's threads as configured using the Thread run control functions.
void AddThread(const lldb::ThreadSP &thread_sp)
#define LLDB_INVALID_INDEX32
#define LLDB_INVALID_THREAD_ID
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
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.
lldb::tid_t GetThreadID() const
LineEntry line_entry
The LineEntry for a given query.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
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'...
@ eStructuredDataTypeNull
const char * GetName() const
bool GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, Status &error)
@ eStateRunning
Process or thread is running and can't be examined.
Execution context objects refer to objects in the execution of the program that is being debugged.
uint32_t GetIndexID() const
void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, bool stop_format)
Target * GetTargetPtr() const
Returns a pointer to the target object.
SBThread GetExtendedBacktraceThread(const char *type)
lldb::SBQueue GetQueue() const
virtual const char * GetQueueName()
Retrieve the Queue name for the queue currently using this Thread.
InstrumentationRuntimeType
bool SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast=false)
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream)