File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ impl target::ext::exec_file::ExecFile for Emu {
1515 let filename = b"/test.elf" ;
1616 let len = filename. len ( ) ;
1717 let data =
18- & filename[ ( offset as usize ) . min ( len) as usize ..( ( offset + length) as usize ) . min ( len) ] ;
18+ & filename[ offset. min ( len) ..( offset + length) . min ( len) ] ;
1919 let buf = & mut buf[ ..data. len ( ) ] ;
2020 buf. copy_from_slice ( data) ;
2121 Ok ( data. len ( ) )
Original file line number Diff line number Diff line change @@ -21,7 +21,10 @@ impl<'a> ParseCommand<'a> for qXferExecFileRead<'a> {
2121 }
2222
2323 let mut body = body. split ( |b| * b == b':' ) . skip ( 1 ) ;
24- let pid = decode_hex ( body. next ( ) ?) . ok ( ) . and_then ( Pid :: new) ;
24+ let pid = match body. next ( ) ? {
25+ [ ] => None ,
26+ buf => Some ( Pid :: new ( decode_hex ( buf) . ok ( ) ?) ?)
27+ }
2528
2629 let mut body = body. next ( ) ?. split ( |b| * b == b',' ) ;
2730 let offset = decode_hex ( body. next ( ) ?) . ok ( ) ?;
Original file line number Diff line number Diff line change @@ -9,11 +9,15 @@ use crate::common::Pid;
99/// I/O Extensions`](crate::target::ext::host_io), which enables the GDB client
1010/// to read the executable file directly from the target
1111pub trait ExecFile : Target {
12- /// Get full absolute name of the file that was executed to create
13- /// process `pid` running on the remote system, or the filename
14- /// corresponding to the currently executing process if no `pid` is
15- /// provided.
16- /// Store the name into `buf`, and return the length of name.
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 `length`).
19+ ///
20+ /// If `offset` is greater than the length of the underlying data, return `Ok(0)`.
1721 fn get_exec_file (
1822 & self ,
1923 pid : Option < Pid > ,
You can’t perform that action at this time.
0 commit comments