debug_worker/gdb/arch/x86/
mod.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Implementations for various x86 architectures.
5
6use gdbstub::arch::Arch;
7use gdbstub::arch::SingleStepGdbBehavior;
8
9pub mod reg;
10
11/// Implements `Arch` for 64-bit x86 the same way QEMU does
12#[allow(non_camel_case_types, clippy::upper_case_acronyms)]
13pub enum X86_64_QEMU {}
14
15impl Arch for X86_64_QEMU {
16    type Usize = u64;
17    type Registers = reg::X86_64CoreRegs;
18    type RegId = reg::id::X86_64CoreRegId;
19    type BreakpointKind = usize;
20
21    fn target_description_xml() -> Option<&'static str> {
22        // ExdiGdbSrv expects something that looks like QEMU's response, and
23        // QEMU uses <xi:include> tags, which cannot be modeled using the base
24        // `Arch::target_description_xml` API.
25        None
26    }
27
28    /// GDB clients unconditionally assume x86 targets support single-stepping.
29    fn single_step_gdb_behavior() -> SingleStepGdbBehavior {
30        SingleStepGdbBehavior::Required
31    }
32}
33
34pub enum I8086 {}
35
36impl Arch for I8086 {
37    type Usize = u32;
38    type Registers = reg::X86CoreRegs;
39    type RegId = ();
40    type BreakpointKind = usize;
41
42    fn target_description_xml() -> Option<&'static str> {
43        Some(include_str!("./i8086.xml").trim())
44    }
45
46    /// GDB clients unconditionally assume x86 targets support single-stepping.
47    fn single_step_gdb_behavior() -> SingleStepGdbBehavior {
48        SingleStepGdbBehavior::Required
49    }
50}