wasm_runtime_start_debug_instance: Allow to override port (#1421)

Allow the embedder to manage port number for this purpose by itself.
This commit is contained in:
YAMAMOTO Takashi
2022-08-26 17:33:47 +09:00
committed by GitHub
parent ee98b583d5
commit 3875c6649a
5 changed files with 34 additions and 10 deletions

View File

@ -507,7 +507,7 @@ wasm_runtime_is_xip_file(const uint8 *buf, uint32 size)
#if (WASM_ENABLE_THREAD_MGR != 0) && (WASM_ENABLE_DEBUG_INTERP != 0)
uint32
wasm_runtime_start_debug_instance(WASMExecEnv *exec_env)
wasm_runtime_start_debug_instance_with_port(WASMExecEnv *exec_env, int32_t port)
{
WASMModuleInstanceCommon *module_inst =
wasm_runtime_get_module_inst(exec_env);
@ -525,12 +525,18 @@ wasm_runtime_start_debug_instance(WASMExecEnv *exec_env)
return cluster->debug_inst->control_thread->port;
}
if (wasm_debug_instance_create(cluster)) {
if (wasm_debug_instance_create(cluster, port)) {
return cluster->debug_inst->control_thread->port;
}
return 0;
}
uint32
wasm_runtime_start_debug_instance(WASMExecEnv *exec_env)
{
return wasm_runtime_start_debug_instance_with_port(exec_env, -1);
}
#endif
#if WASM_ENABLE_MULTI_MODULE != 0