From ccd664b81eefaf256afeccf83c26236e10cdc57b Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 19 Aug 2022 18:10:50 +0900 Subject: [PATCH] wasm_runtime_start_debug_instance: Don't create debug instance for AOT (#1395) --- core/iwasm/common/wasm_runtime_common.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index 60a2da74..4ee42601 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -506,9 +506,17 @@ wasm_runtime_is_xip_file(const uint8 *buf, uint32 size) uint32 wasm_runtime_start_debug_instance(WASMExecEnv *exec_env) { + WASMModuleInstanceCommon *module_inst = + wasm_runtime_get_module_inst(exec_env); WASMCluster *cluster = wasm_exec_env_get_cluster(exec_env); + bh_assert(module_inst); bh_assert(cluster); + if (module_inst->module_type != Wasm_Module_Bytecode) { + LOG_WARNING("Attempt to create a debug instance for an AOT module"); + return 0; + } + if (cluster->debug_inst) { LOG_WARNING("Cluster already bind to a debug instance"); return cluster->debug_inst->control_thread->port; @@ -5041,4 +5049,4 @@ wasm_runtime_get_version(uint32_t *major, uint32_t *minor, uint32_t *patch) *major = WAMR_VERSION_MAJOR; *minor = WAMR_VERSION_MINOR; *patch = WAMR_VERSION_PATCH; -} \ No newline at end of file +}