mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-18 02:59:21 +00:00
Fix debug thread not created issue (#983)
And fix a double free issue when starting debug server failed
This commit is contained in:
parent
e2403c3ee9
commit
68fd6454c2
|
@ -105,6 +105,9 @@ wasm_application_execute_main(WASMModuleInstanceCommon *module_inst, int32 argc,
|
||||||
the actual main function. Directly calling main function
|
the actual main function. Directly calling main function
|
||||||
may cause exception thrown. */
|
may cause exception thrown. */
|
||||||
if ((func = wasm_runtime_lookup_wasi_start_function(module_inst))) {
|
if ((func = wasm_runtime_lookup_wasi_start_function(module_inst))) {
|
||||||
|
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||||
|
wasm_runtime_start_debug_instance(exec_env);
|
||||||
|
#endif
|
||||||
return wasm_runtime_call_wasm(exec_env, func, 0, NULL);
|
return wasm_runtime_call_wasm(exec_env, func, 0, NULL);
|
||||||
}
|
}
|
||||||
#endif /* end of WASM_ENABLE_LIBC_WASI */
|
#endif /* end of WASM_ENABLE_LIBC_WASI */
|
||||||
|
@ -186,6 +189,10 @@ wasm_application_execute_main(WASMModuleInstanceCommon *module_inst, int32 argc,
|
||||||
(uint32)wasm_runtime_addr_native_to_app(module_inst, argv_offsets);
|
(uint32)wasm_runtime_addr_native_to_app(module_inst, argv_offsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||||
|
wasm_runtime_start_debug_instance(exec_env);
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = wasm_runtime_call_wasm(exec_env, func, argc1, argv1);
|
ret = wasm_runtime_call_wasm(exec_env, func, argc1, argv1);
|
||||||
if (ret && func_type->result_count > 0 && argc > 0 && argv)
|
if (ret && func_type->result_count > 0 && argc > 0 && argv)
|
||||||
/* copy the return value */
|
/* copy the return value */
|
||||||
|
@ -570,6 +577,10 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||||
|
wasm_runtime_start_debug_instance(exec_env);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!wasm_runtime_call_wasm(exec_env, target_func, argc1, argv1)) {
|
if (!wasm_runtime_call_wasm(exec_env, target_func, argc1, argv1)) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,7 +315,6 @@ wasm_debug_instance_create(WASMCluster *cluster)
|
||||||
|
|
||||||
if (!wasm_debug_control_thread_create(instance)) {
|
if (!wasm_debug_control_thread_create(instance)) {
|
||||||
LOG_ERROR("WASM Debug Engine error: failed to create control thread");
|
LOG_ERROR("WASM Debug Engine error: failed to create control thread");
|
||||||
wasm_runtime_free(instance);
|
|
||||||
goto fail3;
|
goto fail3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user