Skip to content

Commit

Permalink
remove target.xml from mips64 arch impls
Browse files Browse the repository at this point in the history
closes #97
  • Loading branch information
daniel5151 committed Feb 20, 2022
1 parent 0447d96 commit 50744be
Showing 1 changed file with 35 additions and 19 deletions.
54 changes: 35 additions & 19 deletions gdbstub_arch/src/mips/mod.rs
Expand Up @@ -39,13 +39,29 @@ impl gdbstub::arch::BreakpointKind for MipsBreakpointKind {
/// Implements `Arch` for 32-bit MIPS.
pub enum Mips {}

/// Implements `Arch` for 32-bit MIPS, with the DSP feature enabled.
pub enum MipsWithDsp {}

/// Implements `Arch` for 64-bit MIPS.
///
/// **NOTE:** Due to GDB client behavior, this arch does _not_ include a
/// built-in `target.xml` implementation. Consider manually implementing
/// [`TargetDescriptionXmlOverride`].
///
/// See [daniel5151/gdbstub#97](https://github.com/daniel5151/gdbstub/issues/97).
///
/// [`TargetDescriptionXmlOverride`]: gdbstub::target::ext::target_description_xml_override::TargetDescriptionXmlOverride
pub enum Mips64 {}

/// Implements `Arch` for 32-bit MIPS with the DSP feature enabled.
pub enum MipsWithDsp {}

/// Implements `Arch` for 64-bit MIPS with the DSP feature enabled.
/// Implements `Arch` for 64-bit MIPS, with the DSP feature enabled.
///
/// **NOTE:** Due to GDB client behavior, this arch does _not_ include a
/// built-in `target.xml` implementation. Consider manually implementing
/// [`TargetDescriptionXmlOverride`].
///
/// See [daniel5151/gdbstub#97](https://github.com/daniel5151/gdbstub/issues/97).
///
/// [`TargetDescriptionXmlOverride`]: gdbstub::target::ext::target_description_xml_override::TargetDescriptionXmlOverride
pub enum Mips64WithDsp {}

impl Arch for Mips {
Expand All @@ -64,14 +80,16 @@ impl Arch for Mips {
}
}

impl Arch for Mips64 {
type Usize = u64;
type Registers = reg::MipsCoreRegs<u64>;
type RegId = reg::id::MipsRegId<u64>;
impl Arch for MipsWithDsp {
type Usize = u32;
type Registers = reg::MipsCoreRegsWithDsp<u32>;
type RegId = reg::id::MipsRegId<u32>;
type BreakpointKind = MipsBreakpointKind;

fn target_description_xml() -> Option<&'static str> {
Some(r#"<target version="1.0"><architecture>mips64</architecture></target>"#)
Some(
r#"<target version="1.0"><architecture>mips</architecture><feature name="org.gnu.gdb.mips.dsp"></feature></target>"#,
)
}

#[inline(always)]
Expand All @@ -80,16 +98,15 @@ impl Arch for Mips64 {
}
}

impl Arch for MipsWithDsp {
type Usize = u32;
type Registers = reg::MipsCoreRegsWithDsp<u32>;
type RegId = reg::id::MipsRegId<u32>;
#[allow(deprecated)]
impl Arch for Mips64 {
type Usize = u64;
type Registers = reg::MipsCoreRegs<u64>;
type RegId = reg::id::MipsRegId<u64>;
type BreakpointKind = MipsBreakpointKind;

fn target_description_xml() -> Option<&'static str> {
Some(
r#"<target version="1.0"><architecture>mips</architecture><feature name="org.gnu.gdb.mips.dsp"></feature></target>"#,
)
None
}

#[inline(always)]
Expand All @@ -98,16 +115,15 @@ impl Arch for MipsWithDsp {
}
}

#[allow(deprecated)]
impl Arch for Mips64WithDsp {
type Usize = u64;
type Registers = reg::MipsCoreRegsWithDsp<u64>;
type RegId = reg::id::MipsRegId<u64>;
type BreakpointKind = MipsBreakpointKind;

fn target_description_xml() -> Option<&'static str> {
Some(
r#"<target version="1.0"><architecture>mips64</architecture><feature name="org.gnu.gdb.mips.dsp"></feature></target>"#,
)
None
}

#[inline(always)]
Expand Down

0 comments on commit 50744be

Please sign in to comment.