c-api: add wasmtime_trap_code (#3086)
Eventually this should be added to the wasmtime-go binding, addressing https://github.com/bytecodealliance/wasmtime-go/issues/63. Added a snippet to examples/interrupt.c to verify that this works as expected in manual testing. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
This commit is contained in:
@@ -118,6 +118,10 @@ int main() {
|
||||
printf("Got a trap!...\n");
|
||||
|
||||
// `trap` can be inspected here to see the trap message has an interrupt in it
|
||||
wasmtime_trap_code_t code;
|
||||
ok = wasmtime_trap_code(trap, &code);
|
||||
assert(ok);
|
||||
assert(code == WASMTIME_TRAP_CODE_INTERRUPT);
|
||||
wasm_trap_delete(trap);
|
||||
|
||||
wasmtime_store_delete(store);
|
||||
|
||||
Reference in New Issue
Block a user