MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / check_trap

Function check_trap

examples/memory.c:89–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void check_trap(wasmtime_context_t *store, wasmtime_func_t *func,
90 const wasmtime_val_t *args, size_t nargs, size_t num_results) {
91 assert(num_results <= 1);
92 wasmtime_val_t results[1];
93 wasm_trap_t *trap = NULL;
94 wasmtime_error_t *error =
95 wasmtime_func_call(store, func, args, nargs, results, num_results, &trap);
96 if (error != NULL)
97 exit_with_error("failed to call function", error, NULL);
98 if (trap == NULL) {
99 printf("> Error on result, expected trap\n");
100 exit(1);
101 }
102 wasm_trap_delete(trap);
103}
104
105void check_trap1(wasmtime_context_t *store, wasmtime_func_t *func,
106 int32_t arg) {

Callers 2

check_trap1Function · 0.70
check_trap2Function · 0.70

Calls 3

assertFunction · 0.85
wasmtime_func_callFunction · 0.85
exit_with_errorFunction · 0.70

Tested by

no test coverage detected