Fix dump call stack issue in interpreter (#1358)

Fix dump call stack issue in interpreter introduced by hw bound check:
the call stack isn't dumped if the exception is thrown and caught by
signal handler.
And restore the wasm stack frame to the original status after calling a
wasm function.
This commit is contained in:
Xu Jun
2022-08-08 11:15:30 +08:00
committed by GitHub
parent 0020b3ae68
commit 4b00432c1a
4 changed files with 62 additions and 0 deletions

View File

@ -1986,6 +1986,15 @@ call_wasm_with_hw_bound_check(WASMModuleInstance *module_inst,
ret = false;
}
if (wasm_get_exception(module_inst)) {
#if WASM_ENABLE_DUMP_CALL_STACK != 0
if (wasm_interp_create_call_stack(exec_env)) {
wasm_interp_dump_call_stack(exec_env, true, NULL, 0);
}
#endif
wasm_interp_restore_wasm_frame(exec_env);
}
jmpbuf_node_pop = wasm_exec_env_pop_jmpbuf(exec_env);
bh_assert(&jmpbuf_node == jmpbuf_node_pop);
if (!exec_env->jmpbuf_stack_top) {