1 // Copyright 2020 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #[cfg(target_arch = "x86_64")] 6 use gdbstub_arch::x86::reg::X86_64CoreRegs as CoreRegs; 7 use vm_memory::GuestAddress; 8 9 /// Messages that can be sent to a vCPU to set/get its state from the debugger. 10 #[derive(Clone, Debug)] 11 pub enum VcpuDebug { 12 ReadMem(GuestAddress, usize), 13 ReadRegs, 14 WriteRegs(Box<CoreRegs>), 15 WriteMem(GuestAddress, Vec<u8>), 16 EnableSinglestep, 17 SetHwBreakPoint(Vec<GuestAddress>), 18 } 19 20 /// Messages that can be sent from a vCPU to update the state to the debugger. 21 #[allow(clippy::large_enum_variant)] 22 #[derive(Debug)] 23 pub enum VcpuDebugStatus { 24 RegValues(CoreRegs), 25 MemoryRegion(Vec<u8>), 26 CommandComplete, 27 HitBreakPoint, 28 } 29 30 /// Pair of a vCPU ID and messages that can be sent from the vCPU to update the state to the 31 /// debugger. 32 #[derive(Debug)] 33 pub struct VcpuDebugStatusMessage { 34 pub cpu: usize, 35 pub msg: VcpuDebugStatus, 36 } 37