gdbstub 0.7.10

An implementation of the GDB Remote Serial Protocol in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::prelude::*;

#[derive(Debug)]
pub struct P<'a> {
    pub reg_id: usize,
    pub val: &'a [u8],
}

impl<'a> ParseCommand<'a> for P<'a> {
    #[inline(always)]
    fn from_packet(buf: PacketBuf<'a>) -> Option<Self> {
        let body = buf.into_body();
        let mut body = body.split_mut(|&b| b == b'=');
        let reg_id = decode_hex(body.next()?).ok()?;
        let val = decode_hex_buf(body.next()?).ok()?;
        Some(P { reg_id, val })
    }
}