Go to the documentation of this file.
65 return *g_settings_ptr;
68 #define LLDB_PROPERTIES_thread
69 #include "TargetProperties.inc"
72 #define LLDB_PROPERTIES_thread
73 #include "TargetPropertiesEnum.inc"
77 :
public Cloneable<ThreadOptionValueProperties, OptionValueProperties> {
93 if (
this != instance_properties)
97 return ProtectedGetPropertyAtIndex(idx);
101 ThreadProperties::ThreadProperties(
bool is_global) :
Properties() {
104 std::make_shared<ThreadOptionValueProperties>(
ConstString(
"thread"));
114 const uint32_t idx = ePropertyStepAvoidRegex;
115 return m_collection_sp->GetPropertyAtIndexAsOptionValueRegex(
nullptr, idx);
119 const uint32_t idx = ePropertyStepAvoidLibraries;
123 assert(option_value);
128 const uint32_t idx = ePropertyEnableThreadTrace;
130 nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
134 const uint32_t idx = ePropertyStepInAvoidsNoDebug;
136 nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
140 const uint32_t idx = ePropertyStepOutAvoidsNoDebug;
142 nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
146 const uint32_t idx = ePropertyMaxBacktraceDepth;
148 nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
154 static ConstString g_flavor(
"Thread::ThreadEventData");
159 : m_thread_sp(thread_sp), m_stack_id() {}
163 : m_thread_sp(thread_sp), m_stack_id(stack_id) {}
201 StackFrameSP frame_sp;
203 ThreadSP thread_sp = event_data->
GetThread();
205 frame_sp = thread_sp->GetStackFrameList()->GetFrameWithStackID(
221 Broadcaster(process.GetTarget().GetDebugger().GetBroadcasterManager(),
227 : process.GetNextThreadIndexID(tid)),
236 LLDB_LOGF(log,
"%p Thread::Thread(tid = 0x%4.4" PRIx64
")",
237 static_cast<void *
>(
this),
GetID());
244 LLDB_LOGF(log,
"%p Thread::~Thread(tid = 0x%4.4" PRIx64
")",
245 static_cast<void *
>(
this),
GetID());
269 StackFrameSP frame_sp = stack_frame_list_sp->GetFrameAtIndex(
270 stack_frame_list_sp->GetSelectedFrameIndex());
298 const bool broadcast =
true;
303 bool already_shown =
false;
305 frame_sp->GetSymbolContext(eSymbolContextLineEntry));
306 if (
GetProcess()->GetTarget().GetDebugger().GetUseExternalEditor() &&
312 bool show_frame_info =
true;
313 bool show_source = !already_shown;
315 return frame_sp->GetStatus(output_stream, show_frame_info, show_source);
328 GetProcess()->GetWarningsUnsupportedLanguage())) {
332 GetProcess()->PrintWarningUnsupportedLanguage(sc);
352 bool have_valid_completed_plan = completed_plan_sp && completed_plan_sp->PlanSucceeded();
353 bool plan_failed = completed_plan_sp && !completed_plan_sp->PlanSucceeded();
354 bool plan_overrides_trace =
355 have_valid_stop_info && have_valid_completed_plan
358 if (have_valid_stop_info && !plan_overrides_trace && !plan_failed) {
360 }
else if (completed_plan_sp) {
383 const uint32_t process_stop_id = process_sp->GetStopID();
416 process_sp->GetTarget().GetArchitecturePlugin())
417 arch->OverrideStopInfo(*
this);
427 return stop_info_sp->GetStopReason();
462 LLDB_LOGF(log,
"%p: tid = 0x%" PRIx64
": stop info = %s (stop_id = %u)",
463 static_cast<void *
>(
this),
GetID(),
464 stop_info_sp ? stop_info_sp->GetDescription() :
"<NULL>",
493 lldb::RegisterCheckpointSP reg_checkpoint_sp(
495 if (reg_checkpoint_sp) {
496 lldb::RegisterContextSP reg_ctx_sp(frame_sp->GetRegisterContext());
497 if (reg_ctx_sp && reg_ctx_sp->ReadAllRegisterValues(*reg_checkpoint_sp))
520 lldb::RegisterContextSP reg_ctx_sp(frame_sp->GetRegisterContext());
527 reg_ctx_sp->InvalidateIfNeeded(
true);
565 auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
567 if (!recognized_frame_sp)
571 recognized_frame_sp->GetStopDescription();
573 if (!recognized_stop_description.empty())
574 return recognized_stop_description;
582 if (stop_info_sp && stop_info_sp->IsValid()) {
583 raw_stop_description = stop_info_sp->GetDescription();
584 assert((!raw_stop_description.empty() ||
586 "StopInfo returned an empty description.");
588 return raw_stop_description;
597 auto frame_sp = frames_list_sp->GetFrameAtIndex(0);
599 auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
601 if (!recognized_frame_sp) {
602 LLDB_LOG(log,
"Frame #0 not recognized");
606 if (StackFrameSP most_relevant_frame_sp =
607 recognized_frame_sp->GetMostRelevantFrame()) {
608 LLDB_LOG(log,
"Found most relevant frame at index {0}",
609 most_relevant_frame_sp->GetFrameIndex());
612 LLDB_LOG(log,
"No relevant frame!");
638 const addr_t thread_pc = reg_ctx_sp->GetPC();
639 BreakpointSiteSP bp_site_sp =
640 GetProcess()->GetBreakpointSiteList().FindByAddress(thread_pc);
647 bool push_step_over_bp_plan =
false;
652 push_step_over_bp_plan =
true;
654 push_step_over_bp_plan =
true;
656 if (push_step_over_bp_plan) {
658 if (step_bp_plan_sp) {
659 step_bp_plan_sp->SetPrivate(
true);
664 step_bp_plan_sp.get());
685 if (backing_thread_sp)
686 backing_thread_sp->SetTemporaryResumeState(resume_state);
711 bool need_to_resume =
false;
714 need_to_resume = plan_ptr->
WillResume(resume_state,
true);
728 if (need_to_resume) {
734 return need_to_resume;
748 bool should_stop =
true;
754 "Thread::%s for tid = 0x%4.4" PRIx64
" 0x%4.4" PRIx64
755 ", should_stop = 0 (ignore since thread was suspended)",
762 "Thread::%s for tid = 0x%4.4" PRIx64
" 0x%4.4" PRIx64
763 ", should_stop = 0 (ignore since thread was suspended)",
773 "Thread::%s for tid = 0x%4.4" PRIx64
" 0x%4.4" PRIx64
774 ", pc = 0x%16.16" PRIx64
775 ", should_stop = 0 (ignore since no stop reason)",
787 "Thread::%s(%p) for tid = 0x%4.4" PRIx64
" 0x%4.4" PRIx64
788 ", pc = 0x%16.16" PRIx64,
792 LLDB_LOGF(log,
"^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
809 if (private_stop_info &&
810 !private_stop_info->ShouldStopSynchronous(event_ptr)) {
811 LLDB_LOGF(log,
"StopInfo::ShouldStop async callback says we should not "
812 "stop, returning ShouldStop of false.");
831 bool done_processing_current_plan =
false;
835 done_processing_current_plan =
true;
845 should_stop = plan_ptr->
ShouldStop(event_ptr);
864 done_processing_current_plan =
868 if (should_force_run) {
872 done_processing_current_plan =
true;
880 if (!done_processing_current_plan) {
881 bool override_stop =
false;
885 should_stop = current_plan->
ShouldStop(event_ptr);
886 LLDB_LOGF(log,
"Base plan says should stop: %i.", should_stop);
895 should_stop = current_plan->
ShouldStop(event_ptr);
903 override_stop =
true;
904 LLDB_LOGF(log,
"Plan %s auto-continue: true.",
918 if (current_plan ==
nullptr) {
950 "Plan %s being discarded in cleanup, it says it is already done.",
973 LLDB_LOGF(log,
"vvvvvvvv Thread::ShouldStop End (returning %i) vvvvvvvv",
987 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
988 ": returning vote %i (state was suspended or invalid)",
996 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
997 ": returning vote %i (temporary state was suspended or invalid)",
1004 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
1005 ": returning vote %i (thread didn't stop for a reason.)",
1010 if (
GetPlans().AnyCompletedPlans()) {
1014 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
1015 ": returning vote for complete stack's back plan",
1032 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
1033 ": returning vote %i for current plan",
1034 GetID(), thread_vote);
1048 if (
GetPlans().AnyCompletedPlans()) {
1052 "Current Plan for thread %d(%p) (0x%4.4" PRIx64
1053 ", %s): %s being asked whether we should report run.",
1061 "Current Plan for thread %d(%p) (0x%4.4" PRIx64
1062 ", %s): %s being asked whether we should report run.",
1092 assert(thread_plan_sp &&
"Don't push an empty thread plan.");
1098 LLDB_LOGF(log,
"Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64
".",
1099 static_cast<void *
>(
this), s.
GetData(),
1100 thread_plan_sp->GetThread().GetID());
1110 LLDB_LOGF(log,
"Popping plan: \"%s\", tid = 0x%4.4" PRIx64
".",
1111 popped_plan_sp->GetName(), popped_plan_sp->GetThread().GetID());
1119 LLDB_LOGF(log,
"Discarding plan: \"%s\", tid = 0x%4.4" PRIx64
".",
1120 discarded_plan_sp->GetName(),
1121 discarded_plan_sp->GetThread().GetID());
1173 bool abort_other_plans) {
1176 if (!thread_plan_sp->ValidatePlan(&s)) {
1178 thread_plan_sp.reset();
1183 if (abort_other_plans)
1192 if (!thread_plan_sp->ValidatePlan(&s)) {
1194 thread_plan_sp.reset();
1207 if (up_to_plan_ptr ==
nullptr)
1221 "Discarding thread plans for thread tid = 0x%4.4" PRIx64
1223 GetID(),
static_cast<void *
>(up_to_plan_ptr));
1231 "Discarding thread plans for thread (tid = 0x%4.4" PRIx64
1246 if (!innermost_expr_plan) {
1247 error.SetErrorString(
"No expressions currently active on this thread");
1257 return thread_plan_sp;
1261 bool step_over,
bool abort_other_plans,
bool stop_other_threads,
1266 return thread_plan_sp;
1272 Status &status,
LazyBool step_out_avoids_code_withoug_debug_info) {
1273 ThreadPlanSP thread_plan_sp;
1274 thread_plan_sp = std::make_shared<ThreadPlanStepOverRange>(
1275 *
this, range, addr_context, stop_other_threads,
1276 step_out_avoids_code_withoug_debug_info);
1279 return thread_plan_sp;
1285 bool abort_other_plans,
const LineEntry &line_entry,
1287 Status &status,
LazyBool step_out_avoids_code_withoug_debug_info) {
1288 const bool include_inlined_functions =
true;
1289 auto address_range =
1292 abort_other_plans, address_range, addr_context, stop_other_threads,
1293 status, step_out_avoids_code_withoug_debug_info);
1298 const SymbolContext &addr_context,
const char *step_in_target,
1300 LazyBool step_in_avoids_code_without_debug_info,
1301 LazyBool step_out_avoids_code_without_debug_info) {
1303 *
this, range, addr_context, step_in_target, stop_other_threads,
1304 step_in_avoids_code_without_debug_info,
1305 step_out_avoids_code_without_debug_info));
1307 return thread_plan_sp;
1312 bool abort_other_plans,
const LineEntry &line_entry,
1313 const SymbolContext &addr_context,
const char *step_in_target,
1315 LazyBool step_in_avoids_code_without_debug_info,
1316 LazyBool step_out_avoids_code_without_debug_info) {
1317 const bool include_inlined_functions =
false;
1321 addr_context, step_in_target, stop_other_threads, status,
1322 step_in_avoids_code_without_debug_info,
1323 step_out_avoids_code_without_debug_info);
1327 bool abort_other_plans,
SymbolContext *addr_context,
bool first_insn,
1328 bool stop_other_threads,
Vote report_stop_vote,
Vote report_run_vote,
1330 LazyBool step_out_avoids_code_without_debug_info) {
1332 *
this, addr_context, first_insn, stop_other_threads, report_stop_vote,
1333 report_run_vote, frame_idx, step_out_avoids_code_without_debug_info));
1336 return thread_plan_sp;
1340 bool abort_other_plans,
SymbolContext *addr_context,
bool first_insn,
1341 bool stop_other_threads,
Vote report_stop_vote,
Vote report_run_vote,
1342 uint32_t frame_idx,
Status &status,
bool continue_to_next_branch) {
1343 const bool calculate_return_value =
1346 *
this, addr_context, first_insn, stop_other_threads, report_stop_vote,
1347 report_run_vote, frame_idx,
eLazyBoolNo, continue_to_next_branch,
1348 calculate_return_value));
1355 return thread_plan_sp;
1359 bool abort_other_plans,
1360 bool stop_other_threads,
1362 ThreadPlanSP thread_plan_sp(
1364 if (!thread_plan_sp || !thread_plan_sp->ValidatePlan(
nullptr))
1365 return ThreadPlanSP();
1368 return thread_plan_sp;
1373 bool stop_other_threads,
1375 ThreadPlanSP thread_plan_sp(
1379 return thread_plan_sp;
1383 bool abort_other_plans,
lldb::addr_t *address_list,
size_t num_addresses,
1386 *
this, address_list, num_addresses, stop_other_threads, frame_idx));
1389 return thread_plan_sp;
1393 bool abort_other_plans,
const char *class_name,
1399 thread_plan_sp->SetStopOthers(stop_other_threads);
1401 return thread_plan_sp;
1410 target_sp = process_sp->CalculateTarget();
1457 lldb::ValueObjectSP return_value_sp,
1464 "Could not find frame with index %d in thread 0x%" PRIx64
".",
1465 frame_idx,
GetID());
1472 lldb::ValueObjectSP return_value_sp,
1478 return return_error;
1481 Thread *thread = frame_sp->GetThread().get();
1482 uint32_t older_frame_idx = frame_sp->GetFrameIndex() + 1;
1484 if (!older_frame_sp) {
1486 return return_error;
1489 if (return_value_sp) {
1490 lldb::ABISP abi = thread->
GetProcess()->GetABI();
1492 return_error.
SetErrorString(
"Could not find ABI to set return value.");
1493 return return_error;
1495 SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction);
1500 if ( (
false) && sc.
function !=
nullptr) {
1502 if (function_type) {
1508 ValueObjectSP cast_value_sp = return_value_sp->Cast(return_type);
1509 if (cast_value_sp) {
1511 return_value_sp = cast_value_sp;
1517 return_error = abi->SetReturnValueObject(older_frame_sp, return_value_sp);
1519 return return_error;
1527 if (youngest_frame_sp) {
1528 lldb::RegisterContextSP reg_ctx_sp(youngest_frame_sp->GetRegisterContext());
1530 bool copy_success = reg_ctx_sp->CopyFromRegisterContext(
1531 older_frame_sp->GetRegisterContext());
1547 return return_error;
1552 for (
size_t n = 0; n <
list.size(); n++) {
1570 std::vector<Address> candidates, within_function, outside_function;
1572 within_function, outside_function);
1579 if (!within_function.empty())
1580 candidates = within_function;
1581 else if (outside_function.size() == 1 && can_leave_function)
1582 candidates = outside_function;
1585 if (candidates.empty()) {
1586 if (outside_function.empty()) {
1587 return Status(
"Cannot locate an address for %s:%i.",
1589 }
else if (outside_function.size() == 1) {
1590 return Status(
"%s:%i is outside the current function.",
1595 return Status(
"%s:%i has multiple candidate locations:\n%s",
1602 if (warnings && candidates.size() > 1) {
1604 sstr.
Printf(
"%s:%i appears multiple times in this function, selecting the "
1605 "first location:\n",
1611 if (!reg_ctx->
SetPC(dest))
1612 return Status(
"Cannot change PC to target address.");
1621 if (process ==
nullptr)
1624 StackFrameSP frame_sp;
1630 frame_sc = frame_sp->GetSymbolContext(eSymbolContextEverything);
1640 assert(thread_format);
1643 &exe_ctx,
nullptr,
nullptr,
false,
false);
1693 return "breakpoint";
1695 return "watchpoint";
1707 return "vfork done";
1709 return "plan complete";
1711 return "thread exiting";
1713 return "instrumentation break";
1715 return "processor trace";
1718 return "StopReason = " + std::to_string(reason);
1724 return "only this thread";
1726 return "all threads";
1728 return "only during stepping";
1731 return "RunMode = " + std::to_string(mode);
1736 bool stop_format,
bool only_stacks) {
1743 bool is_selected =
false;
1748 strm.
Printf(
"%c ", is_selected ?
'*' :
' ');
1753 frame_sp->GetSymbolContext(eSymbolContextLineEntry));
1764 size_t num_frames_shown = 0;
1765 if (num_frames > 0) {
1768 const bool show_frame_info =
true;
1769 const bool show_frame_unique = only_stacks;
1770 const char *selected_frame_marker =
nullptr;
1771 if (num_frames == 1 || only_stacks ||
1775 selected_frame_marker =
"* ";
1778 strm, start_frame, num_frames, show_frame_info, num_frames_with_source,
1779 show_frame_unique, selected_frame_marker);
1780 if (num_frames == 1)
1784 return num_frames_shown;
1788 bool print_json_thread,
bool print_json_stopinfo) {
1789 const bool stop_format =
false;
1795 if (print_json_thread || print_json_stopinfo) {
1796 if (thread_info && print_json_thread) {
1797 thread_info->Dump(strm);
1804 stop_info->Dump(strm);
1814 thread_info->GetObjectForDotSeparatedPath(
"activity");
1816 thread_info->GetObjectForDotSeparatedPath(
"breadcrumb");
1818 thread_info->GetObjectForDotSeparatedPath(
"trace_messages");
1820 bool printed_activity =
false;
1827 strm.
Format(
" Activity '{0}', {1:x}\n",
1828 name->GetAsString()->GetValue(),
1829 id->GetAsInteger()->GetValue());
1831 printed_activity =
true;
1833 bool printed_breadcrumb =
false;
1835 if (printed_activity)
1841 if (breadcrumb_text &&
1843 strm.
Format(
" Current Breadcrumb: {0}\n",
1844 breadcrumb_text->GetAsString()->GetValue());
1846 printed_breadcrumb =
true;
1849 if (printed_breadcrumb)
1852 const size_t msg_count = messages_array->
GetSize();
1853 if (msg_count > 0) {
1854 strm.
Printf(
" %zu trace messages:\n", msg_count);
1855 for (
size_t i = 0; i < msg_count; i++) {
1864 strm.
Format(
" {0}\n", message_text->GetAsString()->GetValue());
1876 uint32_t num_frames,
bool show_frame_info,
1879 strm, first_frame, num_frames, show_frame_info, num_frames_with_source);
1904 BreakpointSiteSP bp_site_sp =
1905 GetProcess()->GetBreakpointSiteList().FindByAddress(
pc);
1906 if (bp_site_sp &&
static_cast<break_id_t>(value) == bp_site_sp->GetID())
1915 LazyBool step_in_avoids_code_without_debug_info,
1916 LazyBool step_out_avoids_code_without_debug_info)
1923 ThreadPlanSP new_plan_sp;
1925 const bool abort_other_plans =
false;
1927 if (source_step && frame_sp && frame_sp->HasDebugInformation()) {
1928 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
1931 step_in_avoids_code_without_debug_info,
1932 step_out_avoids_code_without_debug_info);
1935 false, abort_other_plans, run_mode,
error);
1938 new_plan_sp->SetIsControllingPlan(
true);
1939 new_plan_sp->SetOkayToDiscard(
false);
1945 error.SetErrorString(
"process not stopped");
1951 LazyBool step_out_avoids_code_without_debug_info) {
1956 ThreadPlanSP new_plan_sp;
1959 const bool abort_other_plans =
false;
1961 if (source_step && frame_sp && frame_sp->HasDebugInformation()) {
1962 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
1965 step_out_avoids_code_without_debug_info);
1968 true, abort_other_plans, run_mode,
error);
1971 new_plan_sp->SetIsControllingPlan(
true);
1972 new_plan_sp->SetOkayToDiscard(
false);
1978 error.SetErrorString(
"process not stopped");
1987 const bool first_instruction =
false;
1988 const bool stop_other_threads =
false;
1989 const bool abort_other_plans =
false;
1992 abort_other_plans,
nullptr, first_instruction, stop_other_threads,
1995 new_plan_sp->SetIsControllingPlan(
true);
1996 new_plan_sp->SetOkayToDiscard(
false);
2002 error.SetErrorString(
"process not stopped");
2009 if (
auto recognized_frame = frame_sp->GetRecognizedFrame())
2010 if (
auto e = recognized_frame->GetExceptionObject())
2016 if (
auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
2020 return ValueObjectSP();
2031 if (
auto bt = runtime->GetBacktraceThreadFromException(exception))
2041 Target &target = process_sp->GetTarget();
2043 assert(platform_sp);
2050 std::optional<uint64_t> type_size = type.
GetByteSize(
nullptr);
2052 llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>> data =
2057 DataExtractor data_extractor{data.get()->getBufferStart(), data.get()->getBufferSize(),
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.
lldb::StackFrameSP GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr)
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void Format(const char *format, Args &&... args)
MATCHES FreeBSD list(APPEND FBSDKERNEL_LIBS kvm) endif() if(NOT FBSDKERNEL_LIBS) message(STATUS "Skipping FreeBSDKernel plugin due to missing libfbsdvmcore") return() endif() add_lldb_library(lldbPluginProcessFreeBSDKernel PLUGIN ProcessFreeBSDKernel.cpp RegisterContextFreeBSDKernel_arm64.cpp RegisterContextFreeBSDKernel_i386.cpp RegisterContextFreeBSDKernel_x86_64.cpp ThreadFreeBSDKernel.cpp LINK_LIBS lldbCore lldbTarget $
void CheckInWithManager()
void DiscardThreadPlans(bool force)
Discards the plans queued on the plan stack of the current thread.
std::recursive_mutex m_state_mutex
Multithreaded protection for m_state.
@ DumpStyleSectionNameOffset
Display as the section name + offset.
virtual lldb::StopInfoSP GetPrivateStopInfo(bool calculate=true)
FileSpec file
The source file, possibly mapped by the target.source-map setting.
virtual lldb::OptionValuePropertiesSP GetValueProperties() const
uint32_t GetCurrentInlinedDepth()
size_t GetStackFrameStatus(Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, uint32_t num_frames_with_source)
bool StopInfoIsUpToDate() const
virtual ConstString GetFlavor() const =0
@ eBroadcastBitStackChanged
virtual bool ShouldRunBeforePublicStop()
void AutoCompleteThreadPlans(CompletionRequest &request) const
Format the thread plan information for auto completion.
lldb::StopInfoSP stop_info_sp
bool GetTraceEnabledState() const
uint32_t GetIndexID() const
bool GetDescription(Stream &s, lldb::DescriptionLevel level, bool print_json_thread, bool print_json_stopinfo)
lldb::ThreadPlanSP GetCompletedPlan(bool skip_private=true) const
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
ObjectSP GetValueForKey(llvm::StringRef key) const
int m_resume_signal
The signal that should be used when continuing this thread.
Process * GetProcessPtr() const
Returns a pointer to the process object.
lldb::RegisterCheckpointSP register_backup_sp
virtual Unwind & GetUnwinder()
virtual llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > GetSiginfo(size_t max_size) const
@ eStructuredDataTypeString
lldb::ThreadPlanSP GetCurrentPlan() const
@ eStructuredDataTypeDictionary
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
virtual void ClearStackFrames()
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.
static StackID GetStackIDFromEvent(const Event *event_ptr)
Status JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings=nullptr)
@ eKindStepOverBreakpoint
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.
@ eStopReasonThreadExiting
#define LLDB_LOGF(log,...)
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.
ThreadPlanKind GetKind() const
lldb::ThreadPlanSP DiscardPlan()
void RestoreCompletedPlanCheckpoint(size_t checkpoint)
lldb::TargetSP CalculateTarget() override
ThreadList & GetThreadList()
static lldb::StopInfoSP CreateStopReasonWithSignal(Thread &thread, int signo, const char *description=nullptr)
std::string GetStopDescription()
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
bool IsPlanDone(ThreadPlan *plan) const
Status UnwindInnermostExpression()
Unwinds the thread stack for the innermost expression plan currently on the thread plan stack.
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 ThreadPassesBasicTests(Thread &thread) const
StopReason
Thread stop reasons.
ThreadPlan * GetPreviousPlan(ThreadPlan *plan) const
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
AddressRange GetSameLineContiguousAddressRange(bool include_inlined_functions) const
Give the range for this LineEntry + any additional LineEntries for this same source line that are con...
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
lldb::ThreadPlanSP GetPlanByIndex(uint32_t plan_idx, bool skip_private=true) const
const ConstString & GetFilename() const
Filename string const get accessor.
void SelectMostRelevantFrame()
ThreadPlanStack & GetPlans() const
void Dump(Stream *s) const override
ThreadPlan * GetCurrentPlan() const
Gets the plan which will execute next on the plan stack.
std::unique_ptr< ThreadPlanStack > m_null_plan_stack_up
virtual bool ShouldStop(Event *event_ptr)=0
llvm::Triple & GetTriple()
Architecture triple accessor.
void RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state)
virtual bool RestoreRegisterStateFromCheckpoint(ThreadStateCheckpoint &saved_state)
Status ReturnFromFrameWithIndex(uint32_t frame_idx, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
bool CompletedPlanOverridesBreakpoint() const
Check if we have completed plan to override breakpoint stop reason.
bool GetUseExternalEditor() const
lldb::StopReason GetStopReason()
lldb::StackFrameListSP m_curr_frames_sp
The stack frames that get lazily populated after a thread stops.
void PushPlan(lldb::ThreadPlanSP new_plan_sp)
bool HasDebugInformation()
Determine whether this StackFrame has debug information available or not.
bool ShouldStop(Event *event_ptr)
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
virtual lldb::user_id_t GetProtocolID() const
lldb::StateType GetResumeState() const
Gets the USER resume state for this thread.
lldb::ValueObjectSP GetReturnValueObject() const
virtual bool SafeToCallFunctions()
Check whether this thread is safe to run functions.
const ModuleList & GetImages() const
Get accessor for the images for this process.
static std::string RunModeAsString(lldb::RunMode mode)
llvm::StringRef GetString() const
lldb::StateType GetState()
Get accessor for the current process state.
void FrameSelectedCallback(lldb_private::StackFrame *frame)
void ClearShouldStopHereCallbacks()
lldb::StateType GetState() const
~ThreadEventData() override
lldb::ThreadPlanSP GetCompletedPlan() const
Gets the outer-most plan that was popped off the plan stack in the most recent stop.
virtual const char * GetName()
virtual bool CheckpointThreadState(ThreadStateCheckpoint &saved_state)
bool IsThreadPlanDone(ThreadPlan *plan) const
Checks whether the given plan is in the completed plans for this stop.
virtual bool CalculateStopInfo()=0
void BroadcastSelectedFrameChange(StackID &new_frame_id)
lldb::addr_t GetBreakpointLoadAddress() const
@ eStateStopped
Process or thread is stopped and can be examined.
static void SettingsTerminate()
#define LLDB_INVALID_FRAME_ID
lldb::PlatformSP GetPlatform()
lldb::ProcessSP GetProcess() const
void SetTemporaryResumeState(lldb::StateType new_state)
static lldb::ThreadSP GetThreadFromEvent(const Event *event_ptr)
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 void DestroyThread()
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INVALID_SIGNAL_NUMBER
bool Success() const
Test for success condition.
virtual bool SafeToCallFunctionsOnThisThread(lldb::ThreadSP thread_sp)
Determine whether it is safe to run an expression on a given thread.
bool SetSelectedThreadByID(lldb::tid_t tid, bool notify=false)
bool GetStepInAvoidsNoDebug() const
lldb::ProcessSP CalculateProcess() override
RegisterContext * GetRegisterContext() const
@ eStopReasonProcessorTrace
virtual bool WillStop()=0
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
static void DumpAddressList(Stream &s, const std::vector< Address > &list, ExecutionContextScope *exe_scope)
lldb::StateType m_state
The state of our process.
virtual bool ShouldAutoContinue(Event *event_ptr)
Returns whether this thread plan overrides the ShouldStop of subsequently processed plans.
size_t CheckpointCompletedPlans()
Status ReturnFromFrame(lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast=false)
static lldb::StackFrameSP GetStackFrameFromEvent(const Event *event_ptr)
virtual bool MischiefManaged()
ThreadPlan * GetPreviousPlan(ThreadPlan *current_plan) const
const FormatEntity::Entry * GetThreadFormat() const
std::shared_ptr< Object > ObjectSP
const char * GetData() const
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
Function * function
The Function for a given query.
lldb::ExpressionVariableSP GetExpressionVariable() const
Gets the outer-most expression variable from the completed plans.
@ eStopReasonInstrumentation
ThreadPlan * GetInnermostExpression() const
static bool GetRestartedFromEvent(const Event *event_ptr)
static ConstString GetFlavorString()
lldb::StackFrameListSP m_prev_frames_sp
The previous stack frames from the last time this thread stopped.
lldb::StateType GetTemporaryResumeState() const
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 SetContext(const lldb::TargetSP &target_sp, bool get_process)
virtual Status StepOut(uint32_t frame_idx=0)
Default implementation for stepping out.
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp)
void SetStopInfoToNothing()
const Property * GetPropertyAtIndex(const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const override
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.
ThreadOptionValueProperties(ConstString name)
virtual lldb::ThreadSP GetBackingThread() const
lldb::ThreadSP GetCurrentExceptionBacktrace()
const RegularExpression * GetSymbolsToAvoidRegexp()
The regular expression returned determines symbols that this thread won't stop in during "step-in" op...
uint32_t m_stop_info_override_stop_id
lldb::ValueObjectSP GetCurrentException()
bool PlanExplainsStop(Event *event_ptr)
Vote ShouldReportStop(Event *event_ptr)
StructuredData::ObjectSP GetExtendedInfo()
Retrieve a dictionary of information about this thread.
uint64_t GetMaxBacktraceDepth() const
void CalculatePublicStopInfo()
bool EventTypeHasListeners(uint32_t event_type)
bool ShouldResume(lldb::StateType resume_state)
static lldb::StopInfoSP CreateStopReasonWithPlan(lldb::ThreadPlanSP &plan, lldb::ValueObjectSP return_valobj_sp, lldb::ExpressionVariableSP expression_variable_sp)
void SetState(lldb::StateType state)
string(SUBSTRING ${p} 10 -1 pStripped) if($
std::unique_ptr< lldb_private::Unwind > m_unwinder_up
It gets set in Thread::ShouldResume.
virtual void WillResume(lldb::StateType resume_state)
uint32_t SetSelectedFrame(lldb_private::StackFrame *frame, bool broadcast=false)
bool GetStepOutAvoidsNoDebug() const
uint32_t current_inlined_depth
uint32_t m_stop_info_stop_id
@ eStateUnloaded
Process is object is valid, but not currently loaded.
bool m_should_run_before_public_stop
CompilerType GetFunctionReturnType() const
virtual lldb::addr_t GetThreadPointer()
Retrieves the per-thread data area.
virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr)
Retrieves the per-module TLS block for a given thread.
bool SetSelectedFrameByIndexNoisily(uint32_t frame_idx, Stream &output_stream)
virtual bool OkayToDiscard()
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
virtual lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx)
uint32_t line
The source line number, or zero if there is no line number information.
lldb::user_id_t GetID() const
Get accessor for the user ID.
lldb::ThreadSP GetThread() const
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
lldb::StopInfoSP m_stop_info_sp
The private stop reason for this thread.
static void SettingsInitialize()
lldb::ThreadPlanSP QueueBasePlan(bool abort_other_plans)
Queues the base plan for a thread.
lldb::ThreadSP CalculateThread() override
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 bool IsStillAtLastBreakpointHit()
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
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.
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
const ArchSpec & GetArchitecture() const
Property * ProtectedGetPropertyAtIndex(uint32_t idx)
lldb::StopInfoSP GetStopInfo()
Vote ShouldReportRun(Event *event_ptr)
lldb::StackFrameListSP GetStackFrameList()
@ eStopReasonExec
Program was re-exec'ed.
lldb::ProcessWP m_process_wp
The process that owns this thread.
void SetShouldRunBeforePublicStop(bool newval)
lldb::RegisterContextSP m_reg_context_sp
The register context for this thread's current register state.
virtual void WillResume(lldb::StateType resume_state)
@ DumpStyleResolvedDescription
Display the details about what an address resolves to.
FileSpecList GetCurrentValue() const
std::recursive_mutex m_frame_mutex
Multithreaded protection for m_state.
void PushPlan(lldb::ThreadPlanSP plan_sp)
message(FATAL_ERROR "invalid libipt include path provided") endif() include_directories($
void IndentMore(unsigned amount=2)
Increment the current indentation level.
static ConstString & GetStaticBroadcasterClass()
virtual SystemRuntime * GetSystemRuntime()
Get the system runtime plug-in for this process.
@ eStopReasonPlanComplete
Dictionary * GetAsDictionary()
Status QueueThreadPlan(lldb::ThreadPlanSP &plan_sp, bool abort_other_plans)
Queues a generic thread plan.
StackID GetStackID() const
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
void SetAutoContinue(bool do_it)
void FindAddressesForLine(const lldb::TargetSP target_sp, const FileSpec &file, uint32_t line, Function *function, std::vector< Address > &output_local, std::vector< Address > &output_extern)
Find addresses by file/line.
lldb::ValueObjectSP GetReturnValueObject() const
Gets the outer-most return value from the completed plans.
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)
lldb::StackFrameSP GetSelectedFrame()
~ThreadProperties() override
@ eStructuredDataTypeInteger
Vote ShouldReportRun(Event *event_ptr)
#define LLDB_INVALID_ADDRESS
bool AnyCompletedPlans() const
virtual bool MatchesSpec(const ThreadSpec *spec)
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
void DiscardPlansUpToPlan(ThreadPlan *up_to_plan_ptr)
bool WasThreadPlanDiscarded(ThreadPlan *plan) const
Checks whether the given plan is in the discarded plans for this stop.
Generic representation of a type in a programming language.
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Type * GetType()
Get accessor for the type that describes the function return value type, and parameter types.
static lldb::OptionValuePropertiesSP CreateLocalCopy(const Properties &global_properties)
virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, lldb::addr_t tls_file_addr)
Retrieves the per-module TLS block for a thread.
const char * GetName() const
Returns the name of this thread plan.
Target & GetTargetRef() const
Returns a reference to the target object.
LazyBool m_override_should_notify
lldb::ThreadPlanSP PopPlan()
virtual bool IsFullyInitialized()
Return whether the dynamic loader is fully initialized and it's safe to call its APIs.
A class that represents a running process on the host machine.
@ eDescriptionLevelVerbose
static bool OpenFileInExternalEditor(const FileSpec &file_spec, uint32_t line_no)
Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id=false)
Constructor.
const FormatEntity::Entry * GetThreadStopFormat() const
bool WillResume(lldb::StateType resume_state, bool current_plan)
bool ThreadStoppedForAReason()
CompilerType GetCompilerType()
size_t m_completed_plan_checkpoint
static DynamicLoaderDarwinKernelProperties & GetGlobalProperties()
virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status)
@ eStructuredDataTypeArray
virtual Vote ShouldReportStop(Event *event_ptr)
Status Resume()
Resumes all of a process's threads as configured using the Thread run control functions.
void DiscardConsultingControllingPlans()
lldb::ValueObjectSP GetSiginfoValue()
#define LLDB_INVALID_INDEX32
lldb::OptionValuePropertiesSP m_collection_sp
StateType
Process and Thread States.
static std::string StopReasonAsString(lldb::StopReason reason)
lldb::ExpressionVariableSP GetExpressionVariable() const
lldb::StateType m_resume_state
This state is used to force a thread to be suspended from outside the ThreadPlan logic.
ObjectSP GetItemAtIndex(size_t idx) const
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.
LineEntry line_entry
The LineEntry for a given query.
virtual lldb::RegisterContextSP GetRegisterContext()=0
void SetFrameSP(const lldb::StackFrameSP &frame_sp)
Set accessor to set only the frame shared pointer.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
virtual bool IsBasePlan()
lldb::ThreadSP GetSelectedThread()
bool WasPlanDiscarded(ThreadPlan *plan) const
void SetResumeSignal(int signal)
virtual Status StepOver(bool source_step, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Default implementation for stepping over.
@ eStateRunning
Process or thread is running and can't be examined.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
bool m_extended_info_fetched
const uint32_t m_index_id
A unique 1 based index assigned to each thread for easy UI/command line access.
bool TracerExplainsStop()
void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, bool stop_format)
Target * GetTargetPtr() const
Returns a pointer to the target object.
@ eDescriptionLevelInitial
StructuredData::ObjectSP m_extended_info
friend class ThreadEventData
void DumpTypeDescription(lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) const
Dump to stdout.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
lldb::StackFrameSP CalculateStackFrame() override
std::string GetStopDescriptionRaw()
@ eBroadcastBitSelectedFrameChanged
bool SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast=false)
virtual bool IsPlanStale()
static const ThreadEventData * GetEventDataFromEvent(const Event *event_ptr)
void SetShouldReportStop(Vote vote)
FileSpecList GetLibrariesToAvoid() const
static ThreadProperties & GetGlobalProperties()