[Lldb-commits] [lldb] [lldb-dap] Migrate restart request to structured types (PR #172488)

Ebuka Ezike via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 17 05:52:07 PST 2025


================
@@ -117,29 +65,21 @@ void RestartRequestHandler::operator()(
 
   // FIXME: Should we run 'preRunCommands'?
   // FIXME: Should we add a 'preRestartCommands'?
-  if (llvm::Error err = LaunchProcess(*dap.last_launch_request)) {
-    response["success"] = llvm::json::Value(false);
-    EmplaceSafeString(response, "message", llvm::toString(std::move(err)));
-    dap.SendJSON(llvm::json::Value(std::move(response)));
-    return;
-  }
+  if (llvm::Error error = LaunchProcess(*dap.last_launch_request))
+    return error;
 
   SendProcessEvent(dap, Launch);
 
   // This is normally done after receiving a "configuration done" request.
   // Because we're restarting, configuration has already happened so we can
   // continue the process right away.
   if (dap.stop_at_entry) {
-    if (llvm::Error err = SendThreadStoppedEvent(dap, /*on_entry=*/true)) {
-      EmplaceSafeString(response, "message", llvm::toString(std::move(err)));
-      dap.SendJSON(llvm::json::Value(std::move(response)));
-      return;
-    }
+    if (llvm::Error error = SendThreadStoppedEvent(dap, /*on_entry=*/true))
+      return error;
   } else {
-    dap.target.GetProcess().Continue();
+    if (lldb::SBError error = dap.target.GetProcess().Continue(); error.Fail())
+      return ToError(error);
   }
 
-  dap.SendJSON(llvm::json::Value(std::move(response)));
+  return llvm::Error::success();
----------------
da-viper wrote:

```suggestion
  if (dap.stop_at_entry)
    return SendThreadStoppedEvent(dap, /*on_entry=*/true);

  return ToError(dap.target.GetProcess().Continue());
```

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


More information about the lldb-commits mailing list