Bind Trap::i32_exit_status in C API (#1912)
This allows embedders to take a different action when a WASI program exits depending on whether it exited with an exit status or exited with a trap. cc bytecodealliance/wasmtime-py#30
This commit is contained in:
@@ -91,6 +91,18 @@ pub extern "C" fn wasm_trap_trace(raw: &wasm_trap_t, out: &mut wasm_frame_vec_t)
|
||||
out.set_buffer(vec);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasmtime_trap_exit_status(raw: &wasm_trap_t, status: &mut i32) -> bool {
|
||||
let trap = raw.trap.borrow();
|
||||
match trap.i32_exit_status() {
|
||||
Some(i) => {
|
||||
*status = i;
|
||||
true
|
||||
}
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasm_frame_func_index(frame: &wasm_frame_t) -> u32 {
|
||||
frame.trap.borrow().trace()[frame.idx].func_index()
|
||||
|
||||
Reference in New Issue
Block a user