1 use super::prelude::*; 2 use crate::protocol::commands::ext::ExecFile; 3 4 impl<T: Target, C: Connection> GdbStubImpl<T, C> { handle_exec_file( &mut self, res: &mut ResponseWriter<'_, C>, target: &mut T, command: ExecFile<'_>, ) -> Result<HandlerStatus, Error<T::Error, C::Error>>5 pub(crate) fn handle_exec_file( 6 &mut self, 7 res: &mut ResponseWriter<'_, C>, 8 target: &mut T, 9 command: ExecFile<'_>, 10 ) -> Result<HandlerStatus, Error<T::Error, C::Error>> { 11 let ops = match target.support_exec_file() { 12 Some(ops) => ops, 13 None => return Ok(HandlerStatus::Handled), 14 }; 15 16 crate::__dead_code_marker!("exec_file", "impl"); 17 18 let handler_status = match command { 19 ExecFile::qXferExecFileRead(cmd) => { 20 let ret = ops 21 .get_exec_file(cmd.annex.pid, 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