mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-14 13:41:31 +00:00
Fix potential block issue in source debugger (#1887)
Fix issue reported in #1860
This commit is contained in:
parent
622cdbefd6
commit
e696ac36d7
|
@ -1041,7 +1041,6 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst,
|
||||||
} \
|
} \
|
||||||
if (IS_WAMR_STOP_SIG(exec_env->current_status->signal_flag)) { \
|
if (IS_WAMR_STOP_SIG(exec_env->current_status->signal_flag)) { \
|
||||||
SYNC_ALL_TO_FRAME(); \
|
SYNC_ALL_TO_FRAME(); \
|
||||||
wasm_cluster_thread_stopped(exec_env); \
|
|
||||||
wasm_cluster_thread_waiting_run(exec_env); \
|
wasm_cluster_thread_waiting_run(exec_env); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -1077,7 +1076,6 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst,
|
||||||
&& exec_env->current_status->step_count++ == 1) { \
|
&& exec_env->current_status->step_count++ == 1) { \
|
||||||
exec_env->current_status->step_count = 0; \
|
exec_env->current_status->step_count = 0; \
|
||||||
SYNC_ALL_TO_FRAME(); \
|
SYNC_ALL_TO_FRAME(); \
|
||||||
wasm_cluster_thread_stopped(exec_env); \
|
|
||||||
wasm_cluster_thread_waiting_run(exec_env); \
|
wasm_cluster_thread_waiting_run(exec_env); \
|
||||||
} \
|
} \
|
||||||
goto *handle_table[*frame_ip++]; \
|
goto *handle_table[*frame_ip++]; \
|
||||||
|
@ -1094,7 +1092,6 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst,
|
||||||
&& exec_env->current_status->step_count++ == 2) { \
|
&& exec_env->current_status->step_count++ == 2) { \
|
||||||
exec_env->current_status->step_count = 0; \
|
exec_env->current_status->step_count = 0; \
|
||||||
SYNC_ALL_TO_FRAME(); \
|
SYNC_ALL_TO_FRAME(); \
|
||||||
wasm_cluster_thread_stopped(exec_env); \
|
|
||||||
wasm_cluster_thread_waiting_run(exec_env); \
|
wasm_cluster_thread_waiting_run(exec_env); \
|
||||||
} \
|
} \
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -609,17 +609,17 @@ notify_debug_instance_exit(WASMExecEnv *exec_env)
|
||||||
on_thread_exit_event(cluster->debug_inst, exec_env);
|
on_thread_exit_event(cluster->debug_inst, exec_env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
wasm_cluster_thread_stopped(WASMExecEnv *exec_env)
|
|
||||||
{
|
|
||||||
exec_env->current_status->running_status = STATUS_STOP;
|
|
||||||
notify_debug_instance(exec_env);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wasm_cluster_thread_waiting_run(WASMExecEnv *exec_env)
|
wasm_cluster_thread_waiting_run(WASMExecEnv *exec_env)
|
||||||
{
|
{
|
||||||
os_mutex_lock(&exec_env->wait_lock);
|
os_mutex_lock(&exec_env->wait_lock);
|
||||||
|
|
||||||
|
/* Wake up debugger thread after we get the lock, otherwise we may miss the
|
||||||
|
* signal from debugger thread, see
|
||||||
|
* https://github.com/bytecodealliance/wasm-micro-runtime/issues/1860 */
|
||||||
|
exec_env->current_status->running_status = STATUS_STOP;
|
||||||
|
notify_debug_instance(exec_env);
|
||||||
|
|
||||||
while (!wasm_cluster_thread_is_running(exec_env)) {
|
while (!wasm_cluster_thread_is_running(exec_env)) {
|
||||||
os_cond_wait(&exec_env->wait_cond, &exec_env->wait_lock);
|
os_cond_wait(&exec_env->wait_cond, &exec_env->wait_lock);
|
||||||
}
|
}
|
||||||
|
@ -646,16 +646,20 @@ wasm_cluster_thread_exited(WASMExecEnv *exec_env)
|
||||||
void
|
void
|
||||||
wasm_cluster_thread_continue(WASMExecEnv *exec_env)
|
wasm_cluster_thread_continue(WASMExecEnv *exec_env)
|
||||||
{
|
{
|
||||||
|
os_mutex_lock(&exec_env->wait_lock);
|
||||||
wasm_cluster_clear_thread_signal(exec_env);
|
wasm_cluster_clear_thread_signal(exec_env);
|
||||||
exec_env->current_status->running_status = STATUS_RUNNING;
|
exec_env->current_status->running_status = STATUS_RUNNING;
|
||||||
os_cond_signal(&exec_env->wait_cond);
|
os_cond_signal(&exec_env->wait_cond);
|
||||||
|
os_mutex_unlock(&exec_env->wait_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wasm_cluster_thread_step(WASMExecEnv *exec_env)
|
wasm_cluster_thread_step(WASMExecEnv *exec_env)
|
||||||
{
|
{
|
||||||
|
os_mutex_lock(&exec_env->wait_lock);
|
||||||
exec_env->current_status->running_status = STATUS_STEP;
|
exec_env->current_status->running_status = STATUS_STEP;
|
||||||
os_cond_signal(&exec_env->wait_cond);
|
os_cond_signal(&exec_env->wait_cond);
|
||||||
|
os_mutex_unlock(&exec_env->wait_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -166,9 +166,6 @@ wasm_cluster_destroy_exenv_status(WASMCurrentEnvStatus *status);
|
||||||
void
|
void
|
||||||
wasm_cluster_send_signal_all(WASMCluster *cluster, uint32 signo);
|
wasm_cluster_send_signal_all(WASMCluster *cluster, uint32 signo);
|
||||||
|
|
||||||
void
|
|
||||||
wasm_cluster_thread_stopped(WASMExecEnv *exec_env);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wasm_cluster_thread_waiting_run(WASMExecEnv *exec_env);
|
wasm_cluster_thread_waiting_run(WASMExecEnv *exec_env);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user