[Lldb-commits] [PATCH] D150392: [lldb-vscode] Fix handling of RestartRequest arguments.

Jorge Gorbe Moya via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 11 12:12:40 PDT 2023


jgorbe created this revision.
jgorbe added reviewers: clayborg, wallace, labath, rupprecht.
jgorbe added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
jgorbe requested review of this revision.

According to the spec, RestartRequest has an optional "arguments" field, which
is a RestartArguments object. RestartArguments has its own optional "arguments"
field, which is a (LaunchRequestArguments | AttachRequestArguments) object. So
we need to to the "arguments" lookup twice to get to the actual launch
arguments.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150392

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
@@ -1963,11 +1963,13 @@
 
   // The optional `arguments` field in RestartRequest can contain an updated
   // version of the launch arguments. If there's one, use it.
-  auto request_arguments = request.getObject("arguments");
-  if (request_arguments) {
-    llvm::json::Object arguments = *request_arguments;
-    (*g_vsc.last_launch_or_attach_request)["arguments"] =
-        llvm::json::Value(std::move(arguments));
+  auto restart_arguments = request.getObject("arguments");
+  if (restart_arguments) {
+    auto launch_request_arguments = restart_arguments->getObject("arguments");
+    if (launch_request_arguments) {
+      (*g_vsc.last_launch_or_attach_request)["arguments"] =
+          llvm::json::Value(llvm::json::Object(*launch_request_arguments));
+    }
   }
 
   // Keep track of the old PID so when we get a "process exited" event from the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150392.521405.patch
Type: text/x-patch
Size: 1058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230511/2a6ac56e/attachment.bin>


More information about the lldb-commits mailing list