Skip to content

Commit

Permalink
Override load_elf and load_binary (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Jun 18, 2024
1 parent c51c230 commit 2b738a4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/machine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,19 @@ impl<R: Register, M: Memory<REG = R>> SupportMachine for DefaultCoreMachine<R, M
self.running = running;
}

fn load_binary(
&mut self,
program: &Bytes,
metadata: &ProgramMetadata,
update_pc: bool,
) -> Result<u64, Error> {
#[cfg(feature = "pprof")]
{
self.code = program.clone();
}
self.load_binary_inner(program, metadata, update_pc)
}

fn load_elf(&mut self, program: &Bytes, update_pc: bool) -> Result<u64, Error> {
#[cfg(feature = "pprof")]
{
Expand Down Expand Up @@ -488,6 +501,19 @@ impl<Inner: SupportMachine> SupportMachine for DefaultMachine<Inner> {
self.inner.set_running(running);
}

fn load_binary(
&mut self,
program: &Bytes,
metadata: &ProgramMetadata,
update_pc: bool,
) -> Result<u64, Error> {
self.inner.load_binary(program, metadata, update_pc)
}

fn load_elf(&mut self, program: &Bytes, update_pc: bool) -> Result<u64, Error> {
self.inner.load_elf(program, update_pc)
}

#[cfg(feature = "pprof")]
fn code(&self) -> &Bytes {
self.inner.code()
Expand Down

0 comments on commit 2b738a4

Please sign in to comment.