Skip to content

Commit ccd664b

Browse files
authored
wasm_runtime_start_debug_instance: Don't create debug instance for AOT (#1395)
1 parent 0ec99e9 commit ccd664b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

core/iwasm/common/wasm_runtime_common.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,17 @@ wasm_runtime_is_xip_file(const uint8 *buf, uint32 size)
506506
uint32
507507
wasm_runtime_start_debug_instance(WASMExecEnv *exec_env)
508508
{
509+
WASMModuleInstanceCommon *module_inst =
510+
wasm_runtime_get_module_inst(exec_env);
509511
WASMCluster *cluster = wasm_exec_env_get_cluster(exec_env);
512+
bh_assert(module_inst);
510513
bh_assert(cluster);
511514

515+
if (module_inst->module_type != Wasm_Module_Bytecode) {
516+
LOG_WARNING("Attempt to create a debug instance for an AOT module");
517+
return 0;
518+
}
519+
512520
if (cluster->debug_inst) {
513521
LOG_WARNING("Cluster already bind to a debug instance");
514522
return cluster->debug_inst->control_thread->port;
@@ -5041,4 +5049,4 @@ wasm_runtime_get_version(uint32_t *major, uint32_t *minor, uint32_t *patch)
50415049
*major = WAMR_VERSION_MAJOR;
50425050
*minor = WAMR_VERSION_MINOR;
50435051
*patch = WAMR_VERSION_PATCH;
5044-
}
5052+
}

0 commit comments

Comments
 (0)