Skip to main content

DapClient

Struct DapClient 

Source
pub struct DapClient { /* private fields */ }
Expand description

High-level DAP client managing a single debug session.

Wraps DapTransport and tracks session state, capabilities, and active breakpoints.

Implementations§

Source§

impl DapClient

Source

pub fn start( config: &DapAdapterConfig, event_handler: EventHandler, ) -> Result<Self, DapError>

Spawn an adapter process and create a new client.

This only starts the child process. Call initialize afterwards to perform the DAP handshake.

§Errors

Returns DapError::BinaryNotFound if the command is not on PATH, or DapError::Io if the process fails to spawn.

Source

pub async fn initialize(&self) -> Result<(), DapError>

Perform the DAP initialize handshake.

Sends initialize, stores the adapter’s capabilities, then sends configurationDone.

§Errors

Returns DapError::InitializationFailed if the handshake fails.

Source

pub async fn launch(&self, config: Value) -> Result<(), DapError>

Launch a program under the debugger.

The adapter must have been initialized first. Sends launch followed by configurationDone.

§Errors

Returns DapError if the request fails.

Source

pub async fn attach(&self, config: Value) -> Result<(), DapError>

Attach to a running process.

§Errors

Returns DapError if the request fails.

Source

pub async fn disconnect(&self) -> Result<(), DapError>

Disconnect from the debug session.

§Errors

Returns DapError if the request fails.

Source

pub async fn terminate(&self) -> Result<(), DapError>

Terminate the debuggee.

§Errors

Returns DapError if the request fails.

Source

pub async fn set_breakpoints( &self, source_path: &str, lines: &[i64], ) -> Result<Vec<Value>, DapError>

Set breakpoints for a source file.

Returns the list of verified breakpoint objects from the adapter.

§Errors

Returns DapError if the request fails.

Source

pub async fn set_function_breakpoints( &self, names: &[String], ) -> Result<Vec<Value>, DapError>

Set function breakpoints by name.

§Errors

Returns DapError if the request fails.

Source

pub async fn set_exception_breakpoints( &self, filters: &[String], ) -> Result<(), DapError>

Set exception breakpoints by filter ID.

§Errors

Returns DapError if the request fails.

Source

pub async fn continue_execution(&self, thread_id: i64) -> Result<(), DapError>

Continue execution of the specified thread.

§Errors

Returns DapError if the request fails.

Source

pub async fn next(&self, thread_id: i64) -> Result<(), DapError>

Step over (next) for the specified thread.

§Errors

Returns DapError if the request fails.

Source

pub async fn step_in(&self, thread_id: i64) -> Result<(), DapError>

Step into for the specified thread.

§Errors

Returns DapError if the request fails.

Source

pub async fn step_out(&self, thread_id: i64) -> Result<(), DapError>

Step out for the specified thread.

§Errors

Returns DapError if the request fails.

Source

pub async fn pause(&self, thread_id: i64) -> Result<(), DapError>

Pause the specified thread.

§Errors

Returns DapError if the request fails.

Source

pub async fn threads(&self) -> Result<Vec<Value>, DapError>

List all threads in the debuggee.

§Errors

Returns DapError if the request fails.

Source

pub async fn stack_trace(&self, thread_id: i64) -> Result<Vec<Value>, DapError>

Get the stack trace for a thread.

§Errors

Returns DapError if the request fails.

Source

pub async fn scopes(&self, frame_id: i64) -> Result<Vec<Value>, DapError>

Get scopes for a stack frame.

§Errors

Returns DapError if the request fails.

Source

pub async fn variables( &self, variables_ref: i64, ) -> Result<Vec<Value>, DapError>

Get variables for a variables reference (from a scope or structured variable).

§Errors

Returns DapError if the request fails.

Source

pub async fn evaluate( &self, expression: &str, frame_id: Option<i64>, ) -> Result<Value, DapError>

Evaluate an expression in the debuggee context.

§Errors

Returns DapError if the request fails.

Source

pub async fn status(&self) -> DapSessionState

Return the current session state.

Source

pub async fn capabilities(&self) -> Option<Value>

Return the adapter capabilities received during initialization.

Source

pub const fn transport(&self) -> &Arc<DapTransport>

Return a reference to the underlying transport.

Source

pub async fn active_breakpoints(&self) -> HashMap<String, Vec<Value>>

Return active breakpoints keyed by source path.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more