Struct lc3_ensemble::sim::debug::BreakpointList
source · pub struct BreakpointList { /* private fields */ }Expand description
A list of breakpoints.
This works similarly to GDB breakpoints, in that creating a breakpoint gives you an ID which you can use to query or remove the breakpoint later.
Implementations§
source§impl BreakpointList
impl BreakpointList
sourcepub fn get(&self, id: u32) -> Option<&Breakpoint>
pub fn get(&self, id: u32) -> Option<&Breakpoint>
Gets an immutable reference to breakpoint with a given ID, returning None if it was already removed.
sourcepub fn get_mut(&mut self, id: u32) -> Option<&mut Breakpoint>
pub fn get_mut(&mut self, id: u32) -> Option<&mut Breakpoint>
Gets a mutable reference to breakpoint with a given ID, returning None if it was already removed.
sourcepub fn contains_key(&self, id: u32) -> bool
pub fn contains_key(&self, id: u32) -> bool
Checks if the ID is currently associated with some breakpoint.
sourcepub fn insert(&mut self, bpt: Breakpoint) -> u32
pub fn insert(&mut self, bpt: Breakpoint) -> u32
Inserts a breakpoint into the list and returns its key.
This panics if another breakpoint is added while 2^32 breakpoints are currently active.
sourcepub fn remove(&mut self, key: u32) -> Option<Breakpoint>
pub fn remove(&mut self, key: u32) -> Option<Breakpoint>
Remove breakpoint with a given ID.
If no breakpoint is present with this ID, this returns None.
sourcepub fn remove_breakpoint(
&mut self,
breakpoint: &Breakpoint
) -> Option<Breakpoint>
pub fn remove_breakpoint( &mut self, breakpoint: &Breakpoint ) -> Option<Breakpoint>
Remove breakpoint that matches a given value.
This is a utility function to remove a breakpoint by value.
If you’d like to remove by key, use BreakpointList::remove.
Note that this can only reliably remove PC, Reg, and Mem breakpoints. The remaining 3 may fail to match even if an identical breakpoint appears in the list.
sourcepub fn remove_breakpoint_by(
&mut self,
pred: impl FnMut(&mut Breakpoint) -> bool
) -> Option<Breakpoint>
pub fn remove_breakpoint_by( &mut self, pred: impl FnMut(&mut Breakpoint) -> bool ) -> Option<Breakpoint>
Remove breakpoint that matches a given predicate.
This is a utility function to remove a breakpoint by value.
If you’d like to remove by key, use BreakpointList::remove.
sourcepub fn iter(&self) -> impl Iterator<Item = (u32, &Breakpoint)>
pub fn iter(&self) -> impl Iterator<Item = (u32, &Breakpoint)>
An iterator visiting all breakpoints and their associated IDs in arbitrary order.
sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (u32, &mut Breakpoint)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (u32, &mut Breakpoint)>
An iterator visiting all breakpoints and their associated IDs in arbitrary order, with a mutable reference to each breakpoint.
sourcepub fn keys(&self) -> impl Iterator<Item = u32> + '_
pub fn keys(&self) -> impl Iterator<Item = u32> + '_
An iterator visiting all IDs in arbitrary order.
sourcepub fn values(&self) -> Values<'_, u32, Breakpoint>
pub fn values(&self) -> Values<'_, u32, Breakpoint>
An iterator visiting all breakpoints in arbitrary order.
sourcepub fn values_mut(&mut self) -> ValuesMut<'_, u32, Breakpoint>
pub fn values_mut(&mut self) -> ValuesMut<'_, u32, Breakpoint>
An iterator visiting all breakpoints in arbitrary order, with a mutable reference to each breakpoint.