Function wasmtime_runtime::init_traps[][src]

pub fn init_traps(is_wasm_pc: fn(_: usize) -> bool)
Expand description

This function is required to be called before any WebAssembly is entered. This will configure global state such as signal handlers to prepare the process to receive wasm traps.

This function must not only be called globally once before entering WebAssembly but it must also be called once-per-thread that enters WebAssembly. Currently in wasmtime’s integration this function is called on creation of a Engine.

The is_wasm_pc argument is used when a trap happens to determine if a program counter is the pc of an actual wasm trap or not. This is then used to disambiguate faults that happen due to wasm and faults that happen due to bugs in Rust or elsewhere.