pub struct BreakpointController<Driver>where
Driver: VmiDriver,
<Driver::Architecture as Architecture>::EventReason: EventReason<Architecture = Driver::Architecture>,{ /* private fields */ }Expand description
Uses software breakpoint instructions (like INT3 on x86) to implement
breakpoints.
When a breakpoint is inserted, the memory page is marked as execute-only - meaning the guest can execute code from the page but cannot read or modify it without triggering an exception. This effectively hides the breakpoint from the guest.
When a VCPU executes the breakpoint instruction, a VmiEvent is generated
with a reason indicating a software breakpoint. The user can verify if this
event came from a breakpoint manager using
BreakpointManager::contains_by_event or BreakpointManager::get_by_event.
If a VCPU tries to read from or write to a page containing breakpoints, a
VmiEvent is generated with a memory access reason.
Read access exceptions can typically be handled by (fast-)single-stepping
the instruction in an unmodified default_view.
Write exceptions need careful consideration as they could overwrite breakpoint instructions - you can either ignore them or remove the affected breakpoint from the manager.
Implementations§
Source§impl<Driver> BreakpointController<Driver>where
Driver: VmiDriver,
<Driver::Architecture as Architecture>::EventReason: EventReason<Architecture = Driver::Architecture>,
impl<Driver> BreakpointController<Driver>where
Driver: VmiDriver,
<Driver::Architecture as Architecture>::EventReason: EventReason<Architecture = Driver::Architecture>,
Sourcepub fn is_breakpoint(
vmi: &VmiCore<Driver>,
event: &VmiEvent<Driver::Architecture>,
) -> Result<bool, VmiError>
pub fn is_breakpoint( vmi: &VmiCore<Driver>, event: &VmiEvent<Driver::Architecture>, ) -> Result<bool, VmiError>
Checks if the given event was caused by a software breakpoint.