Backtrace WebAssembly function JIT frames (#759)

* Create backtrace

* Extend unwind information with FDE data.

* Expose backtrace via API/Trap

* wasmtime_call returns not-str

* Return Arc<JITFrameTag>

* rename frame -> function

* Fix windows crashes and unwrap UNWIND_HISTORY_TABLE

* mmaps -> entries

* pass a backtrace in ActionOutcome

* add test_trap_stack_overflow

* Update cranelift version.
This commit is contained in:
Yury Delendik
2020-01-15 13:48:24 -06:00
committed by GitHub
parent 0848a7eaaa
commit 2a50701f0a
26 changed files with 803 additions and 149 deletions

View File

@@ -6,7 +6,10 @@ use std::cmp::max;
use std::{fmt, mem, ptr, slice};
use thiserror::Error;
use wasmtime_environ::ir;
use wasmtime_runtime::{wasmtime_call_trampoline, Export, InstanceHandle, VMInvokeArgument};
use wasmtime_runtime::{
wasmtime_call_trampoline, Backtrace, Export, InstanceHandle, TrapMessageAndStack,
VMInvokeArgument,
};
/// A runtime value.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
@@ -103,6 +106,8 @@ pub enum ActionOutcome {
Trapped {
/// The trap message.
message: String,
/// Backtrace.
trace: Backtrace,
},
}
@@ -191,7 +196,7 @@ pub fn invoke(
compiler.publish_compiled_code();
// Call the trampoline.
if let Err(message) = unsafe {
if let Err(TrapMessageAndStack(message, trace)) = unsafe {
instance.with_signals_on(|| {
wasmtime_call_trampoline(
callee_vmctx,
@@ -200,7 +205,7 @@ pub fn invoke(
)
})
} {
return Ok(ActionOutcome::Trapped { message });
return Ok(ActionOutcome::Trapped { message, trace });
}
// Load the return values out of `values_vec`.