1 //! Implementations for various ARM architectures. 2 3 use gdbstub::arch::Arch; 4 5 pub mod reg; 6 7 /// ARM-specific breakpoint kinds. 8 /// 9 /// Extracted from the GDB documentation at 10 /// [E.5.1.1 ARM Breakpoint Kinds](https://sourceware.org/gdb/current/onlinedocs/gdb/ARM-Breakpoint-Kinds.html#ARM-Breakpoint-Kinds) 11 #[derive(Debug)] 12 pub enum ArmBreakpointKind { 13 /// 16-bit Thumb mode breakpoint. 14 Thumb16, 15 /// 32-bit Thumb mode (Thumb-2) breakpoint. 16 Thumb32, 17 /// 32-bit ARM mode breakpoint. 18 Arm32, 19 } 20 21 impl gdbstub::arch::BreakpointKind for ArmBreakpointKind { from_usize(kind: usize) -> Option<Self>22 fn from_usize(kind: usize) -> Option<Self> { 23 let kind = match kind { 24 2 => ArmBreakpointKind::Thumb16, 25 3 => ArmBreakpointKind::Thumb32, 26 4 => ArmBreakpointKind::Arm32, 27 _ => return None, 28 }; 29 Some(kind) 30 } 31 } 32 33 /// Implements `Arch` for the ARMv4T architecture 34 pub enum Armv4t {} 35 36 impl Arch for Armv4t { 37 type Usize = u32; 38 type Registers = reg::ArmCoreRegs; 39 type RegId = reg::id::ArmCoreRegId; 40 type BreakpointKind = ArmBreakpointKind; 41 target_description_xml() -> Option<&'static str>42 fn target_description_xml() -> Option<&'static str> { 43 Some(r#"<target version="1.0"><architecture>armv4t</architecture></target>"#) 44 } 45 } 46