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 authored Jun 18, 2024
1 parent 7b4de58 commit b32522c
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 @@ -354,6 +354,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 @@ -491,6 +504,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 b32522c

Please sign in to comment.