1 use super::prelude::*; 2 use crate::protocol::commands::ext::Auxv; 3 4 impl<T: Target, C: Connection> GdbStubImpl<T, C> { handle_auxv( &mut self, res: &mut ResponseWriter<'_, C>, target: &mut T, command: Auxv<'_>, ) -> Result<HandlerStatus, Error<T::Error, C::Error>>5 pub(crate) fn handle_auxv( 6 &mut self, 7 res: &mut ResponseWriter<'_, C>, 8 target: &mut T, 9 command: Auxv<'_>, 10 ) -> Result<HandlerStatus, Error<T::Error, C::Error>> { 11 let ops = match target.support_auxv() { 12 Some(ops) => ops, 13 None => return Ok(HandlerStatus::Handled), 14 }; 15 16 crate::__dead_code_marker!("auxv", "impl"); 17 18 let handler_status = match command { 19 Auxv::qXferAuxvRead(cmd) => { 20 let ret = ops 21 .get_auxv(cmd.offset, cmd.length, cmd.buf) 22 .handle_error()?; 23 if ret == 0 { 24 res.write_str("l")?; 25 } else { 26 res.write_str("m")?; 27 // TODO: add more specific error variant? 28 res.write_binary(cmd.buf.get(..ret).ok_or(Error::PacketBufferOverflow)?)?; 29 } 30 HandlerStatus::Handled 31 } 32 }; 33 34 Ok(handler_status) 35 } 36 } 37