================ @@ -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'; + + const TargetList &target_list = debugger_sp->GetTargetList(); + const size_t num_targets = target_list.GetNumTargets(); + for (size_t j = 0; j < num_targets; ++j) { + lldb::TargetSP target_sp = target_list.GetTargetAtIndex(i); + if (!target_sp) + continue; + os << " - target " << j; + if (Module *exe_module = target_sp->GetExecutableModulePointer()) + os << " " << exe_module->GetFileSpec().GetPath(); ---------------- JDevlieghere wrote:
Oh, I see what you're saying, there's a missing newline after printing the target (executable). https://github.com/llvm/llvm-project/pull/145616 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits