Skip to content

Conversation

@JDevlieghere
Copy link
Member

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).

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).
@llvmbot
Copy link
Member

llvmbot commented May 5, 2025

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

Changes

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).


Full diff: https://github.com/llvm/llvm-project/pull/138601.diff

1 Files Affected:

  • (modified) lldb/tools/lldb-dap/DAP.cpp (+1-3)
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!

@JDevlieghere JDevlieghere requested a review from jimingham May 5, 2025 22:16
@JDevlieghere JDevlieghere merged commit 1c1238d into llvm:main May 6, 2025
13 checks passed
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
…m#138601)

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants