Skip to content

Commit

Permalink
Toggle support for QStartNoAckMode
Browse files Browse the repository at this point in the history
  • Loading branch information
bet4it committed Mar 30, 2023
1 parent d69da3a commit 0fc4819
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions example_no_std/src/gdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ impl Target for DummyTarget {
target::ext::base::BaseOps::MultiThread(self)
}

// disable `QStartNoAckMode`
#[inline(always)]
fn use_no_ack_mode(&self) -> bool {
false
}

// disable X packet optimization in order to save space
#[inline(always)]
fn use_x_upcase_packet(&self) -> bool {
Expand Down
5 changes: 4 additions & 1 deletion src/stub/core_impl/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@ impl<T: Target, C: Connection> GdbStubImpl<T, C> {
res.write_str(concat!(
";vContSupported+",
";multiprocess+",
";QStartNoAckMode+",
))?;

if target.use_no_ack_mode() {
res.write_str(";QStartNoAckMode+",)?;
}

if let Some(resume_ops) = target.base_ops().resume_ops() {
let (reverse_cont, reverse_step) = match resume_ops {
ResumeOps::MultiThread(ops) => (
Expand Down
9 changes: 9 additions & 0 deletions src/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,14 @@ pub trait Target {
true
}

/// Enable/disable `QStartNoAckMode`
///
/// By default, this method returns `true`.
#[inline(always)]
fn use_no_ack_mode(&self) -> bool {
true
}

/// Whether `gdbstub` should provide a "stub" `resume` implementation on
/// targets without support for resumption.
///
Expand Down Expand Up @@ -728,6 +736,7 @@ macro_rules! impl_dyn_target {
__delegate!(fn guard_rail_single_step_gdb_behavior(&self) -> SingleStepGdbBehavior);

__delegate!(fn use_x_upcase_packet(&self) -> bool);
__delegate!(fn use_no_ack_mode(&self) -> bool);
__delegate!(fn use_resume_stub(&self) -> bool);
__delegate!(fn use_rle(&self) -> bool);
__delegate!(fn use_target_description_xml(&self) -> bool);
Expand Down

0 comments on commit 0fc4819

Please sign in to comment.