pub struct DebugAdapterPool { /* private fields */ }Expand description
Pool for managing multiple debug adapters
Implementations§
Source§impl DebugAdapterPool
impl DebugAdapterPool
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/gdb_session.rs (line 10)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 // Register the debug adapter
10 let pool = DebugAdapterPool::new();
11 pool
12 .register_adapter(
13 "cppdbg".to_string(),
14 "/usr/bin/gdb".to_string(),
15 vec!["--interpreter=dap".to_string()],
16 )
17 .await;
18
19 // Create a debug session
20 let manager = DebugManager::new();
21 let session_id = manager.create_session("main".to_string(), "cppdbg".to_string())?;
22 let session = manager.get_session(&session_id).unwrap();
23
24 // Start the adapter
25 let adapter = pool.create_session(session).await?;
26
27 // Initialize and set breakpoints
28 adapter.initialize().await?;
29 adapter
30 .set_breakpoints(
31 serde_json::json!({ "path": "/path/to/source.cpp" }),
32 vec![SourceBreakpoint {
33 line: 10,
34 column: None,
35 condition: None,
36 hit_condition: None,
37 log_message: None,
38 }],
39 )
40 .await?;
41
42 println!("Debug session initialized with breakpoints.");
43 Ok(())
44}Sourcepub async fn register_adapter(
&self,
adapter_type: String,
adapter_command: String,
adapter_args: Vec<String>,
)
pub async fn register_adapter( &self, adapter_type: String, adapter_command: String, adapter_args: Vec<String>, )
Register a debug adapter configuration
Examples found in repository?
examples/gdb_session.rs (lines 12-16)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 // Register the debug adapter
10 let pool = DebugAdapterPool::new();
11 pool
12 .register_adapter(
13 "cppdbg".to_string(),
14 "/usr/bin/gdb".to_string(),
15 vec!["--interpreter=dap".to_string()],
16 )
17 .await;
18
19 // Create a debug session
20 let manager = DebugManager::new();
21 let session_id = manager.create_session("main".to_string(), "cppdbg".to_string())?;
22 let session = manager.get_session(&session_id).unwrap();
23
24 // Start the adapter
25 let adapter = pool.create_session(session).await?;
26
27 // Initialize and set breakpoints
28 adapter.initialize().await?;
29 adapter
30 .set_breakpoints(
31 serde_json::json!({ "path": "/path/to/source.cpp" }),
32 vec![SourceBreakpoint {
33 line: 10,
34 column: None,
35 condition: None,
36 hit_condition: None,
37 log_message: None,
38 }],
39 )
40 .await?;
41
42 println!("Debug session initialized with breakpoints.");
43 Ok(())
44}Sourcepub async fn create_session(
&self,
session: DebugSession,
) -> Result<Arc<DebugAdapter>, String>
pub async fn create_session( &self, session: DebugSession, ) -> Result<Arc<DebugAdapter>, String>
Create and start a new debug session
Examples found in repository?
examples/gdb_session.rs (line 25)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 // Register the debug adapter
10 let pool = DebugAdapterPool::new();
11 pool
12 .register_adapter(
13 "cppdbg".to_string(),
14 "/usr/bin/gdb".to_string(),
15 vec!["--interpreter=dap".to_string()],
16 )
17 .await;
18
19 // Create a debug session
20 let manager = DebugManager::new();
21 let session_id = manager.create_session("main".to_string(), "cppdbg".to_string())?;
22 let session = manager.get_session(&session_id).unwrap();
23
24 // Start the adapter
25 let adapter = pool.create_session(session).await?;
26
27 // Initialize and set breakpoints
28 adapter.initialize().await?;
29 adapter
30 .set_breakpoints(
31 serde_json::json!({ "path": "/path/to/source.cpp" }),
32 vec![SourceBreakpoint {
33 line: 10,
34 column: None,
35 condition: None,
36 hit_condition: None,
37 log_message: None,
38 }],
39 )
40 .await?;
41
42 println!("Debug session initialized with breakpoints.");
43 Ok(())
44}Sourcepub async fn get_adapter(&self, session_id: &str) -> Option<Arc<DebugAdapter>>
pub async fn get_adapter(&self, session_id: &str) -> Option<Arc<DebugAdapter>>
Get an existing debug adapter
Sourcepub async fn update_state(
&self,
session_id: &str,
state: DebugState,
) -> Result<(), String>
pub async fn update_state( &self, session_id: &str, state: DebugState, ) -> Result<(), String>
Update session state
pub async fn stop_all(&self) -> Result<(), String>
Sourcepub async fn list_sessions(&self) -> Vec<String>
pub async fn list_sessions(&self) -> Vec<String>
Get list of active sessions
Sourcepub async fn get_stats(&self) -> DebugPoolStats
pub async fn get_stats(&self) -> DebugPoolStats
Get statistics
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DebugAdapterPool
impl !UnwindSafe for DebugAdapterPool
impl Freeze for DebugAdapterPool
impl Send for DebugAdapterPool
impl Sync for DebugAdapterPool
impl Unpin for DebugAdapterPool
impl UnsafeUnpin for DebugAdapterPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more