From 26940a28e73ca3b91bac531d27c76f863e5b8a4a Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 5 May 2025 15:09:43 -0700 Subject: [PATCH] [lldb-dap] Don't error out when the process is in eStateUnloaded DAP::WaitForProcessToStop treats the process in eStateUnloaded as an error. The process is in this state when it has just been created (before an attach or launch) or when it's restarted. Neither should be treated as errors. The current implementation can trigger this error (and a corresponding test failure) when we call WaitForProcessToStop after attaching in asynchronous mode (for example when using ConnectRemote which is always asynchronous (due to a bug). --- lldb/tools/lldb-dap/DAP.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index 4cb0d8e49004c..4b631484c9fab 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -968,6 +968,7 @@ lldb::SBError DAP::WaitForProcessToStop(std::chrono::seconds seconds) { while (std::chrono::steady_clock::now() < timeout_time) { const auto state = process.GetState(); switch (state) { + case lldb::eStateUnloaded: case lldb::eStateAttaching: case lldb::eStateConnected: case lldb::eStateInvalid: @@ -982,9 +983,6 @@ lldb::SBError DAP::WaitForProcessToStop(std::chrono::seconds seconds) { case lldb::eStateExited: error.SetErrorString("process exited during launch or attach"); return error; - case lldb::eStateUnloaded: - error.SetErrorString("process unloaded during launch or attach"); - return error; case lldb::eStateCrashed: case lldb::eStateStopped: return lldb::SBError(); // Success!