1mod codelldb;
2mod gdb;
3mod go;
4mod javascript;
5mod lldb;
6mod php;
7mod python;
8
9use std::{net::Ipv4Addr, sync::Arc};
10
11use anyhow::{Result, anyhow};
12use async_trait::async_trait;
13use codelldb::CodeLldbDebugAdapter;
14use dap::{
15 DapRegistry,
16 adapters::{
17 self, AdapterVersion, DapDelegate, DebugAdapter, DebugAdapterBinary, DebugAdapterName,
18 GithubRepo,
19 },
20};
21use gdb::GdbDebugAdapter;
22use go::GoDebugAdapter;
23use javascript::JsDebugAdapter;
24use lldb::LldbDebugAdapter;
25use php::PhpDebugAdapter;
26use python::PythonDebugAdapter;
27use serde_json::{Value, json};
28use task::{DebugAdapterConfig, TCPHost};
29
30pub fn init(registry: Arc<DapRegistry>) {
31 registry.add_adapter(Arc::from(CodeLldbDebugAdapter::default()));
32 registry.add_adapter(Arc::from(PythonDebugAdapter));
33 registry.add_adapter(Arc::from(PhpDebugAdapter));
34 registry.add_adapter(Arc::from(JsDebugAdapter::default()));
35 registry.add_adapter(Arc::from(LldbDebugAdapter));
36 registry.add_adapter(Arc::from(GoDebugAdapter));
37 registry.add_adapter(Arc::from(GdbDebugAdapter));
38}
39
40pub(crate) async fn configure_tcp_connection(
41 tcp_connection: TCPHost,
42) -> Result<(Ipv4Addr, u16, Option<u64>)> {
43 let host = tcp_connection.host();
44 let timeout = tcp_connection.timeout;
45
46 let port = if let Some(port) = tcp_connection.port {
47 port
48 } else {
49 dap::transport::TcpTransport::port(&tcp_connection).await?
50 };
51
52 Ok((host, port, timeout))
53}