Support dynamic aot debug (#3788)

Enable dynamic aot debug feature which debugs the aot file
and is able to set the break point and do single step. Refer to
the README for the detailed steps.

Signed-off-by: zhangliangyu3 <zhangliangyu3@xiaomi.com>
This commit is contained in:
Liangyu Zhang
2024-09-18 11:02:10 +08:00
committed by GitHub
parent e9cc8731da
commit 51a71092bf
9 changed files with 307 additions and 0 deletions

View File

@ -75,6 +75,10 @@
#define WASM_ENABLE_AOT 0
#endif
#ifndef WASM_ENABLE_DYNAMIC_AOT_DEBUG
#define WASM_ENABLE_DYNAMIC_AOT_DEBUG 0
#endif
#ifndef WASM_ENABLE_WORD_ALIGN_READ
#define WASM_ENABLE_WORD_ALIGN_READ 0
#endif

View File

@ -5072,6 +5072,18 @@ aot_const_str_set_insert(const uint8 *str, int32 len, AOTModule *module,
return c_str;
}
#if WASM_ENABLE_DYNAMIC_AOT_DEBUG != 0
AOTModule *g_dynamic_aot_module = NULL;
void __attribute__((noinline)) __enable_dynamic_aot_debug(void)
{
/* empty implementation. */
}
void (*__enable_dynamic_aot_debug_ptr)(void)
__attribute__((visibility("default"))) = __enable_dynamic_aot_debug;
#endif
bool
aot_set_module_name(AOTModule *module, const char *name, char *error_buf,
uint32_t error_buf_size)
@ -5085,6 +5097,12 @@ aot_set_module_name(AOTModule *module, const char *name, char *error_buf,
false,
#endif
error_buf, error_buf_size);
#if WASM_ENABLE_DYNAMIC_AOT_DEBUG != 0
/* export g_dynamic_aot_module for dynamic aot debug */
g_dynamic_aot_module = module;
/* trigger breakpoint __enable_dynamic_aot_debug */
(*__enable_dynamic_aot_debug_ptr)();
#endif
return module->name != NULL;
}