Preserve full native stack traces in errors (#823)
* Preserve full native stack traces in errors This commit builds on #759 by performing a few refactorings: * The `backtrace` crate is updated to 0.3.42 which incorporates the Windows-specific stack-walking code, so that's no longer needed. * A full `backtrace::Backtrace` type is held in a trap at all times. * The trap structures in the `wasmtime-*` internal crates were refactored a bit to preserve more information and deal with raw values rather than converting between various types and strings. * The `wasmtime::Trap` type has been updated with these various changes. Eventually I think we'll want to likely render full stack traces (and/or partial wasm ones) into error messages, but for now that's left as-is and we can always improve it later. I suspect the most relevant thing we need to do is to implement function name symbolication for wasm functions first, and then afterwards we can incorporate native function names! * Fix some test suite assertions
This commit is contained in:
@@ -9,7 +9,7 @@ use crate::memory::LinearMemory;
|
||||
use crate::mmap::Mmap;
|
||||
use crate::signalhandlers::{wasmtime_init_eager, wasmtime_init_finish};
|
||||
use crate::table::Table;
|
||||
use crate::traphandlers::{wasmtime_call, TrapMessageAndStack};
|
||||
use crate::traphandlers::{wasmtime_call, Trap};
|
||||
use crate::vmcontext::{
|
||||
VMBuiltinFunctionsArray, VMCallerCheckedAnyfunc, VMContext, VMFunctionBody, VMFunctionImport,
|
||||
VMGlobalDefinition, VMGlobalImport, VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex,
|
||||
@@ -568,7 +568,7 @@ impl Instance {
|
||||
|
||||
// Make the call.
|
||||
unsafe { wasmtime_call(callee_vmctx, callee_address) }
|
||||
.map_err(|TrapMessageAndStack(msg, _)| InstantiationError::StartTrap(msg))
|
||||
.map_err(InstantiationError::StartTrap)
|
||||
}
|
||||
|
||||
/// Invoke the WebAssembly start function of the instance, if one is present.
|
||||
@@ -1398,6 +1398,6 @@ pub enum InstantiationError {
|
||||
Link(#[from] LinkError),
|
||||
|
||||
/// A compilation error occured.
|
||||
#[error("Trap occurred while invoking start function: {0}")]
|
||||
StartTrap(String),
|
||||
#[error("Trap occurred while invoking start function")]
|
||||
StartTrap(#[source] Trap),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user