pub struct DebugManager { /* private fields */ }Implementations§
Source§impl DebugManager
impl DebugManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/gdb_session.rs (line 20)
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 fn create_session(
&self,
name: String,
adapter_type: String,
) -> Result<String, String>
pub fn create_session( &self, name: String, adapter_type: String, ) -> Result<String, String>
Examples found in repository?
examples/gdb_session.rs (line 21)
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 fn get_session(&self, session_id: &str) -> Result<DebugSession, String>
pub fn get_session(&self, session_id: &str) -> Result<DebugSession, String>
Examples found in repository?
examples/gdb_session.rs (line 22)
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}pub fn list_sessions(&self) -> Result<Vec<DebugSession>, String>
pub fn update_session_state( &self, session_id: &str, state: DebugState, ) -> Result<(), String>
pub fn terminate_session(&self, session_id: &str) -> Result<(), String>
pub fn set_breakpoints( &self, file_path: String, breakpoints: Vec<SourceBreakpoint>, ) -> Result<(), String>
pub fn get_breakpoints( &self, file_path: &str, ) -> Result<Vec<Breakpoint>, String>
pub fn clear_breakpoints(&self, file_path: &str) -> Result<(), String>
pub fn get_all_breakpoints( &self, ) -> Result<HashMap<String, Vec<Breakpoint>>, String>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DebugManager
impl RefUnwindSafe for DebugManager
impl Send for DebugManager
impl Sync for DebugManager
impl Unpin for DebugManager
impl UnsafeUnpin for DebugManager
impl UnwindSafe for DebugManager
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