Implement source debugging for interpreter and AOT (#769)

Implement source debugging feature for classic interpreter and AOT:
- use `cmake -DWAMR_BUILD_DEBUG_INTERP=1` to enable interpreter debugging
- use `cmake -DWAMR_BUILD_DEBUG_AOT=1` to enable AOT debugging

See doc/source_debugging.md for more details.
This commit is contained in:
Wenyong Huang
2021-09-29 13:36:46 +08:00
committed by GitHub
parent b5a67cb91e
commit 9ef37dd781
55 changed files with 10092 additions and 63 deletions

View File

@ -14,9 +14,15 @@
#endif
#if WASM_ENABLE_AOT != 0
#include "../aot/aot_runtime.h"
#if WASM_ENABLE_DEBUG_AOT != 0
#include "../aot/debug/jit_debug.h"
#endif
#endif
#if WASM_ENABLE_THREAD_MGR != 0
#include "../libraries/thread-mgr/thread_manager.h"
#if WASM_ENABLE_DEBUG_INTERP != 0
#include "../libraries/debug-engine/debug_engine.h"
#endif
#endif
#if WASM_ENABLE_SHARED_MEMORY != 0
#include "wasm_shared_memory.h"
@ -128,20 +134,29 @@ wasm_runtime_env_init()
goto fail6;
}
#endif
#if WASM_ENABLE_DEBUG_AOT != 0
if (!jit_debug_engine_init()) {
goto fail7;
}
#endif
#endif
#if WASM_ENABLE_REF_TYPES != 0
if (!wasm_externref_map_init()) {
goto fail7;
goto fail8;
}
#endif
return true;
#if WASM_ENABLE_REF_TYPES != 0
fail7:
fail8:
#endif
#if WASM_ENABLE_AOT != 0
#if WASM_ENABLE_DEBUG_AOT != 0
jit_debug_engine_destroy();
fail7:
#endif
#ifdef OS_ENABLE_HW_BOUND_CHECK
aot_signal_destroy();
fail6:
@ -201,6 +216,9 @@ wasm_runtime_destroy()
#endif
#if WASM_ENABLE_AOT != 0
#if WASM_ENABLE_DEBUG_AOT != 0
jit_debug_engine_destroy();
#endif
#ifdef OS_ENABLE_HW_BOUND_CHECK
aot_signal_destroy();
#endif
@ -220,6 +238,9 @@ wasm_runtime_destroy()
#endif
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_THREAD_MGR != 0)
#if WASM_ENABLE_DEBUG_INTERP != 0
wasm_debug_engine_destroy();
#endif
thread_manager_destroy();
#endif
@ -241,6 +262,16 @@ wasm_runtime_full_init(RuntimeInitArgs *init_args)
return false;
}
#if WASM_ENABLE_DEBUG_INTERP != 0
if (strlen(init_args->ip_addr))
if (!wasm_debug_engine_init(init_args->ip_addr,
init_args->platform_port,
init_args->instance_port)) {
wasm_runtime_destroy();
return false;
}
#endif
if (init_args->n_native_symbols > 0
&& !wasm_runtime_register_natives(init_args->native_module_name,
init_args->native_symbols,