[Lldb-commits] [lldb] [lldb][lldb-dap] Migrate ScopesRequest to structured types (PR #138116)

Ebuka Ezike via lldb-commits lldb-commits at lists.llvm.org
Mon May 12 12:40:22 PDT 2025


================
@@ -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)};
----------------
da-viper wrote:

I  think it should be only in the scoped request since nothing outside is using the functionality.

would be worth it to move it to the variables if there was another request that depends on getting all the scopes. 



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


More information about the lldb-commits mailing list