• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(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 #[derive(Debug)]
22 pub enum VcpuDebugStatus {
23     RegValues(CoreRegs),
24     MemoryRegion(Vec<u8>),
25     CommandComplete,
26     HitBreakPoint,
27 }
28 
29 /// Pair of a vCPU ID and messages that can be sent from the vCPU to update the state to the
30 /// debugger.
31 #[derive(Debug)]
32 pub struct VcpuDebugStatusMessage {
33     pub cpu: usize,
34     pub msg: VcpuDebugStatus,
35 }
36