Return stack frames of crashed thread when using wasm-c-api (#2908)

When using the wasm-c-api and there's a trap, `wasm_func_call()` returns
a `wasm_trap_t *` object. No matter which thread crashes, the trap contains
the stack frames of the main thread.

With this PR, when there's an exception, the stack frames of the thread
where the exception occurs are stored into the thread cluster.
`wasm_func_call()` can then return those stack frames.
This commit is contained in:
Enrico Loparco
2024-01-11 05:13:05 +01:00
committed by GitHub
parent b21f17dd6d
commit ff25110840
4 changed files with 73 additions and 8 deletions

View File

@ -51,6 +51,13 @@ struct WASMCluster {
#if WASM_ENABLE_DEBUG_INTERP != 0
WASMDebugInstance *debug_inst;
#endif
#if WASM_ENABLE_DUMP_CALL_STACK != 0
/* When an exception occurs in a thread, the stack frames of that thread are
* saved into the cluster
*/
Vector exception_frames;
#endif
};
void