[Lldb-commits] [lldb] [lldb-dap] Use protocol types for modules request and events. (PR #146966)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 7 09:06:03 PDT 2025
================
@@ -7,64 +7,43 @@
//===----------------------------------------------------------------------===//
#include "DAP.h"
-#include "EventHelper.h"
-#include "JSONUtils.h"
+#include "ProtocolUtils.h"
#include "RequestHandler.h"
+using namespace lldb_dap::protocol;
namespace lldb_dap {
-// "modulesRequest": {
-// "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Modules request; value of command field is
-// 'modules'.",
-// "properties": {
-// "command": {
-// "type": "string",
-// "enum": [ "modules" ]
-// },
-// },
-// "required": [ "command" ]
-// }]
-// },
-// "modulesResponse": {
-// "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to 'modules' request.",
-// "properties": {
-// "body": {
-// "description": "Response to 'modules' request. Array of
-// module objects."
-// }
-// }
-// }]
-// }
-void ModulesRequestHandler::operator()(
- const llvm::json::Object &request) const {
- llvm::json::Object response;
- FillResponse(request, response);
-
- llvm::json::Array modules;
-
- {
- std::lock_guard<std::mutex> guard(dap.modules_mutex);
- for (size_t i = 0; i < dap.target.GetNumModules(); i++) {
- lldb::SBModule module = dap.target.GetModuleAtIndex(i);
- if (!module.IsValid())
- continue;
-
- llvm::StringRef module_id = module.GetUUIDString();
- if (!module_id.empty())
- dap.modules.insert(module_id);
-
- modules.emplace_back(CreateModule(dap.target, module));
+/// Modules can be retrieved from the debug adapter with this request which can
+/// either return all modules or a range of modules to support paging.
+///
+/// Clients should only call this request if the corresponding capability
+/// `supportsModulesRequest` is true.
----------------
ashgti wrote:
+1 to splitting paging out
https://github.com/llvm/llvm-project/pull/146966
More information about the lldb-commits
mailing list