[Lldb-commits] [lldb] [lldb] Fix trace load hang (PR #187768)

Tom Hewitt via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 20 12:04:16 PDT 2026


https://github.com/tom-hewitt created https://github.com/llvm/llvm-project/pull/187768

#179799 removed the `SetPrivateState(eStateStopped)` call in `ProcessTrace::DidAttach()`. This makes the call to `WaitForProcessToStop` hang forever, causing the `trace load` command to hang.

This fix reintroduces the `SetPrivateState` call so a postmortem trace process will "stop" after being loaded, matching the logic used in `Process::LoadCore()`.

>From 9c609858d181987c01f372eec664692d8cb084b1 Mon Sep 17 00:00:00 2001
From: Tom Hewitt <47860067+tom-hewitt at users.noreply.github.com>
Date: Fri, 20 Mar 2026 19:00:14 +0000
Subject: [PATCH] [lldb] Fix trace load hang

#179799 removed the `SetPrivateState(eStateStopped)` call in `ProcessTrace::DidAttach()`. This makes the call to `WaitForProcessToStop` hang forever, causing the `trace load` command to hang.

This fix reintroduces the `SetPrivateState` call so a postmortem trace process will "stop" after being loaded, matching the logic used in `Process::LoadCore()`.
---
 lldb/source/Target/ProcessTrace.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lldb/source/Target/ProcessTrace.cpp b/lldb/source/Target/ProcessTrace.cpp
index 8b7d194aa0767..e2dcd7231b71d 100644
--- a/lldb/source/Target/ProcessTrace.cpp
+++ b/lldb/source/Target/ProcessTrace.cpp
@@ -72,6 +72,10 @@ void ProcessTrace::DidAttach(ArchSpec &process_arch) {
     return;
   }
 
+  // Pretend we stopped so we can show all of the threads
+  // in the trace and explore the final state.
+  SetPrivateState(lldb::eStateStopped);
+
   EventSP event_sp;
   WaitForProcessToStop(std::nullopt, &event_sp, true, listener_sp);
 



More information about the lldb-commits mailing list