From a6e9703f4541cd74952bbca9ee61f9b59f58667f Mon Sep 17 00:00:00 2001 From: Bet4 <0xbet4@gmail.com> Date: Mon, 31 Jan 2022 04:35:06 +0800 Subject: [PATCH] Update `single_step_gdb_behavior` of all architectures with proper value (#95) * Update single_step_gdb_behavior of all architectures with proper value * Add back SingleStepGdbBehavior::Unknown --- gdbstub_arch/src/msp430/mod.rs | 6 ++---- gdbstub_arch/src/ppc/mod.rs | 3 +-- gdbstub_arch/src/riscv/mod.rs | 10 ++++------ src/arch.rs | 14 +------------- 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/gdbstub_arch/src/msp430/mod.rs b/gdbstub_arch/src/msp430/mod.rs index 4ef7e3ba..dd90c6ad 100644 --- a/gdbstub_arch/src/msp430/mod.rs +++ b/gdbstub_arch/src/msp430/mod.rs @@ -19,8 +19,7 @@ impl Arch for Msp430 { #[inline(always)] fn single_step_gdb_behavior() -> SingleStepGdbBehavior { - // TODO: update with proper value - SingleStepGdbBehavior::Unknown + SingleStepGdbBehavior::Required } } @@ -39,7 +38,6 @@ impl Arch for Msp430X { #[inline(always)] fn single_step_gdb_behavior() -> SingleStepGdbBehavior { - // TODO: update with proper value - SingleStepGdbBehavior::Unknown + SingleStepGdbBehavior::Required } } diff --git a/gdbstub_arch/src/ppc/mod.rs b/gdbstub_arch/src/ppc/mod.rs index 903aa7be..5351ef4a 100644 --- a/gdbstub_arch/src/ppc/mod.rs +++ b/gdbstub_arch/src/ppc/mod.rs @@ -27,7 +27,6 @@ impl Arch for PowerPcAltivec32 { #[inline(always)] fn single_step_gdb_behavior() -> SingleStepGdbBehavior { - // TODO: update with proper value - SingleStepGdbBehavior::Unknown + SingleStepGdbBehavior::Required } } diff --git a/gdbstub_arch/src/riscv/mod.rs b/gdbstub_arch/src/riscv/mod.rs index d9471e31..d5c6c679 100644 --- a/gdbstub_arch/src/riscv/mod.rs +++ b/gdbstub_arch/src/riscv/mod.rs @@ -19,13 +19,12 @@ impl Arch for Riscv32 { type BreakpointKind = usize; fn target_description_xml() -> Option<&'static str> { - Some(r#"riscv"#) + Some(r#"riscv:rv32"#) } #[inline(always)] fn single_step_gdb_behavior() -> SingleStepGdbBehavior { - // TODO: update with proper value - SingleStepGdbBehavior::Unknown + SingleStepGdbBehavior::Ignored } } @@ -36,12 +35,11 @@ impl Arch for Riscv64 { type BreakpointKind = usize; fn target_description_xml() -> Option<&'static str> { - Some(r#"riscv64"#) + Some(r#"riscv:rv64"#) } #[inline(always)] fn single_step_gdb_behavior() -> SingleStepGdbBehavior { - // TODO: update with proper value - SingleStepGdbBehavior::Unknown + SingleStepGdbBehavior::Ignored } } diff --git a/src/arch.rs b/src/arch.rs index 68d7bfda..06cb49e0 100644 --- a/src/arch.rs +++ b/src/arch.rs @@ -202,19 +202,6 @@ pub trait Arch { /// pre-init error that informs the user of the potential issues they may /// run into. /// - /// # `Unknown` implementations - /// - /// Because this method was only introduced in `gdbstub` version 0.6, there - /// are many existing `Arch` implementations in the - /// [`gdbstub_arch`](https://docs.rs/gdbstub_arch/) companion crate that - /// have not yet been tested and updated what kind of behavior they exhibit. - /// - /// These implementations currently return - /// [`SingleStepGdbBehavior::Unknown`], which will result in a pre-init - /// error that notifies users of this issue, along with imploring them - /// to be a Good Citizen and discover + upstream a proper implementation - /// of this method for their `Arch`. - /// /// # Writing a proper implementation /// /// To check whether or not a particular architecture exhibits this @@ -265,5 +252,6 @@ pub enum SingleStepGdbBehavior { Ignored, /// Unknown behavior - no one has tested this platform yet. If possible, /// please conduct a test + upstream your findings to `gdbstub_arch`. + #[doc(hidden)] Unknown, }