Skip to main content

BreakpointStore

Struct BreakpointStore 

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

Thread-safe breakpoint storage

Stores breakpoints indexed by source file path. Provides methods for setting, clearing, and retrieving breakpoints with REPLACE semantics.

Implementations§

Source§

impl BreakpointStore

Source

pub fn new() -> Self

Create a new empty breakpoint store

§Examples
use perl_dap::breakpoints::BreakpointStore;

let store = BreakpointStore::new();
Source

pub fn set_breakpoints(&self, args: &SetBreakpointsArguments) -> Vec<Breakpoint>

Set breakpoints for a source file (REPLACE semantics)

This method clears all existing breakpoints for the source file and sets the new breakpoints from the request. Each breakpoint is assigned a unique ID and verified status.

§Arguments
  • args - SetBreakpoints request arguments containing source and breakpoint list
§Returns

Array of verified breakpoints in SAME ORDER as the request.

§Examples
use perl_dap::breakpoints::BreakpointStore;
use perl_dap::protocol::{SetBreakpointsArguments, Source, SourceBreakpoint};

let store = BreakpointStore::new();
let args = SetBreakpointsArguments {
    source: Source {
        path: Some("/workspace/script.pl".to_string()),
        name: Some("script.pl".to_string()),
    },
    breakpoints: Some(vec![
        SourceBreakpoint { line: 10, column: None, condition: None, hit_condition: None, log_message: None },
        SourceBreakpoint { line: 25, column: None, condition: None, hit_condition: None, log_message: None },
    ]),
    source_modified: None,
};

let breakpoints = store.set_breakpoints(&args);
assert_eq!(breakpoints.len(), 2);
Source

pub fn get_breakpoints(&self, source_path: &str) -> Vec<BreakpointRecord>

Get all breakpoints for a source file

§Arguments
  • source_path - Absolute path to source file
§Returns

Array of breakpoint records for the source, or empty if none exist.

Source

pub fn clear_breakpoints(&self, source_path: &str)

Clear all breakpoints for a source file

§Arguments
  • source_path - Absolute path to source file
Source

pub fn clear_all(&self)

Clear all breakpoints in all source files

Source

pub fn is_empty(&self) -> bool

Check if the store is empty

Source

pub fn get_breakpoint_by_id(&self, id: i64) -> Option<BreakpointRecord>

Get breakpoint by ID across all sources

§Arguments
  • id - Unique breakpoint identifier
§Returns

Breakpoint record if found, None otherwise.

Source

pub fn register_breakpoint_hit( &self, source_path: &str, line: i64, ) -> BreakpointHitOutcome

Register a runtime breakpoint hit and return stop/logpoint behavior.

This method updates per-breakpoint hit counters and evaluates DAP hit conditions. For logpoints, execution continues after emitting output.

Source

pub fn register_breakpoint_hit_with_variables( &self, source_path: &str, line: i64, variables: Option<&HashMap<String, String>>, ) -> BreakpointHitOutcome

Register a breakpoint hit with optional variable interpolation.

Similar to register_breakpoint_hit, but accepts optional variable values for logpoint message interpolation. If variables are provided, logpoint messages with {$variable} expressions will be interpolated.

§Arguments
  • source_path - Path to the source file
  • line - Line number where the breakpoint was hit (1-based)
  • variables - Optional map of variable names to their string values
§Returns

BreakpointHitOutcome with interpolated log messages if variables provided

Source

pub fn adjust_breakpoints_for_edit( &self, source_path: &str, start_line: i64, lines_delta: i64, )

AC7.4: Adjust breakpoints for a file edit

This method shifts breakpoint lines based on content changes. It provides <1ms performance by avoiding full AST re-parsing.

§Arguments
  • source_path - Path to the modified file
  • start_line - Line where the edit started (1-based)
  • lines_delta - Number of lines added (positive) or removed (negative)

Trait Implementations§

Source§

impl Clone for BreakpointStore

Source§

fn clone(&self) -> BreakpointStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BreakpointStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BreakpointStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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