gdbstub/target/ext/exec_file.rs
1//! Provide exec-file path for the target.
2use crate::common::Pid;
3use crate::target::Target;
4use crate::target::TargetResult;
5
6/// Target Extension - Provide current exec-file.
7///
8/// NOTE: this extension is primarily intended to be used alongside the [`Host
9/// I/O Extensions`](crate::target::ext::host_io), which enables the GDB client
10/// to read the executable file directly from the target
11pub trait ExecFile: Target {
12 /// Get full absolute path of the file that was executed to create
13 /// process `pid` running on the remote system.
14 ///
15 /// If `pid` is `None`, return the filename corresponding to the
16 /// currently executing process.
17 ///
18 /// Return the number of bytes written into `buf` (which may be less than
19 /// `length`).
20 ///
21 /// If `offset` is greater than the length of the underlying data, return
22 /// `Ok(0)`.
23 fn get_exec_file(
24 &self,
25 pid: Option<Pid>,
26 offset: u64,
27 length: usize,
28 buf: &mut [u8],
29 ) -> TargetResult<usize, Self>;
30}
31
32define_ext!(ExecFileOps, ExecFile);