Skip to content

Commit

Permalink
address nits
Browse files Browse the repository at this point in the history
  • Loading branch information
cczetier committed Jan 6, 2025
1 parent 4e7dcca commit c5e2ed6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/armv4t/gdb/tracepoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use gdbstub::target::ext::tracepoints::ExperimentStatus;
use gdbstub::target::ext::tracepoints::FrameDescription;
use gdbstub::target::ext::tracepoints::FrameRequest;
use gdbstub::target::ext::tracepoints::NewTracepoint;
use gdbstub::target::ext::tracepoints::TraceBuffer;
use gdbstub::target::ext::tracepoints::TraceBufferConfig;
use gdbstub::target::ext::tracepoints::Tracepoint;
use gdbstub::target::ext::tracepoints::TracepointAction;
use gdbstub::target::ext::tracepoints::TracepointItem;
Expand Down Expand Up @@ -96,7 +96,7 @@ impl target::ext::tracepoints::Tracepoints for Emu {
}
}

fn trace_buffer_configure(&mut self, _tb: TraceBuffer) -> TargetResult<(), Self> {
fn trace_buffer_configure(&mut self, _config: TraceBufferConfig) -> TargetResult<(), Self> {
// we don't collect a "real" trace buffer, so just ignore configuration
// attempts.
Ok(())
Expand Down
8 changes: 4 additions & 4 deletions src/protocol/commands/_QTBuffer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use super::prelude::*;
use crate::target::ext::tracepoints::{BufferShape, TraceBuffer};
use crate::target::ext::tracepoints::{BufferShape, TraceBufferConfig};

#[derive(Debug)]
pub struct QTBuffer(pub TraceBuffer);
pub struct QTBuffer(pub TraceBufferConfig);

impl ParseCommand<'_> for QTBuffer {
#[inline(always)]
Expand All @@ -14,15 +14,15 @@ impl ParseCommand<'_> for QTBuffer {
match opt.as_ref() {

Check failure on line 14 in src/protocol/commands/_QTBuffer.rs

View workflow job for this annotation

GitHub Actions / clippy + tests + docs

this call to `as_ref` does nothing
b"circular" => {
let shape = s.next()?;
Some(QTBuffer(TraceBuffer::Shape(match shape {
Some(QTBuffer(TraceBufferConfig::Shape(match shape {
[b'1'] => Some(BufferShape::Circular),
[b'0'] => Some(BufferShape::Linear),
_ => None,
}?)))
},
b"size" => {
let size = s.next()?;
Some(QTBuffer(TraceBuffer::Size(match size {
Some(QTBuffer(TraceBufferConfig::Size(match size {
[b'-', b'1'] => None,
i => Some(decode_hex(i).ok()?)
})))
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/commands/_QTDP.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<'a> ParseCommand<'a> for QTDP<'a> {
let body = buf.into_body();
match body {
[b':', b'-', actions @ ..] => {
let mut params = actions.splitn_mut(4, |b| matches!(*b, b':'));
let mut params = actions.splitn_mut(4, |b| *b == b':');
let number = Tracepoint(decode_hex(params.next()?).ok()?);
let addr = decode_hex_buf(params.next()?).ok()?;
let actions = params.next()?;
Expand Down
4 changes: 2 additions & 2 deletions src/target/ext/tracepoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ pub enum BufferShape {

/// Configuration for the trace buffer.
#[derive(Debug)]
pub enum TraceBuffer {
pub enum TraceBufferConfig {
/// Set the buffer's shape.
Shape(BufferShape),
/// Set the buffer's size in bytes. If None, the target should use whatever
Expand Down Expand Up @@ -502,7 +502,7 @@ pub trait Tracepoints: Target {
) -> TargetResult<Option<TracepointItem<'_, <Self::Arch as Arch>::Usize>>, Self>;

/// Reconfigure the trace buffer to include or modify an attribute.
fn trace_buffer_configure(&mut self, tb: TraceBuffer) -> TargetResult<(), Self>;
fn trace_buffer_configure(&mut self, config: TraceBufferConfig) -> TargetResult<(), Self>;

/// Return up to `len` bytes from the trace buffer, starting at `offset`.
/// The trace buffer is treated as a contiguous collection of traceframes,
Expand Down

0 comments on commit c5e2ed6

Please sign in to comment.