[source debug] refine some code in source debugging (#856)

- move the wait_cond from exec_env to debug_instance, so the debug thread can be waken up by any threads
- process more general query message from debugger
- refine debug instance create/destroy mechanism
- avoid creating debug instance during module instantiating
- avoid blocking execution thread during creating debug instance
- update related documents
This commit is contained in:
Xu Jun
2021-12-06 10:25:38 +08:00
committed by GitHub
parent c8fe1004aa
commit 2af5ae5abb
18 changed files with 401 additions and 145 deletions

View File

@ -408,6 +408,26 @@ wasm_runtime_create_exec_env(wasm_module_inst_t module_inst,
WASM_RUNTIME_API_EXTERN void
wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env);
/**
* Start debug instance based on given execution environment.
* Note:
* The debug instance will be destroyed during destroying the
* execution environment, developers don't need to destroy it
* manually.
* If the cluster of this execution environment has already
* been bound to a debug instance, this function will return true
* directly.
* If developer spawns some exec_env by wasm_runtime_spawn_exec_env,
* don't need to call this function for every spawned exec_env as
* they are sharing the same cluster with the main exec_env.
*
* @param exec_env the execution environment to start debug instance
*
* @return debug port if success, 0 otherwise.
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_runtime_start_debug_instance(wasm_exec_env_t exec_env);
/**
* Initialize thread environment.
* Note: