Improve stack trace dump and fix coding guideline CI (#2599)

Avoid the stack traces getting mixed up together when multi-threading is enabled
by using exception_lock/unlock in dumping the call stacks.

And remove duplicated call stack dump in wasm_application.c.

Also update coding guideline CI to fix the clang-format-12 not found issue.
This commit is contained in:
Enrico Loparco
2023-09-29 04:52:54 +02:00
committed by GitHub
parent 3c17a36ccb
commit 00539620e9
8 changed files with 28 additions and 24 deletions

View File

@ -120,8 +120,7 @@ app_instance_main(wasm_module_inst_t module_inst)
const char *exception;
wasm_application_execute_main(module_inst, app_argc, app_argv);
if ((exception = wasm_runtime_get_exception(module_inst)))
printf("%s\n", exception);
exception = wasm_runtime_get_exception(module_inst);
return exception;
}
@ -977,17 +976,20 @@ main(int argc, char *argv[])
#endif
ret = 0;
const char *exception = NULL;
if (is_repl_mode) {
app_instance_repl(wasm_module_inst);
}
else if (func_name) {
if (app_instance_func(wasm_module_inst, func_name)) {
exception = app_instance_func(wasm_module_inst, func_name);
if (exception) {
/* got an exception */
ret = 1;
}
}
else {
if (app_instance_main(wasm_module_inst)) {
exception = app_instance_main(wasm_module_inst);
if (exception) {
/* got an exception */
ret = 1;
}
@ -1000,6 +1002,9 @@ main(int argc, char *argv[])
}
#endif
if (exception)
printf("%s\n", exception);
#if WASM_ENABLE_STATIC_PGO != 0 && WASM_ENABLE_AOT != 0
if (get_package_type(wasm_file_buf, wasm_file_size) == Wasm_Module_AoT
&& gen_prof_file)

View File

@ -77,8 +77,7 @@ app_instance_main(wasm_module_inst_t module_inst)
const char *exception;
wasm_application_execute_main(module_inst, app_argc, app_argv);
if ((exception = wasm_runtime_get_exception(module_inst)))
printf("%s\n", exception);
exception = wasm_runtime_get_exception(module_inst);
return exception;
}
@ -545,17 +544,20 @@ main(int argc, char *argv[])
#endif
ret = 0;
const char *exception = NULL;
if (is_repl_mode) {
app_instance_repl(wasm_module_inst);
}
else if (func_name) {
if (app_instance_func(wasm_module_inst, func_name)) {
exception = app_instance_func(wasm_module_inst, func_name);
if (exception) {
/* got an exception */
ret = 1;
}
}
else {
if (app_instance_main(wasm_module_inst)) {
exception = app_instance_main(wasm_module_inst);
if (exception) {
/* got an exception */
ret = 1;
}
@ -568,6 +570,9 @@ main(int argc, char *argv[])
}
#endif
if (exception)
printf("%s\n", exception);
#if WASM_ENABLE_DEBUG_INTERP != 0
fail4:
#endif