Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update single_step_gdb_behavior of all architectures with proper value #95

Merged
merged 2 commits into from
Jan 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions gdbstub_arch/src/msp430/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -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
}
}
3 changes: 1 addition & 2 deletions gdbstub_arch/src/ppc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ impl<RegIdImpl: RegId> Arch for PowerPcAltivec32<RegIdImpl> {

#[inline(always)]
fn single_step_gdb_behavior() -> SingleStepGdbBehavior {
// TODO: update with proper value
SingleStepGdbBehavior::Unknown
SingleStepGdbBehavior::Required
}
}
10 changes: 4 additions & 6 deletions gdbstub_arch/src/riscv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ impl Arch for Riscv32 {
type BreakpointKind = usize;

fn target_description_xml() -> Option<&'static str> {
Some(r#"<target version="1.0"><architecture>riscv</architecture></target>"#)
Some(r#"<target version="1.0"><architecture>riscv:rv32</architecture></target>"#)
}

#[inline(always)]
fn single_step_gdb_behavior() -> SingleStepGdbBehavior {
// TODO: update with proper value
SingleStepGdbBehavior::Unknown
SingleStepGdbBehavior::Ignored
}
}

Expand All @@ -36,12 +35,11 @@ impl Arch for Riscv64 {
type BreakpointKind = usize;

fn target_description_xml() -> Option<&'static str> {
Some(r#"<target version="1.0"><architecture>riscv64</architecture></target>"#)
Some(r#"<target version="1.0"><architecture>riscv:rv64</architecture></target>"#)
}

#[inline(always)]
fn single_step_gdb_behavior() -> SingleStepGdbBehavior {
// TODO: update with proper value
SingleStepGdbBehavior::Unknown
SingleStepGdbBehavior::Ignored
}
}
14 changes: 1 addition & 13 deletions src/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this variant would technically be a breaking API change, and given how "small" the change is, I'd rather not push out a whole new gdbstub 0.7 for that.

Instead, lets just mark this variant as #[doc(hidden)], and then I'll spin up a tracking task to remove the variant entirely whenever the next breaking release comes out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you need to release gdbstub 0.7 only for this?
You can just leave this commit in the dev/0.7 branch and release it along with all the other changes when they are done in gdbstub 0.7.
And you can release gdbstub_arch 0.2.1 for this commit. Then people won't encounter breaking API change for this even gdbstub 0.7 is released in the future.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I know all this, but this PR is targeting master, not (the currently non-existent) dev/0.7 branch.
This is a good reminder that I should set up a dev/0.7 branch now as well, and once I do that, it'd be reasonable to open a second PR that removes this variant on that branch (though given how small the change is, that's something I'd just do myself...)

Please add the #[doc(hidden)] attribute as part of this PR, so that I can push out gdbstub 0.6.1 that soft-deprecates this variant, along with pushing out gdbstub_arch 0.2.1, which includes the semantic Arch changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I add SingleStepGdbBehavior::Unknown back, although I'm really reluctant to do this.
I think it's really not necessary to push out gdbstub 0.6.1 that the only difference with 0.6.0 is #[doc(hidden)], because even if Unknown exists, nobody will use it. People won't notice it if they use the defined architecture, and if they want to create a new architecture, they will clear it is not something they need. You only need to push out gdbstub_arch 0.2.1.

That said, given that these changes would all be non-breaking and land in gdbstub_arch, it's fine to have some Unknowns for now and update things as folks have time to look into each arch.

So the first commit after gdbstub 0.6.0 is a breaking API change🙃


Fine, it's your project and you are always right. You can just revert the later commit after you create the dev/0.7 branch🙂

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I implemented the Unknown variant, I knew full well that it'd end up getting removed fairly quickly, and that I'd need to push out a new minor gdbstub_arch release, along with (possibly) a new minor gdbstub release that soft-deprecates the newly added variant.

While it may seem silly to add a feature to 0.6 that immediately gets soft deprecated, the reality is that - for my own sanity - I really just wanted to get 0.6 out the door ¯\_(ツ)_/¯

So the first commit after gdbstub 0.6.0 is a breaking API change🙃

Not super sure what you mean by that.

Of course, whatever first commit ends up in dev/0.7 will be a breaking change. That's the whole point of opening a new dev branch - to put in any new breaking changes.

It could have just as easily been the case that you disappeared for a few months, and in the meantime, someone else came along and opened a PR to add a new non-breaking protocol extension to the library, which wouldn't even require opening a new dev/0.7 branch

}