[Lldb-commits] [lldb] [lldb-dap] Do not write over the existing error if launchCommands fail during debugger launch. (PR #82051)

via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 16 14:13:58 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)

<details>
<summary>Changes</summary>

This fixes an issue where the error is lost if a command while executing `launchCommands` when launching the debugger.

This should fix #<!-- -->82048

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


1 Files Affected:

- (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+4-2) 


``````````diff
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 67022347e6d624..cc555d33b48b53 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -22,7 +22,7 @@
 // We also need to #undef GetObject (which is defined to GetObjectW) because
 // the JSON code we use also has methods named `GetObject()` and we conflict
 // against these.
-#define NOMINMAX
+#define NOMINMAXf
 #include <windows.h>
 #undef GetObject
 #include <io.h>
@@ -1779,8 +1779,10 @@ lldb::SBError LaunchProcess(const llvm::json::Object &request) {
     // Set the launch info so that run commands can access the configured
     // launch details.
     g_dap.target.SetLaunchInfo(launch_info);
-    if (llvm::Error err = g_dap.RunLaunchCommands(launchCommands))
+    if (llvm::Error err = g_dap.RunLaunchCommands(launchCommands)) {
       error.SetErrorString(llvm::toString(std::move(err)).c_str());
+      return error;
+    }
     // The custom commands might have created a new target so we should use the
     // selected target after these commands are run.
     g_dap.target = g_dap.debugger.GetSelectedTarget();

``````````

</details>


https://github.com/llvm/llvm-project/pull/82051


More information about the lldb-commits mailing list