[Lldb-commits] [lldb] [lldb] Make MCP server instance global (PR #145616)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 25 09:14:08 PDT 2025
================
@@ -72,10 +80,46 @@ LLDBCommandTool::Call(const llvm::json::Value &args) {
return text_result;
}
-std::optional<llvm::json::Value> LLDBCommandTool::GetSchema() const {
+std::optional<llvm::json::Value> CommandTool::GetSchema() const {
+ llvm::json::Object id_type{{"type", "number"}};
llvm::json::Object str_type{{"type", "string"}};
- llvm::json::Object properties{{"arguments", std::move(str_type)}};
+ llvm::json::Object properties{{"debugger_id", std::move(id_type)},
+ {"arguments", std::move(str_type)}};
+ llvm::json::Array required{"debugger_id"};
llvm::json::Object schema{{"type", "object"},
- {"properties", std::move(properties)}};
+ {"properties", std::move(properties)},
+ {"required", std::move(required)}};
return schema;
}
+
+llvm::Expected<protocol::TextResult>
+DebuggerListTool::Call(const llvm::json::Value *args) {
+ llvm::json::Path::Root root;
+
+ std::string output;
+ llvm::raw_string_ostream os(output);
+
+ const size_t num_debuggers = Debugger::GetNumDebuggers();
+ for (size_t i = 0; i < num_debuggers; ++i) {
+ lldb::DebuggerSP debugger_sp = Debugger::GetDebuggerAtIndex(i);
+ if (!debugger_sp)
+ continue;
+
+ os << "- debugger " << i << '\n';
----------------
JDevlieghere wrote:
Cool, I'll add a FIXME to use that going forward.
https://github.com/llvm/llvm-project/pull/145616
More information about the lldb-commits
mailing list