-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
17 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
use gdbstub::common::Pid; | ||
use gdbstub::target; | ||
use gdbstub::target::TargetResult; | ||
|
||
use crate::emu::Emu; | ||
|
||
impl target::ext::exec_file::ExecFile for Emu { | ||
fn get_exec_file(&self, _pid: Option<Pid>) -> &[u8] { | ||
b"/test.elf" | ||
fn get_exec_file(&self, _pid: Option<Pid>) -> TargetResult<&[u8], Self> { | ||
Ok(b"/test.elf") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
//! Provide exec-file path for the target. | ||
use crate::target::Target; | ||
use crate::target::{Target, TargetResult}; | ||
|
||
use crate::common::Pid; | ||
|
||
/// Target Extension - Provide current exec-file. | ||
/// | ||
/// NOTE: this extension is primarily intended to be used alongside the [`Host | ||
/// I/O Extensions`](crate::target::ext::host_io), which enables the GDB client | ||
/// to read the executable file directly from the target | ||
pub trait ExecFile: Target { | ||
/// Return the full absolute name of the file that was executed to create a | ||
/// process running on the remote system. | ||
fn get_exec_file(&self, pid: Option<Pid>) -> &[u8]; | ||
/// If no `pid` is provided, return the filename corresponding to the | ||
/// currently executing process. | ||
fn get_exec_file(&self, pid: Option<Pid>) -> TargetResult<&[u8], Self>; | ||
} | ||
|
||
define_ext!(ExecFileOps, ExecFile); |