[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 14 01:16:46 PDT 2025


================
@@ -663,58 +671,65 @@ void DAP::SetTarget(const lldb::SBTarget target) {
 }
 
 bool DAP::HandleObject(const protocol::Message &M) {
-  // FIXME: Directly handle `Message` instead of serializing to JSON.
-  llvm::json::Value v = toJSON(M);
-  llvm::json::Object object = *v.getAsObject();
-  const auto packet_type = GetString(object, "type");
-  if (packet_type == "request") {
-    const auto command = GetString(object, "command");
-
-    auto new_handler_pos = request_handlers.find(command);
+  if (const auto *req = std::get_if<protocol::Request>(&M)) {
+    auto new_handler_pos = request_handlers.find(req->command);
----------------
labath wrote:

```suggestion
    auto handler_pos = request_handlers.find(req->command);
```

I think new is old now :)

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


More information about the lldb-commits mailing list