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 <[email protected]>
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);
 

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to