Go to the documentation of this file.
64 return *g_settings_ptr;
67 #define LLDB_PROPERTIES_thread
68 #include "TargetProperties.inc"
71 #define LLDB_PROPERTIES_thread
72 #include "TargetPropertiesEnum.inc"
76 :
public Cloneable<ThreadOptionValueProperties, OptionValueProperties> {
92 if (
this != instance_properties)
96 return ProtectedGetPropertyAtIndex(idx);
100 ThreadProperties::ThreadProperties(
bool is_global) :
Properties() {
103 std::make_shared<ThreadOptionValueProperties>(
ConstString(
"thread"));
113 const uint32_t idx = ePropertyStepAvoidRegex;
114 return m_collection_sp->GetPropertyAtIndexAsOptionValueRegex(
nullptr, idx);
118 const uint32_t idx = ePropertyStepAvoidLibraries;
122 assert(option_value);
127 const uint32_t idx = ePropertyEnableThreadTrace;
129 nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
133 const uint32_t idx = ePropertyStepInAvoidsNoDebug;
135 nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
139 const uint32_t idx = ePropertyStepOutAvoidsNoDebug;
141 nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
145 const uint32_t idx = ePropertyMaxBacktraceDepth;
147 nullptr, idx, g_thread_properties[idx].default_uint_value != 0);
153 static ConstString g_flavor(
"Thread::ThreadEventData");
158 : m_thread_sp(thread_sp), m_stack_id() {}
162 : m_thread_sp(thread_sp), m_stack_id(stack_id) {}
200 StackFrameSP frame_sp;
202 ThreadSP thread_sp = event_data->
GetThread();
204 frame_sp = thread_sp->GetStackFrameList()->GetFrameWithStackID(
220 Broadcaster(process.GetTarget().GetDebugger().GetBroadcasterManager(),
225 : process.GetNextThreadIndexID(tid)),
234 LLDB_LOGF(log,
"%p Thread::Thread(tid = 0x%4.4" PRIx64
")",
235 static_cast<void *
>(
this),
GetID());
242 LLDB_LOGF(log,
"%p Thread::~Thread(tid = 0x%4.4" PRIx64
")",
243 static_cast<void *
>(
this),
GetID());
267 StackFrameSP frame_sp = stack_frame_list_sp->GetFrameAtIndex(
268 stack_frame_list_sp->GetSelectedFrameIndex());
296 const bool broadcast =
true;
301 bool already_shown =
false;
303 frame_sp->GetSymbolContext(eSymbolContextLineEntry));
304 if (
GetProcess()->GetTarget().GetDebugger().GetUseExternalEditor() &&
310 bool show_frame_info =
true;
311 bool show_source = !already_shown;
313 return frame_sp->GetStatus(output_stream, show_frame_info, show_source);
326 GetProcess()->GetWarningsUnsupportedLanguage())) {
330 GetProcess()->PrintWarningUnsupportedLanguage(sc);
350 bool have_valid_completed_plan = completed_plan_sp && completed_plan_sp->PlanSucceeded();
351 bool plan_failed = completed_plan_sp && !completed_plan_sp->PlanSucceeded();
352 bool plan_overrides_trace =
353 have_valid_stop_info && have_valid_completed_plan
356 if (have_valid_stop_info && !plan_overrides_trace && !plan_failed) {
358 }
else if (completed_plan_sp) {
378 const uint32_t process_stop_id = process_sp->GetStopID();
405 process_sp->GetTarget().GetArchitecturePlugin())
406 arch->OverrideStopInfo(*
this);
416 return stop_info_sp->GetStopReason();
451 LLDB_LOGF(log,
"%p: tid = 0x%" PRIx64
": stop info = %s (stop_id = %u)",
452 static_cast<void *
>(
this),
GetID(),
453 stop_info_sp ? stop_info_sp->GetDescription() :
"<NULL>",
482 lldb::RegisterCheckpointSP reg_checkpoint_sp(
484 if (reg_checkpoint_sp) {
485 lldb::RegisterContextSP reg_ctx_sp(frame_sp->GetRegisterContext());
486 if (reg_ctx_sp && reg_ctx_sp->ReadAllRegisterValues(*reg_checkpoint_sp))
509 lldb::RegisterContextSP reg_ctx_sp(frame_sp->GetRegisterContext());
516 reg_ctx_sp->InvalidateIfNeeded(
true);
554 auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
556 if (!recognized_frame_sp)
560 recognized_frame_sp->GetStopDescription();
562 if (!recognized_stop_description.empty())
563 return recognized_stop_description;
571 if (stop_info_sp && stop_info_sp->IsValid()) {
572 raw_stop_description = stop_info_sp->GetDescription();
573 assert((!raw_stop_description.empty() ||
575 "StopInfo returned an empty description.");
577 return raw_stop_description;
586 auto frame_sp = frames_list_sp->GetFrameAtIndex(0);
588 auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
590 if (!recognized_frame_sp) {
591 LLDB_LOG(log,
"Frame #0 not recognized");
595 if (StackFrameSP most_relevant_frame_sp =
596 recognized_frame_sp->GetMostRelevantFrame()) {
597 LLDB_LOG(log,
"Found most relevant frame at index {0}",
598 most_relevant_frame_sp->GetFrameIndex());
601 LLDB_LOG(log,
"No relevant frame!");
627 const addr_t thread_pc = reg_ctx_sp->GetPC();
628 BreakpointSiteSP bp_site_sp =
629 GetProcess()->GetBreakpointSiteList().FindByAddress(thread_pc);
636 bool push_step_over_bp_plan =
false;
641 push_step_over_bp_plan =
true;
643 push_step_over_bp_plan =
true;
645 if (push_step_over_bp_plan) {
647 if (step_bp_plan_sp) {
648 step_bp_plan_sp->SetPrivate(
true);
653 step_bp_plan_sp.get());
674 if (backing_thread_sp)
675 backing_thread_sp->SetTemporaryResumeState(resume_state);
700 bool need_to_resume =
false;
703 need_to_resume = plan_ptr->
WillResume(resume_state,
true);
717 if (need_to_resume) {
723 return need_to_resume;
733 bool should_stop =
true;
739 "Thread::%s for tid = 0x%4.4" PRIx64
" 0x%4.4" PRIx64
740 ", should_stop = 0 (ignore since thread was suspended)",
747 "Thread::%s for tid = 0x%4.4" PRIx64
" 0x%4.4" PRIx64
748 ", should_stop = 0 (ignore since thread was suspended)",
758 "Thread::%s for tid = 0x%4.4" PRIx64
" 0x%4.4" PRIx64
759 ", pc = 0x%16.16" PRIx64
760 ", should_stop = 0 (ignore since no stop reason)",
769 "Thread::%s(%p) for tid = 0x%4.4" PRIx64
" 0x%4.4" PRIx64
770 ", pc = 0x%16.16" PRIx64,
774 LLDB_LOGF(log,
"^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
791 if (private_stop_info &&
792 !private_stop_info->ShouldStopSynchronous(event_ptr)) {
793 LLDB_LOGF(log,
"StopInfo::ShouldStop async callback says we should not "
794 "stop, returning ShouldStop of false.");
813 bool done_processing_current_plan =
false;
817 done_processing_current_plan =
true;
827 should_stop = plan_ptr->
ShouldStop(event_ptr);
846 done_processing_current_plan =
849 done_processing_current_plan =
true;
857 if (!done_processing_current_plan) {
858 bool override_stop =
false;
862 should_stop = current_plan->
ShouldStop(event_ptr);
863 LLDB_LOGF(log,
"Base plan says should stop: %i.", should_stop);
872 should_stop = current_plan->
ShouldStop(event_ptr);
880 override_stop =
true;
881 LLDB_LOGF(log,
"Plan %s auto-continue: true.",
895 if (current_plan ==
nullptr) {
927 "Plan %s being discarded in cleanup, it says it is already done.",
950 LLDB_LOGF(log,
"vvvvvvvv Thread::ShouldStop End (returning %i) vvvvvvvv",
964 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
965 ": returning vote %i (state was suspended or invalid)",
973 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
974 ": returning vote %i (temporary state was suspended or invalid)",
981 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
982 ": returning vote %i (thread didn't stop for a reason.)",
987 if (
GetPlans().AnyCompletedPlans()) {
991 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
992 ": returning vote for complete stack's back plan",
1009 "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
1010 ": returning vote %i for current plan",
1011 GetID(), thread_vote);
1025 if (
GetPlans().AnyCompletedPlans()) {
1029 "Current Plan for thread %d(%p) (0x%4.4" PRIx64
1030 ", %s): %s being asked whether we should report run.",
1038 "Current Plan for thread %d(%p) (0x%4.4" PRIx64
1039 ", %s): %s being asked whether we should report run.",
1069 assert(thread_plan_sp &&
"Don't push an empty thread plan.");
1075 LLDB_LOGF(log,
"Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64
".",
1076 static_cast<void *
>(
this), s.
GetData(),
1077 thread_plan_sp->GetThread().GetID());
1087 LLDB_LOGF(log,
"Popping plan: \"%s\", tid = 0x%4.4" PRIx64
".",
1088 popped_plan_sp->GetName(), popped_plan_sp->GetThread().GetID());
1096 LLDB_LOGF(log,
"Discarding plan: \"%s\", tid = 0x%4.4" PRIx64
".",
1097 discarded_plan_sp->GetName(),
1098 discarded_plan_sp->GetThread().GetID());
1150 bool abort_other_plans) {
1153 if (!thread_plan_sp->ValidatePlan(&s)) {
1155 thread_plan_sp.reset();
1160 if (abort_other_plans)
1169 if (!thread_plan_sp->ValidatePlan(&s)) {
1171 thread_plan_sp.reset();
1184 if (up_to_plan_ptr ==
nullptr)
1198 "Discarding thread plans for thread tid = 0x%4.4" PRIx64
1200 GetID(),
static_cast<void *
>(up_to_plan_ptr));
1208 "Discarding thread plans for thread (tid = 0x%4.4" PRIx64
1223 if (!innermost_expr_plan) {
1224 error.SetErrorString(
"No expressions currently active on this thread");
1234 return thread_plan_sp;
1238 bool step_over,
bool abort_other_plans,
bool stop_other_threads,
1243 return thread_plan_sp;
1249 Status &status,
LazyBool step_out_avoids_code_withoug_debug_info) {
1250 ThreadPlanSP thread_plan_sp;
1251 thread_plan_sp = std::make_shared<ThreadPlanStepOverRange>(
1252 *
this, range, addr_context, stop_other_threads,
1253 step_out_avoids_code_withoug_debug_info);
1256 return thread_plan_sp;
1262 bool abort_other_plans,
const LineEntry &line_entry,
1264 Status &status,
LazyBool step_out_avoids_code_withoug_debug_info) {
1265 const bool include_inlined_functions =
true;
1266 auto address_range =
1269 abort_other_plans, address_range, addr_context, stop_other_threads,
1270 status, step_out_avoids_code_withoug_debug_info);
1275 const SymbolContext &addr_context,
const char *step_in_target,
1277 LazyBool step_in_avoids_code_without_debug_info,
1278 LazyBool step_out_avoids_code_without_debug_info) {
1280 *
this, range, addr_context, step_in_target, stop_other_threads,
1281 step_in_avoids_code_without_debug_info,
1282 step_out_avoids_code_without_debug_info));
1284 return thread_plan_sp;
1289 bool abort_other_plans,
const LineEntry &line_entry,
1290 const SymbolContext &addr_context,
const char *step_in_target,
1292 LazyBool step_in_avoids_code_without_debug_info,
1293 LazyBool step_out_avoids_code_without_debug_info) {
1294 const bool include_inlined_functions =
false;
1298 addr_context, step_in_target, stop_other_threads, status,
1299 step_in_avoids_code_without_debug_info,
1300 step_out_avoids_code_without_debug_info);
1304 bool abort_other_plans,
SymbolContext *addr_context,
bool first_insn,
1305 bool stop_other_threads,
Vote report_stop_vote,
Vote report_run_vote,
1307 LazyBool step_out_avoids_code_without_debug_info) {
1309 *
this, addr_context, first_insn, stop_other_threads, report_stop_vote,
1310 report_run_vote, frame_idx, step_out_avoids_code_without_debug_info));
1313 return thread_plan_sp;
1317 bool abort_other_plans,
SymbolContext *addr_context,
bool first_insn,
1318 bool stop_other_threads,
Vote report_stop_vote,
Vote report_run_vote,
1319 uint32_t frame_idx,
Status &status,
bool continue_to_next_branch) {
1320 const bool calculate_return_value =
1323 *
this, addr_context, first_insn, stop_other_threads, report_stop_vote,
1324 report_run_vote, frame_idx,
eLazyBoolNo, continue_to_next_branch,
1325 calculate_return_value));
1332 return thread_plan_sp;
1336 bool abort_other_plans,
1337 bool stop_other_threads,
1339 ThreadPlanSP thread_plan_sp(
1341 if (!thread_plan_sp || !thread_plan_sp->ValidatePlan(
nullptr))
1342 return ThreadPlanSP();
1345 return thread_plan_sp;
1350 bool stop_other_threads,
1352 ThreadPlanSP thread_plan_sp(
1356 return thread_plan_sp;
1360 bool abort_other_plans,
lldb::addr_t *address_list,
size_t num_addresses,
1363 *
this, address_list, num_addresses, stop_other_threads, frame_idx));
1366 return thread_plan_sp;
1370 bool abort_other_plans,
const char *class_name,
1376 thread_plan_sp->SetStopOthers(stop_other_threads);
1378 return thread_plan_sp;
1387 target_sp = process_sp->CalculateTarget();
1434 lldb::ValueObjectSP return_value_sp,
1441 "Could not find frame with index %d in thread 0x%" PRIx64
".",
1442 frame_idx,
GetID());
1449 lldb::ValueObjectSP return_value_sp,
1455 return return_error;
1458 Thread *thread = frame_sp->GetThread().get();
1459 uint32_t older_frame_idx = frame_sp->GetFrameIndex() + 1;
1461 if (!older_frame_sp) {
1463 return return_error;
1466 if (return_value_sp) {
1467 lldb::ABISP abi = thread->
GetProcess()->GetABI();
1469 return_error.
SetErrorString(
"Could not find ABI to set return value.");
1470 return return_error;
1472 SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction);
1477 if ( (
false) && sc.
function !=
nullptr) {
1479 if (function_type) {
1485 ValueObjectSP cast_value_sp = return_value_sp->Cast(return_type);
1486 if (cast_value_sp) {
1488 return_value_sp = cast_value_sp;
1494 return_error = abi->SetReturnValueObject(older_frame_sp, return_value_sp);
1496 return return_error;
1504 if (youngest_frame_sp) {
1505 lldb::RegisterContextSP reg_ctx_sp(youngest_frame_sp->GetRegisterContext());
1507 bool copy_success = reg_ctx_sp->CopyFromRegisterContext(
1508 older_frame_sp->GetRegisterContext());
1524 return return_error;
1529 for (
size_t n = 0; n <
list.size(); n++) {
1547 std::vector<Address> candidates, within_function, outside_function;
1549 within_function, outside_function);
1556 if (!within_function.empty())
1557 candidates = within_function;
1558 else if (outside_function.size() == 1 && can_leave_function)
1559 candidates = outside_function;
1562 if (candidates.empty()) {
1563 if (outside_function.empty()) {
1564 return Status(
"Cannot locate an address for %s:%i.",
1566 }
else if (outside_function.size() == 1) {
1567 return Status(
"%s:%i is outside the current function.",
1572 return Status(
"%s:%i has multiple candidate locations:\n%s",
1579 if (warnings && candidates.size() > 1) {
1581 sstr.
Printf(
"%s:%i appears multiple times in this function, selecting the "
1582 "first location:\n",
1588 if (!reg_ctx->
SetPC(dest))
1589 return Status(
"Cannot change PC to target address.");
1598 if (process ==
nullptr)
1601 StackFrameSP frame_sp;
1607 frame_sc = frame_sp->GetSymbolContext(eSymbolContextEverything);
1617 assert(thread_format);
1620 &exe_ctx,
nullptr,
nullptr,
false,
false);
1666 return "breakpoint";
1668 return "watchpoint";
1680 return "vfork done";
1682 return "plan complete";
1684 return "thread exiting";
1686 return "instrumentation break";
1688 return "processor trace";
1691 return "StopReason = " + std::to_string(reason);
1697 return "only this thread";
1699 return "all threads";
1701 return "only during stepping";
1704 return "RunMode = " + std::to_string(mode);
1709 bool stop_format,
bool only_stacks) {
1716 bool is_selected =
false;
1721 strm.
Printf(
"%c ", is_selected ?
'*' :
' ');
1726 frame_sp->GetSymbolContext(eSymbolContextLineEntry));
1737 size_t num_frames_shown = 0;
1738 if (num_frames > 0) {
1741 const bool show_frame_info =
true;
1742 const bool show_frame_unique = only_stacks;
1743 const char *selected_frame_marker =
nullptr;
1744 if (num_frames == 1 || only_stacks ||
1748 selected_frame_marker =
"* ";
1751 strm, start_frame, num_frames, show_frame_info, num_frames_with_source,
1752 show_frame_unique, selected_frame_marker);
1753 if (num_frames == 1)
1757 return num_frames_shown;
1761 bool print_json_thread,
bool print_json_stopinfo) {
1762 const bool stop_format =
false;
1768 if (print_json_thread || print_json_stopinfo) {
1769 if (thread_info && print_json_thread) {
1770 thread_info->Dump(strm);
1777 stop_info->Dump(strm);
1787 thread_info->GetObjectForDotSeparatedPath(
"activity");
1789 thread_info->GetObjectForDotSeparatedPath(
"breadcrumb");
1791 thread_info->GetObjectForDotSeparatedPath(
"trace_messages");
1793 bool printed_activity =
false;
1800 strm.
Format(
" Activity '{0}', {1:x}\n",
1801 name->GetAsString()->GetValue(),
1802 id->GetAsInteger()->GetValue());
1804 printed_activity =
true;
1806 bool printed_breadcrumb =
false;
1808 if (printed_activity)
1814 if (breadcrumb_text &&
1816 strm.
Format(
" Current Breadcrumb: {0}\n",
1817 breadcrumb_text->GetAsString()->GetValue());
1819 printed_breadcrumb =
true;
1822 if (printed_breadcrumb)
1825 const size_t msg_count = messages_array->
GetSize();
1826 if (msg_count > 0) {
1827 strm.
Printf(
" %zu trace messages:\n", msg_count);
1828 for (
size_t i = 0; i < msg_count; i++) {
1837 strm.
Format(
" {0}\n", message_text->GetAsString()->GetValue());
1849 uint32_t num_frames,
bool show_frame_info,
1852 strm, first_frame, num_frames, show_frame_info, num_frames_with_source);
1877 BreakpointSiteSP bp_site_sp =
1878 GetProcess()->GetBreakpointSiteList().FindByAddress(
pc);
1879 if (bp_site_sp &&
static_cast<break_id_t>(value) == bp_site_sp->GetID())
1888 LazyBool step_in_avoids_code_without_debug_info,
1889 LazyBool step_out_avoids_code_without_debug_info)
1896 ThreadPlanSP new_plan_sp;
1898 const bool abort_other_plans =
false;
1900 if (source_step && frame_sp && frame_sp->HasDebugInformation()) {
1901 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
1904 step_in_avoids_code_without_debug_info,
1905 step_out_avoids_code_without_debug_info);
1908 false, abort_other_plans, run_mode,
error);
1911 new_plan_sp->SetIsControllingPlan(
true);
1912 new_plan_sp->SetOkayToDiscard(
false);
1918 error.SetErrorString(
"process not stopped");
1924 LazyBool step_out_avoids_code_without_debug_info) {
1929 ThreadPlanSP new_plan_sp;
1932 const bool abort_other_plans =
false;
1934 if (source_step && frame_sp && frame_sp->HasDebugInformation()) {
1935 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
1938 step_out_avoids_code_without_debug_info);
1941 true, abort_other_plans, run_mode,
error);
1944 new_plan_sp->SetIsControllingPlan(
true);
1945 new_plan_sp->SetOkayToDiscard(
false);
1951 error.SetErrorString(
"process not stopped");
1960 const bool first_instruction =
false;
1961 const bool stop_other_threads =
false;
1962 const bool abort_other_plans =
false;
1965 abort_other_plans,
nullptr, first_instruction, stop_other_threads,
1968 new_plan_sp->SetIsControllingPlan(
true);
1969 new_plan_sp->SetOkayToDiscard(
false);
1975 error.SetErrorString(
"process not stopped");
1982 if (
auto recognized_frame = frame_sp->GetRecognizedFrame())
1983 if (
auto e = recognized_frame->GetExceptionObject())
1989 if (
auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
1993 return ValueObjectSP();
2004 if (
auto bt = runtime->GetBacktraceThreadFromException(exception))
2014 Target &target = process_sp->GetTarget();
2016 assert(platform_sp);
2023 llvm::Optional<uint64_t> type_size = type.
GetByteSize(
nullptr);
2025 llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>> data =
GetSiginfo(type_size.getValue());
2029 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.
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
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
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)
virtual lldb::StopInfoSP GetPrivateStopInfo()
@ 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
void SelectMostRelevantFrame()
llvm::Optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
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.
@ eBroadcastBitStackChanged
@ 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()
@ eBroadcastBitSelectedFrameChanged
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.
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.
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()
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.
ConstString & GetFilename()
Filename string get accessor.
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()
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()