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