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

Sergei Druzhkov via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 16 12:55:56 PST 2025


================
@@ -737,4 +776,30 @@ llvm::json::Value toJSON(const TestGetTargetBreakpointsResponseBody &Body) {
   return result;
 }
 
+bool fromJSON(const llvm::json::Value &Params, RestartArguments &Args,
+              llvm::json::Path Path) {
+  const json::Object *O = Params.getAsObject();
+  if (!O) {
+    Path.report("expected object");
+    return false;
+  }
+  const json::Value *arguments = O->get("arguments");
+  if (arguments == nullptr)
+    return true;
+  LaunchRequestArguments launchArguments;
+  llvm::json::Path::Root root;
+  if (fromJSON(*arguments, launchArguments, root)) {
+    Args.arguments = std::move(launchArguments);
+    return true;
+  }
+  AttachRequestArguments attachArguments;
+  if (fromJSON(*arguments, attachArguments, root)) {
----------------
DrSergei wrote:

To be honest, we can skip it now. Older version assumes that it is always `launch` arguments, but new version is more type safe from my point of view.

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


More information about the lldb-commits mailing list