blob: c4bd20eaff58bffa38e7ecb12801d9cd35e4971e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
//! Create custom target-specific debugging commands accessible via GDB's
//! `monitor` command!
pub use crate::output;
pub use crate::outputln;
pub use crate::protocol::ConsoleOutput;
use crate::target::Target;
/// Target Extension - Handle custom GDB `monitor` commands.
pub trait MonitorCmd: Target {
/// Handle custom commands sent using the `monitor` command.
///
/// The GDB remote serial protocol includes a built-in mechanism to send
/// arbitrary commands to the remote stub: the `monitor` command. For
/// example, running `monitor dbg` from the GDB client will invoke
/// `handle_monitor_cmd` with `cmd = b"dbg"`.
///
/// Commands are _not_ guaranteed to be valid UTF-8, hence the use of
/// `&[u8]` as opposed to `&str`.
///
/// Intermediate console output can be written back to the GDB client using
/// the provided `ConsoleOutput` object + the
/// [`gdbstub::output!`](macro.output.html) macro.
///
/// _Note:_ The maximum length of incoming commands is limited by the size
/// of the packet buffer provided to the [`GdbStub`](struct.GdbStub.html).
/// Specifically, commands can only be up to `(buf.len() - 10) / 2` bytes.
fn handle_monitor_cmd(&mut self, cmd: &[u8], out: ConsoleOutput<'_>)
-> Result<(), Self::Error>;
}
define_ext!(MonitorCmdOps, MonitorCmd);
|