Lines Matching +full:fetch +full:- +full:depth

1 //===-- Thread.cpp --------------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
53 #include "lldb/lldb-enumerations.h"
88 Thread *thread = exe_ctx->GetThreadPtr();
92 thread->GetValueProperties().get());
94 return instance_properties->ProtectedGetPropertyAtIndex(idx);
104 m_collection_sp->Initialize(g_thread_properties);
174 const EventData *event_data = event_ptr->GetData();
176 event_data->GetFlavor() == ThreadEventData::GetFlavorString())
177 return static_cast<const ThreadEventData *>(event_ptr->GetData());
186 thread_sp = event_data->GetThread();
194 stack_id = event_data->GetStackID();
203 ThreadSP thread_sp = event_data->GetThread();
205 frame_sp = thread_sp->GetStackFrameList()->GetFrameWithStackID(
206 event_data->GetStackID());
273 StackFrameSP frame_sp = stack_frame_list_sp->GetFrameAtIndex(
274 stack_frame_list_sp->GetSelectedFrameIndex(select_most_relevant));
281 uint32_t ret_value = GetStackFrameList()->SetSelectedFrame(frame);
283 BroadcastSelectedFrameChange(frame->GetStackID());
289 StackFrameSP frame_sp(GetStackFrameList()->GetFrameAtIndex(frame_idx));
291 GetStackFrameList()->SetSelectedFrame(frame_sp.get());
293 BroadcastSelectedFrameChange(frame_sp->GetStackID());
309 frame_sp->GetSymbolContext(eSymbolContextLineEntry));
310 const Debugger &debugger = GetProcess()->GetTarget().GetDebugger();
326 return frame_sp->GetStatus(output_stream, show_frame_info, show_source);
337 if (frame->HasDebugInformation() &&
338 (GetProcess()->GetWarningsOptimization() ||
339 GetProcess()->GetWarningsUnsupportedLanguage())) {
341 frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextModule);
342 GetProcess()->PrintWarningOptimization(sc);
343 GetProcess()->PrintWarningUnsupportedLanguage(sc);
353 const uint32_t stop_id = process_sp ? process_sp->GetStopID() : UINT32_MAX;
355 // Here we select the stop info according to priorirty: - m_stop_info_sp (if
356 // not trace) - preset value - completed plan stop info - new value with plan
357 // from completed plan stack - m_stop_info_sp (trace stop reason is OK now) -
361 m_stop_info_sp ->IsValid() &&
363 bool have_valid_completed_plan = completed_plan_sp && completed_plan_sp->PlanSucceeded();
364 bool plan_failed = completed_plan_sp && !completed_plan_sp->PlanSucceeded();
367 && (m_stop_info_sp->GetStopReason() == eStopReasonTrace);
394 const uint32_t process_stop_id = process_sp->GetStopID();
402 if (m_stop_info_sp->IsValid() || IsStillAtLastBreakpointHit() ||
403 GetCurrentPlan()->IsVirtualStep()
427 process_sp->GetTarget().GetArchitecturePlugin())
428 arch->OverrideStopInfo(*this);
435 if (m_stop_info_sp && m_stop_info_sp->WasContinueInterrupted(*this))
444 return stop_info_sp->GetStopReason();
451 return m_stop_info_stop_id == process_sp->GetStopID();
466 m_stop_info_sp->MakeStopInfoValid();
469 m_stop_info_sp->OverrideShouldNotify(m_override_should_notify ==
475 m_stop_info_stop_id = process_sp->GetStopID();
481 stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>",
491 m_stop_info_sp->OverrideShouldNotify(m_override_should_notify ==
513 lldb::RegisterContextSP reg_ctx_sp(frame_sp->GetRegisterContext());
514 if (reg_ctx_sp && reg_ctx_sp->ReadAllRegisterValues(*reg_checkpoint_sp))
524 saved_state.orig_stop_id = process_sp->GetStopID();
537 lldb::RegisterContextSP reg_ctx_sp(frame_sp->GetRegisterContext());
540 reg_ctx_sp->WriteAllRegisterValues(*saved_state.register_backup_sp);
544 reg_ctx_sp->InvalidateIfNeeded(true);
546 m_unwinder_up->Clear();
557 saved_state.stop_info_sp->MakeStopInfoValid();
559 GetStackFrameList()->SetCurrentInlinedDepth(
582 auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
588 recognized_frame_sp->GetStopDescription();
599 if (stop_info_sp && stop_info_sp->IsValid()) {
600 raw_stop_description = stop_info_sp->GetDescription();
602 stop_info_sp->GetStopReason() == eStopReasonNone) &&
617 current_plan->WillStop();
627 if (GetCurrentPlan()->IsVirtualStep())
630 // If we're at a breakpoint push the step-over breakpoint plan. Do this
636 const addr_t thread_pc = reg_ctx_sp->GetPC();
638 GetProcess()->GetBreakpointSiteList().FindByAddress(thread_pc);
646 if (cur_plan->GetKind() == ThreadPlan::eKindStepOverBreakpoint) {
649 if (bp_plan->GetBreakpointLoadAddress() != thread_pc)
657 step_bp_plan_sp->SetPrivate(true);
659 if (GetCurrentPlan()->RunState() != eStateStepping) {
663 step_bp_plan->SetAutoContinue(true);
686 backing_thread_sp->SetTemporaryResumeState(resume_state);
694 // fetch stop info from the target, 'cause that slows down single stepping.
696 // haven't yet had to fetch the stop reason, then it doesn't need to know
698 const uint32_t process_stop_id = GetProcess()->GetStopID();
700 (m_stop_info_sp && m_stop_info_sp->IsValid())) {
703 stop_info->WillResume(resume_state);
714 need_to_resume = plan_ptr->WillResume(resume_state, true);
717 plan_ptr->WillResume(resume_state, false);
777 GetRegisterContext() ? GetRegisterContext()->GetPC()
790 GetRegisterContext() ? GetRegisterContext()->GetPC()
795 GetProcess()->DumpThreadPlansForTID(
802 current_plan->DoTraceLog();
810 !private_stop_info->ShouldStopSynchronous(event_ptr)) {
822 // depth.
823 GetStackFrameList()->CalculateCurrentInlinedDepth();
832 if (!current_plan->PlanExplainsStop(event_ptr)) {
833 if (current_plan->TracerExplainsStop()) {
840 if (current_plan->IsLeafPlan())
847 if (plan_ptr->PlanExplainsStop(event_ptr)) {
848 LLDB_LOGF(log, "Plan %s explains stop.", plan_ptr->GetName());
850 should_stop = plan_ptr->ShouldStop(event_ptr);
856 if (plan_ptr->MischiefManaged()) {
863 current_plan->WillStop();
870 (plan_ptr->IsControllingPlan() && !plan_ptr->OkayToDiscard());
872 bool should_force_run = plan_ptr->ShouldRunBeforePublicStop();
889 if (current_plan->IsBasePlan()) {
890 should_stop = current_plan->ShouldStop(event_ptr);
897 if (current_plan->IsBasePlan())
900 should_stop = current_plan->ShouldStop(event_ptr);
901 LLDB_LOGF(log, "Plan %s should stop: %d.", current_plan->GetName(),
903 if (current_plan->MischiefManaged()) {
905 current_plan->WillStop();
907 if (current_plan->ShouldAutoContinue(event_ptr)) {
909 LLDB_LOGF(log, "Plan %s auto-continue: true.",
910 current_plan->GetName());
917 if (should_stop && current_plan->IsControllingPlan() &&
918 !current_plan->OkayToDiscard()) {
937 // in before it is complete - for instance by hitting a breakpoint during a
938 // step-over - then do some step/finish/etc operations that wind up past the
947 while (!plan_ptr->IsBasePlan()) {
948 bool stale = plan_ptr->IsPlanStale();
956 examined_plan->GetName());
960 if (examined_plan->IsPlanComplete()) {
974 GetProcess()->DumpThreadPlansForTID(
1022 return GetPlans().GetCompletedPlan(false)->ShouldReportStop(event_ptr);
1027 if (plan_ptr->PlanExplainsStop(event_ptr)) {
1028 thread_vote = plan_ptr->ShouldReportStop(event_ptr);
1031 if (plan_ptr->IsBasePlan())
1061 GetCompletedPlan()->GetName());
1063 return GetPlans().GetCompletedPlan(false)->ShouldReportRun(event_ptr);
1070 GetCurrentPlan()->GetName());
1072 return GetCurrentPlan()->ShouldReportRun(event_ptr);
1077 return (spec == nullptr) ? true : spec->ThreadPassesBasicTests(*this);
1081 ThreadPlanStack *plans = GetProcess()->FindThreadPlans(GetID());
1088 // Instead of special-casing at that point, we return a Stack with a
1102 thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelFull);
1105 thread_plan_sp->GetThread().GetID());
1116 popped_plan_sp->GetName(), popped_plan_sp->GetThread().GetID());
1125 discarded_plan_sp->GetName(),
1126 discarded_plan_sp->GetThread().GetID());
1139 p->GetDescription(&strm, eDescriptionLevelInitial);
1181 if (!thread_plan_sp->ValidatePlan(&s)) {
1196 if (!thread_plan_sp->ValidatePlan(&s)) {
1356 new_plan->ClearShouldStopHereCallbacks();
1368 if (!thread_plan_sp || !thread_plan_sp->ValidatePlan(nullptr))
1403 thread_plan_sp->SetStopOthers(stop_other_threads);
1414 target_sp = process_sp->CalculateTarget();
1448 m_prev_framezero_pc = reg_ctx_sp->GetPC();
1454 if (m_curr_frames_sp && m_curr_frames_sp->WereAllFramesFetched())
1463 return GetStackFrameList()->GetFrameWithConcreteFrameIndex(unwind_idx);
1491 Thread *thread = frame_sp->GetThread().get();
1492 uint32_t older_frame_idx = frame_sp->GetFrameIndex() + 1;
1493 StackFrameSP older_frame_sp = thread->GetStackFrameAtIndex(older_frame_idx);
1500 lldb::ABISP abi = thread->GetProcess()->GetABI();
1506 SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction);
1512 Type *function_type = sc.function->GetType();
1515 sc.function->GetCompilerType().GetFunctionReturnType();
1519 ValueObjectSP cast_value_sp = return_value_sp->Cast(return_type);
1521 cast_value_sp->SetFormat(eFormatHex);
1528 return_error = abi->SetReturnValueObject(older_frame_sp, return_value_sp);
1534 // ReadAllRegisterValues->WriteAllRegisterValues, since the read & write cook
1537 StackFrameSP youngest_frame_sp = thread->GetStackFrameAtIndex(0);
1539 lldb::RegisterContextSP reg_ctx_sp(youngest_frame_sp->GetRegisterContext());
1541 bool copy_success = reg_ctx_sp->CopyFromRegisterContext(
1542 older_frame_sp->GetRegisterContext());
1544 thread->DiscardThreadPlans(true);
1545 thread->ClearStackFrames();
1580 const SymbolContext &sc = frame->GetSymbolContext(eSymbolContextFunction);
1584 target->GetImages().FindAddressesForLine(target_sp, file, line, sc.function,
1627 if (!reg_ctx->SetPC(dest))
1646 frame_sc = frame_sp->GetSymbolContext(eSymbolContextEverything);
1675 return m_reg_context_sp->GetThreadPointer();
1683 DynamicLoader *loader = GetProcess()->GetDynamicLoader();
1685 return loader->GetThreadLocalData(module, shared_from_this(),
1694 DynamicLoader *loader = GetProcess()->GetDynamicLoader();
1695 if (loader && loader->IsFullyInitialized() == false)
1698 SystemRuntime *runtime = process->GetSystemRuntime();
1700 return runtime->SafeToCallFunctionsOnThisThread(shared_from_this());
1708 return GetStackFrameList()->GetStackFrameSPForStackFramePtr(stack_frame_ptr);
1774 if (process->GetThreadList().GetSelectedThread().get() == this)
1778 if (target && target->GetDebugger().GetUseExternalEditor()) {
1782 frame_sp->GetSymbolContext(eSymbolContextLineEntry));
1785 target->GetDebugger().GetExternalEditor(),
1805 (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID()))
1810 num_frames_shown = GetStackFrameList()->GetStatus(
1830 thread_info->Dump(strm);
1835 StructuredData::ObjectSP stop_info = m_stop_info_sp->GetExtendedInfo();
1837 stop_info->Dump(strm);
1847 thread_info->GetObjectForDotSeparatedPath("activity");
1849 thread_info->GetObjectForDotSeparatedPath("breadcrumb");
1851 thread_info->GetObjectForDotSeparatedPath("trace_messages");
1854 if (activity && activity->GetType() == eStructuredDataTypeDictionary) {
1855 StructuredData::Dictionary *activity_dict = activity->GetAsDictionary();
1856 StructuredData::ObjectSP id = activity_dict->GetValueForKey("id");
1857 StructuredData::ObjectSP name = activity_dict->GetValueForKey("name");
1858 if (name && name->GetType() == eStructuredDataTypeString && id &&
1859 id->GetType() == eStructuredDataTypeInteger) {
1861 name->GetAsString()->GetValue(),
1862 id->GetUnsignedIntegerValue());
1867 if (breadcrumb && breadcrumb->GetType() == eStructuredDataTypeDictionary) {
1871 breadcrumb->GetAsDictionary();
1873 breadcrumb_dict->GetValueForKey("name");
1875 breadcrumb_text->GetType() == eStructuredDataTypeString) {
1877 breadcrumb_text->GetAsString()->GetValue());
1881 if (messages && messages->GetType() == eStructuredDataTypeArray) {
1884 StructuredData::Array *messages_array = messages->GetAsArray();
1885 const size_t msg_count = messages_array->GetSize();
1889 StructuredData::ObjectSP message = messages_array->GetItemAtIndex(i);
1890 if (message && message->GetType() == eStructuredDataTypeDictionary) {
1892 message->GetAsDictionary();
1894 message_dict->GetValueForKey("message");
1896 message_text->GetType() == eStructuredDataTypeString) {
1897 strm.Format(" {0}\n", message_text->GetAsString()->GetValue());
1912 return GetStackFrameList()->GetStatus(strm, first_frame, num_frames,
1931 // stopinfo, such as when thread-stepping in multithreaded programs.
1933 StopReason stop_reason = m_stop_info_sp->GetStopReason();
1935 uint64_t value = m_stop_info_sp->GetValue();
1938 lldb::addr_t pc = reg_ctx_sp->GetPC();
1940 GetProcess()->GetBreakpointSiteList().FindByAddress(pc);
1941 if (bp_site_sp && static_cast<break_id_t>(value) == bp_site_sp->GetID())
1956 if (StateIsStoppedState(process->GetState(), true)) {
1962 if (source_step && frame_sp && frame_sp->HasDebugInformation()) {
1963 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
1973 new_plan_sp->SetIsControllingPlan(true);
1974 new_plan_sp->SetOkayToDiscard(false);
1977 process->GetThreadList().SetSelectedThreadByID(GetID());
1978 error = process->Resume();
1989 if (StateIsStoppedState(process->GetState(), true)) {
1996 if (source_step && frame_sp && frame_sp->HasDebugInformation()) {
1997 SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
2006 new_plan_sp->SetIsControllingPlan(true);
2007 new_plan_sp->SetOkayToDiscard(false);
2010 process->GetThreadList().SetSelectedThreadByID(GetID());
2011 error = process->Resume();
2021 if (StateIsStoppedState(process->GetState(), true)) {
2030 new_plan_sp->SetIsControllingPlan(true);
2031 new_plan_sp->SetOkayToDiscard(false);
2034 process->GetThreadList().SetSelectedThreadByID(GetID());
2035 error = process->Resume();
2044 if (auto recognized_frame = frame_sp->GetRecognizedFrame())
2045 if (auto e = recognized_frame->GetExceptionObject())
2050 for (LanguageRuntime *runtime : GetProcess()->GetLanguageRuntimes()) {
2051 if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
2065 for (LanguageRuntime *runtime : GetProcess()->GetLanguageRuntimes()) {
2066 if (auto bt = runtime->GetBacktraceThreadFromException(exception))
2076 Target &target = process_sp->GetTarget();
2081 CompilerType type = platform_sp->GetSiginfoType(arch.GetTriple());
2094 DataExtractor data_extractor{data.get()->getBufferStart(), data.get()->getBufferSize(),
2095 process_sp->GetByteOrder(), arch.GetAddressByteSize()};