1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//! The message definitions used to process debugging requests from
//! `debug_worker`.
pub use virt::x86::BreakpointSize;
pub use virt::x86::BreakpointType;
pub use virt::x86::DebugState;
pub use virt::x86::HardwareBreakpoint;
pub use virt::x86::VpState;
use mesh::rpc::FailableRpc;
use mesh::MeshPayload;
#[derive(Debug, MeshPayload)]
pub enum DebugRequest {
/// The debugger has been attached.
Attach,
/// The debugger has been detached.
Detach,
/// Resume the VM, responding with a [`DebugStopReason`] once the VM encounters a stop condition (e.g: breakpoint hit)
Resume {
response: mesh::OneshotSender<DebugStopReason>,
},
/// Debugger is requesting a manual break.
Break,
/// Sets the hardware debugger state for a VP.
SetDebugState { vp: u32, state: DebugState },
/// Fetch the specified vp's register state.
GetVpState(FailableRpc<u32, Box<VpState>>),
/// Set the specified vp's register state.
SetVpState(FailableRpc<(u32, Box<VpState>), ()>),
/// Read from the specified GPA from the guest.
ReadMemory(FailableRpc<(GuestAddress, usize), Vec<u8>>),
/// Write to the specified GPA from the guest.
WriteMemory(FailableRpc<(GuestAddress, Vec<u8>), ()>),
}
/// An address within the Guest
#[derive(Debug, MeshPayload)]
pub enum GuestAddress {
/// Guest Virtual Address
Gva { vp: u32, gva: u64 },
/// Guest Physical Address
Gpa(u64),
}
#[derive(MeshPayload, Debug)]
pub enum DebugStopReason {
/// Break has been acknowledged + executed.
Break,
/// VM has powered off.
PowerOff,
/// VM has been reset.
Reset,
/// `vp` has encountered a triple fault.
TripleFault { vp: u32 },
/// `vp` has completed a single step.
SingleStep { vp: u32 },
/// `vp` has reached a hardware breakpoint.
HwBreakpoint {
vp: u32,
breakpoint: HardwareBreakpoint,
},
}