Skip to content

Commit

Permalink
Box Backtrace it is big. Print backtrace memory stack
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita committed Dec 4, 2021
1 parent 696e397 commit 804a454
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fuel-core/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ impl Executor {
if let Err(ref backtrace) = err {
warn!(
target = "vm",
"Execution panic {:?} on contract: 0x{:x}\nregisters: {:?}\ncall_stack: {:?}\n",
"Execution panic {:?} on contract: 0x{:x}\nregisters: {:?}\ncall_stack: {:?}\nstack\n: {}",
backtrace.error(),
backtrace.contract(),
backtrace.registers(),
backtrace.call_stack(),
hex::encode(&backtrace.memory()[..backtrace.registers()[5] as usize]), // print stack
);
}
err.map_err(|e| Error::Backtrace(e))
err.map_err(Box::new).map_err(Error::Backtrace)
} else {
vm.transact(tx).map_err(|e| e.into())
};
Expand Down Expand Up @@ -280,12 +281,12 @@ pub enum Error {
#[error("VM execution error: {0:?}")]
VmExecution(fuel_vm::prelude::InterpreterError),
#[error("Execution error with backtrace")]
Backtrace(FuelBacktrace),
Backtrace(Box<FuelBacktrace>),
}

impl From<FuelBacktrace> for Error {
fn from(e: FuelBacktrace) -> Self {
Error::Backtrace(e)
Error::Backtrace(Box::new(e))
}
}

Expand Down

0 comments on commit 804a454

Please sign in to comment.