Skip to content

Commit b32522c

Browse files
authored
Override load_elf and load_binary (#437)
1 parent 7b4de58 commit b32522c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/machine/mod.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,19 @@ impl<R: Register, M: Memory<REG = R>> SupportMachine for DefaultCoreMachine<R, M
354354
self.running = running;
355355
}
356356

357+
fn load_binary(
358+
&mut self,
359+
program: &Bytes,
360+
metadata: &ProgramMetadata,
361+
update_pc: bool,
362+
) -> Result<u64, Error> {
363+
#[cfg(feature = "pprof")]
364+
{
365+
self.code = program.clone();
366+
}
367+
self.load_binary_inner(program, metadata, update_pc)
368+
}
369+
357370
fn load_elf(&mut self, program: &Bytes, update_pc: bool) -> Result<u64, Error> {
358371
#[cfg(feature = "pprof")]
359372
{
@@ -491,6 +504,19 @@ impl<Inner: SupportMachine> SupportMachine for DefaultMachine<Inner> {
491504
self.inner.set_running(running);
492505
}
493506

507+
fn load_binary(
508+
&mut self,
509+
program: &Bytes,
510+
metadata: &ProgramMetadata,
511+
update_pc: bool,
512+
) -> Result<u64, Error> {
513+
self.inner.load_binary(program, metadata, update_pc)
514+
}
515+
516+
fn load_elf(&mut self, program: &Bytes, update_pc: bool) -> Result<u64, Error> {
517+
self.inner.load_elf(program, update_pc)
518+
}
519+
494520
#[cfg(feature = "pprof")]
495521
fn code(&self) -> &Bytes {
496522
self.inner.code()

0 commit comments

Comments
 (0)