Author: Jonas Devlieghere
Date: 2025-05-05T17:29:40-07:00
New Revision: 1c1238d3615a7e1a99570d1e02de3b538d2e0669

URL: 
https://github.com/llvm/llvm-project/commit/1c1238d3615a7e1a99570d1e02de3b538d2e0669
DIFF: 
https://github.com/llvm/llvm-project/commit/1c1238d3615a7e1a99570d1e02de3b538d2e0669.diff

LOG: [lldb-dap] Don't error out when the process is in eStateUnloaded (#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).

Added: 
    

Modified: 
    lldb/tools/lldb-dap/DAP.cpp

Removed: 
    


################################################################################
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!


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to