https://github.com/Teemperor created https://github.com/llvm/llvm-project/pull/188198
This code accesses the completed thread plan (even if it's private one). However, the logging code does not pass `skip_private=false` and instead accesses only the public completed thread plan. In case there is no public thread plan, the logging code could also crash. This is just some minor refactoring that ensures we use the same thread plan in the logging code. >From 76689601a32b5f2e8bb7aa5a26172f51c29459af Mon Sep 17 00:00:00 2001 From: Raphael Isemann <[email protected]> Date: Tue, 24 Mar 2026 08:45:38 +0000 Subject: [PATCH] [lldb] Print correct thread plan in logging code of Thread::ShouldReportRun This code accesses the completed thread plan (even if it's private one). However, the logging code does not pass `skip_private=false` and instead accesses only the public completed thread plan. In case there is no public thread plan, the logging code could also crash. This is just some minor refactoring that ensures we use the same thread plan in the logging code. --- lldb/source/Target/Thread.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 8bc109340c618..53aa551b4c68c 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -1084,14 +1084,15 @@ Vote Thread::ShouldReportRun(Event *event_ptr) { if (GetPlans().AnyCompletedPlans()) { // Pass skip_private = false to GetCompletedPlan, since we want to ask // the last plan, regardless of whether it is private or not. + ThreadPlanSP plan = GetPlans().GetCompletedPlan(/*skip_private=*/false); + LLDB_LOGF(log, "Current Plan for thread %d(%p) (0x%4.4" PRIx64 ", %s): %s being asked whether we should report run.", GetIndexID(), static_cast<void *>(this), GetID(), - StateAsCString(GetTemporaryResumeState()), - GetCompletedPlan()->GetName()); + StateAsCString(GetTemporaryResumeState()), plan->GetName()); - return GetPlans().GetCompletedPlan(false)->ShouldReportRun(event_ptr); + return plan->ShouldReportRun(event_ptr); } else { LLDB_LOGF(log, "Current Plan for thread %d(%p) (0x%4.4" PRIx64 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
