================
@@ -98,9 +83,15 @@ void ScopesRequestHandler::operator()(const 
llvm::json::Object &request) const {
                                              /*statics=*/true,
                                              /*in_scope_only=*/true);
   dap.variables.registers = frame.GetRegisters();
-  body.try_emplace("scopes", dap.CreateTopLevelScopes());
-  response.try_emplace("body", std::move(body));
-  dap.SendJSON(llvm::json::Value(std::move(response)));
+
+  std::vector scopes = {CreateScope("Locals", VARREF_LOCALS,
+                                    dap.variables.locals.GetSize(), false),
+                        CreateScope("Globals", VARREF_GLOBALS,
+                                    dap.variables.globals.GetSize(), false),
+                        CreateScope("Registers", VARREF_REGS,
+                                    dap.variables.registers.GetSize(), false)};
+
+  return ScopesResponseBody{std::move(scopes)};
----------------
ashgti wrote:

I almost wonder if it would make more sense for some of this to move into the 
`Variables` helper?

Maybe `llvm::Expected<std::vector<protocol::Scope>> Variables::SetFrame(SBFrame 
frame);` or a `SetFrame` and `GetScopes` helper separately.

I think the intention is for the `Variables` helper to be able to handle 
caching and managing variable lookups. We can make it a bit more aware of its 
own state by moving this over there.

How does that sound to you?


https://github.com/llvm/llvm-project/pull/138116
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to