jgorbe created this revision.
jgorbe added a reviewer: zturner.
Herald added a project: LLDB.

If an invalid program is specified, lldb-vscode will send back a
response with `"success": false`, but then will continue executing the
rest of `request_launch()`, try to launch the program anyway and try to
send another response (possibly using the `response` object after it was
moved).

This change adds a return statement so we stop executing the handler
after producing the first failing response.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59340

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1245,6 +1245,7 @@
           response, "message",
           llvm::formatv("Could not load program '{0}'.", program).str());
       g_vsc.SendJSON(llvm::json::Value(std::move(response)));
+      return;
     }
   }
 


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1245,6 +1245,7 @@
           response, "message",
           llvm::formatv("Could not load program '{0}'.", program).str());
       g_vsc.SendJSON(llvm::json::Value(std::move(response)));
+      return;
     }
   }
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] D... Jorge Gorbe Moya via Phabricator via lldb-commits

Reply via email to