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();
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;
369 return SBValue(return_valobj_sp);
381 return thread_sp->GetID();
390 return thread_sp->GetIndexID();
397 std::unique_lock<std::recursive_mutex> lock;
413 std::unique_lock<std::recursive_mutex> lock;
430 std::unique_lock<std::recursive_mutex> lock;
446 bool success =
false;
447 std::unique_lock<std::recursive_mutex> lock;
457 info_root_sp->GetObjectForDotSeparatedPath(path);
460 strm.Printf(
"%s", node->GetAsString()->GetValue().str().c_str());
464 strm.Printf(
"0x%" PRIx64, node->GetUnsignedIntegerValue());
468 strm.Printf(
"0x%f", node->GetAsFloat()->GetValue());
472 if (node->GetAsBoolean()->GetValue())
475 strm.Printf(
"false");
508 if (new_plan !=
nullptr) {
534 std::unique_lock<std::recursive_mutex> lock;
538 error.SetErrorString(
"this SBThread object is invalid");
543 bool abort_other_plans =
false;
547 ThreadPlanSP new_plan_sp;
549 if (frame_sp->HasDebugInformation()) {
551 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
553 abort_other_plans, sc.
line_entry, sc, stop_other_threads,
554 new_plan_status, avoid_no_debug);
557 true, abort_other_plans, stop_other_threads, new_plan_status);
566 StepInto(
nullptr, stop_other_threads);
581 std::unique_lock<std::recursive_mutex> lock;
585 error.SetErrorString(
"this SBThread object is invalid");
589 bool abort_other_plans =
false;
593 ThreadPlanSP new_plan_sp;
596 if (frame_sp && frame_sp->HasDebugInformation()) {
597 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
606 const LazyBool step_out_avoids_code_without_debug_info =
608 const LazyBool step_in_avoids_code_without_debug_info =
611 abort_other_plans, range, sc, target_name, stop_other_threads,
612 new_plan_status, step_in_avoids_code_without_debug_info,
613 step_out_avoids_code_without_debug_info);
616 false, abort_other_plans, stop_other_threads, new_plan_status);
635 std::unique_lock<std::recursive_mutex> lock;
639 error.SetErrorString(
"this SBThread object is invalid");
643 bool abort_other_plans =
false;
644 bool stop_other_threads =
false;
651 abort_other_plans,
nullptr,
false, stop_other_threads,
eVoteYes,
670 std::unique_lock<std::recursive_mutex> lock;
674 error.SetErrorString(
"passed invalid SBFrame object");
681 error.SetErrorString(
"this SBThread object is invalid");
685 bool abort_other_plans =
false;
686 bool stop_other_threads =
false;
689 error.SetErrorString(
"passed a frame from another thread");
695 abort_other_plans,
nullptr,
false, stop_other_threads,
eVoteYes,
714 std::unique_lock<std::recursive_mutex> lock;
718 error.SetErrorString(
"this SBThread object is invalid");
725 step_over,
true,
true, new_plan_status));
743 std::unique_lock<std::recursive_mutex> lock;
747 error.SetErrorString(
"this SBThread object is invalid");
751 bool abort_other_plans =
false;
752 bool stop_other_threads =
true;
760 abort_other_plans, target_addr, stop_other_threads, new_plan_status));
775 std::unique_lock<std::recursive_mutex> lock;
806 frame_sc = frame_sp->GetSymbolContext(
807 eSymbolContextCompUnit | eSymbolContextFunction |
808 eSymbolContextLineEntry | eSymbolContextSymbol);
811 sb_error.SetErrorStringWithFormat(
812 "frame %u doesn't have debug information", frame_sp->GetFrameIndex());
819 step_file_spec = sb_file_spec.
ref();
824 sb_error.
SetErrorString(
"invalid file argument or no file for frame");
834 bool all_in_function =
true;
837 std::vector<addr_t> step_over_until_addrs;
838 const bool abort_other_plans =
false;
839 const bool stop_other_threads =
false;
842 step_file_spec, line, std::nullopt,
true,
847 eSymbolContextLineEntry, sc_list);
850 sc.line_entry.range.GetBaseAddress().GetLoadAddress(target);
853 step_over_until_addrs.push_back(step_addr);
855 all_in_function =
false;
859 if (step_over_until_addrs.empty()) {
860 if (all_in_function) {
861 step_file_spec.
GetPath(path,
sizeof(path));
862 sb_error.SetErrorStringWithFormat(
"No line entries for %s:%u", path,
865 sb_error.
SetErrorString(
"step until target not in current function");
869 abort_other_plans, &step_over_until_addrs[0],
870 step_over_until_addrs.size(), stop_other_threads,
871 frame_sp->GetFrameIndex(), new_plan_status));
891 bool resume_immediately) {
901 bool resume_immediately) {
906 std::unique_lock<std::recursive_mutex> lock;
910 error.SetErrorString(
"this SBThread object is invalid");
919 false, script_class_name, obj_sp,
false, new_plan_status);
921 if (new_plan_status.
Fail()) {
926 if (!resume_immediately)
942 std::unique_lock<std::recursive_mutex> lock;
962 std::unique_lock<std::recursive_mutex> lock;
979 std::unique_lock<std::recursive_mutex> lock;
1002 std::unique_lock<std::recursive_mutex> lock;
1005 bool result =
false;
1012 error.SetErrorString(
"process is running");
1015 error.SetErrorString(
"this SBThread object is invalid");
1029 std::unique_lock<std::recursive_mutex> lock;
1032 bool result =
false;
1036 const bool override_suspend =
true;
1040 error.SetErrorString(
"process is running");
1043 error.SetErrorString(
"this SBThread object is invalid");
1050 std::unique_lock<std::recursive_mutex> lock;
1061 std::unique_lock<std::recursive_mutex> lock;
1073 std::unique_lock<std::recursive_mutex> lock;
1089 std::unique_lock<std::recursive_mutex> lock;
1106 StackFrameSP frame_sp;
1107 std::unique_lock<std::recursive_mutex> lock;
1125 StackFrameSP frame_sp;
1126 std::unique_lock<std::recursive_mutex> lock;
1145 StackFrameSP frame_sp;
1146 std::unique_lock<std::recursive_mutex> lock;
1201 std::unique_lock<std::recursive_mutex> lock;
1223 std::unique_lock<std::recursive_mutex> lock;
1241 std::unique_lock<std::recursive_mutex> lock;
1255 ThreadSP new_thread_sp(
1257 if (new_thread_sp) {
1261 sb_origin_thread.
SetThread(new_thread_sp);
1269 return sb_origin_thread;
1277 return thread_sp->GetExtendedBacktraceOriginatingIndexID();
1288 return SBValue(thread_sp->GetCurrentException());
1298 return SBThread(thread_sp->GetCurrentExceptionBacktrace());
1306 return thread_sp->SafeToCallFunctions();
1324 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)
SBThreadCollection GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type)
SBValue GetCurrentException()
void SetThread(const lldb::ThreadSP &lldb_object_sp)
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.
lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID)
Returns a shared pointer to the breakpoint site with id breakID.
void ResolveSymbolContext(const SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list)
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.
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()
BreakpointSiteList & GetBreakpointSiteList()
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)
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)
static ConstString & GetStaticBroadcasterClass()
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()
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)
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()
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)
virtual uint32_t GetStackFrameCount()
#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)
@ 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.
InstrumentationRuntimeType
StopReason
Thread stop reasons.
@ eStopReasonInstrumentation
@ eStopReasonPlanComplete
@ eStopReasonExec
Program was re-exec'ed.
@ eStopReasonProcessorTrace
@ eStopReasonThreadExiting
@ eStructuredDataTypeFloat
@ eStructuredDataTypeInteger
@ eStructuredDataTypeNull
@ eStructuredDataTypeBoolean
@ eStructuredDataTypeString
bool IsValid() const
Check if a line entry object is valid.
FileSpec file
The source file, possibly mapped by the target.source-map setting.
AddressRange range
The section offset address range for this line entry.
lldb::user_id_t GetID() const
Get accessor for the user ID.