Enable source debugging feature for windows platform (#910)

- use platform independent data types in debug-engine library
- add os_socket APIs and provide windows and posix implementation
- avoid using platform related header files in non-platform layer
- use format specifiers macros for sprintf and sscanf
- change thread handle type from uint64 to korp_tid
- add lock when sending socket packet to avoid thread racing
This commit is contained in:
Xu Jun
2021-12-22 19:52:07 +08:00
committed by GitHub
parent af251e45ca
commit ccb2de35d7
21 changed files with 851 additions and 316 deletions

View File

@ -3,12 +3,8 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include <bh_log.h>
#include <handler.h>
#include <limits.h>
#include <string.h>
#include <unistd.h>
#include "bh_platform.h"
#include "handler.h"
#include "debug_engine.h"
#include "packets.h"
#include "utils.h"
@ -16,9 +12,22 @@
#define MAX_PACKET_SIZE (0x20000)
static char tmpbuf[MAX_PACKET_SIZE];
static korp_mutex tmpbuf_lock;
int
wasm_debug_handler_init()
{
return os_mutex_init(&tmpbuf_lock);
}
void
wasm_debug_handler_deinit()
{
os_mutex_destroy(&tmpbuf_lock);
}
static void
send_thread_stop_status(WASMGDBServer *server, uint32_t status, uint64_t tid);
send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid);
void
handle_generay_set(WASMGDBServer *server, char *payload)
@ -59,37 +68,40 @@ process_xfer(WASMGDBServer *server, const char *name, char *args)
if (!strcmp(name, "libraries") && !strcmp(mode, "read")) {
// TODO: how to get current wasm file name?
uint64_t addr = wasm_debug_instance_get_load_addr(
uint64 addr = wasm_debug_instance_get_load_addr(
(WASMDebugInstance *)server->thread->debug_instance);
os_mutex_lock(&tmpbuf_lock);
#if WASM_ENABLE_LIBC_WASI != 0
char objname[128];
wasm_debug_instance_get_current_object_name(
(WASMDebugInstance *)server->thread->debug_instance, objname, 128);
sprintf(tmpbuf,
"l<library-list><library name=\"%s\"><section "
"address=\"0x%lx\"/></library></library-list>",
objname, addr);
snprintf(tmpbuf, sizeof(tmpbuf),
"l<library-list><library name=\"%s\"><section "
"address=\"0x%" PRIx64 "\"/></library></library-list>",
objname, addr);
#else
sprintf(tmpbuf,
"l<library-list><library name=\"%s\"><section "
"address=\"0x%lx\"/></library></library-list>",
"nobody.wasm", addr);
snprintf(tmpbuf, sizeof(tmpbuf),
"l<library-list><library name=\"%s\"><section "
"address=\"0x%" PRIx64 "\"/></library></library-list>",
"nobody.wasm", addr);
#endif
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
}
void
porcess_wasm_local(WASMGDBServer *server, char *args)
{
int frame_index;
int local_index;
int32 frame_index;
int32 local_index;
char buf[16];
int size = 16;
int32 size = 16;
bool ret;
sprintf(tmpbuf, "E01");
if (sscanf(args, "%d;%d", &frame_index, &local_index) == 2) {
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf), "E01");
if (sscanf(args, "%" PRId32 ";%" PRId32, &frame_index, &local_index) == 2) {
ret = wasm_debug_instance_get_local(
(WASMDebugInstance *)server->thread->debug_instance, frame_index,
local_index, buf, &size);
@ -98,19 +110,22 @@ porcess_wasm_local(WASMGDBServer *server, char *args)
}
}
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
void
porcess_wasm_global(WASMGDBServer *server, char *args)
{
int frame_index;
int global_index;
int32 frame_index;
int32 global_index;
char buf[16];
int size = 16;
int32 size = 16;
bool ret;
sprintf(tmpbuf, "E01");
if (sscanf(args, "%d;%d", &frame_index, &global_index) == 2) {
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf), "E01");
if (sscanf(args, "%" PRId32 ";%" PRId32, &frame_index, &global_index)
== 2) {
ret = wasm_debug_instance_get_global(
(WASMDebugInstance *)server->thread->debug_instance, frame_index,
global_index, buf, &size);
@ -119,6 +134,7 @@ porcess_wasm_global(WASMGDBServer *server, char *args)
}
}
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
void
@ -126,6 +142,7 @@ handle_generay_query(WASMGDBServer *server, char *payload)
{
const char *name;
char *args;
char triple[256];
args = strchr(payload, ':');
if (args)
@ -134,18 +151,25 @@ handle_generay_query(WASMGDBServer *server, char *payload)
LOG_VERBOSE("%s:%s\n", __FUNCTION__, payload);
if (!strcmp(name, "C")) {
uint64_t pid, tid;
uint64 pid, tid;
pid = wasm_debug_instance_get_pid(
(WASMDebugInstance *)server->thread->debug_instance);
tid = wasm_debug_instance_get_tid(
tid = (uint64)(uintptr_t)wasm_debug_instance_get_tid(
(WASMDebugInstance *)server->thread->debug_instance);
snprintf(tmpbuf, sizeof(tmpbuf), "QCp%lx.%lx", pid, tid);
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf), "QCp%" PRIx64 ".%" PRIx64 "", pid,
tid);
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
if (!strcmp(name, "Supported")) {
sprintf(tmpbuf, "qXfer:libraries:read+;PacketSize=%x;",
MAX_PACKET_SIZE);
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf),
"qXfer:libraries:read+;PacketSize=%" PRIx32 ";",
MAX_PACKET_SIZE);
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
if (!strcmp(name, "Xfer")) {
@ -166,21 +190,24 @@ handle_generay_query(WASMGDBServer *server, char *payload)
if (!strcmp(name, "HostInfo")) {
// Todo: change vendor to Intel for outside tree
char triple[256];
mem2hex("wasm32-Ant-wasi-wasm", triple, strlen("wasm32-Ant-wasi-wasm"));
sprintf(tmpbuf,
"vendor:Ant;ostype:wasi;arch:wasm32;"
"triple:%s;endian:little;ptrsize:4;",
triple);
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf),
"vendor:Ant;ostype:wasi;arch:wasm32;"
"triple:%s;endian:little;ptrsize:4;",
triple);
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
if (!strcmp(name, "ModuleInfo")) {
write_packet(server, "");
}
if (!strcmp(name, "GetWorkingDir")) {
os_mutex_lock(&tmpbuf_lock);
if (getcwd(tmpbuf, PATH_MAX))
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
if (!strcmp(name, "QueryGDBServer")) {
write_packet(server, "");
@ -190,25 +217,29 @@ handle_generay_query(WASMGDBServer *server, char *payload)
}
if (!strcmp(name, "ProcessInfo")) {
// Todo: process id parent-pid
uint64_t pid;
uint64 pid;
pid = wasm_debug_instance_get_pid(
(WASMDebugInstance *)server->thread->debug_instance);
char triple[256];
// arch-vendor-os-env(format)
mem2hex("wasm32-Ant-wasi-wasm", triple, strlen("wasm32-Ant-wasi-wasm"));
sprintf(tmpbuf,
"pid:%lx;parent-pid:%lx;vendor:Ant;ostype:wasi;arch:wasm32;"
"triple:%s;endian:little;ptrsize:4;",
pid, pid, triple);
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf),
"pid:%" PRIx64 ";parent-pid:%" PRIx64
";vendor:Ant;ostype:wasi;arch:wasm32;"
"triple:%s;endian:little;ptrsize:4;",
pid, pid, triple);
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
if (!strcmp(name, "RegisterInfo0")) {
sprintf(
tmpbuf,
os_mutex_lock(&tmpbuf_lock);
snprintf(
tmpbuf, sizeof(tmpbuf),
"name:pc;alt-name:pc;bitsize:64;offset:0;encoding:uint;format:hex;"
"set:General Purpose Registers;gcc:16;dwarf:16;generic:pc;");
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
else if (!strncmp(name, "RegisterInfo", strlen("RegisterInfo"))) {
write_packet(server, "E45");
@ -218,16 +249,22 @@ handle_generay_query(WASMGDBServer *server, char *payload)
}
if (args && (!strcmp(name, "MemoryRegionInfo"))) {
uint64_t addr = strtol(args, NULL, 16);
uint64 addr = strtoll(args, NULL, 16);
WASMDebugMemoryInfo *mem_info = wasm_debug_instance_get_memregion(
(WASMDebugInstance *)server->thread->debug_instance, addr);
if (mem_info) {
char name_buf[256];
mem2hex(mem_info->name, name_buf, strlen(mem_info->name));
sprintf(tmpbuf, "start:%lx;size:%lx;permissions:%s;name:%s;",
(uint64)mem_info->start, mem_info->size,
mem_info->permisson, name_buf);
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf),
"start:%" PRIx64 ";size:%" PRIx64
";permissions:%s;name:%s;",
(uint64)mem_info->start, mem_info->size,
mem_info->permisson, name_buf);
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
wasm_debug_instance_destroy_memregion(
(WASMDebugInstance *)server->thread->debug_instance, mem_info);
}
@ -244,14 +281,17 @@ handle_generay_query(WASMGDBServer *server, char *payload)
}
if (args && (!strcmp(name, "WasmCallStack"))) {
uint64_t tid = strtol(args, NULL, 16);
uint64_t buf[1024 / sizeof(uint64_t)];
uint64_t count = wasm_debug_instance_get_call_stack_pcs(
(WASMDebugInstance *)server->thread->debug_instance, tid, buf,
1024 / sizeof(uint64_t));
uint64 tid = strtoll(args, NULL, 16);
uint64 buf[1024 / sizeof(uint64)];
uint32 count = wasm_debug_instance_get_call_stack_pcs(
(WASMDebugInstance *)server->thread->debug_instance,
(korp_tid)(uintptr_t)tid, buf, 1024 / sizeof(uint64));
if (count > 0) {
mem2hex((char *)buf, tmpbuf, count * sizeof(uint64_t));
os_mutex_lock(&tmpbuf_lock);
mem2hex((char *)buf, tmpbuf, count * sizeof(uint64));
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
else
write_packet(server, "");
@ -271,9 +311,11 @@ handle_generay_query(WASMGDBServer *server, char *payload)
if (!strncmp(name, "ThreadStopInfo", strlen("ThreadStopInfo"))) {
int32 prefix_len = strlen("ThreadStopInfo");
uint64 tid = strtol(name + prefix_len, NULL, 16);
uint64 tid_number = strtoll(name + prefix_len, NULL, 16);
korp_tid tid = (korp_tid)(uintptr_t)tid_number;
uint32 status;
uint32 status = wasm_debug_instance_get_thread_status(
status = wasm_debug_instance_get_thread_status(
server->thread->debug_instance, tid);
send_thread_stop_status(server, status, tid);
@ -281,37 +323,44 @@ handle_generay_query(WASMGDBServer *server, char *payload)
}
static void
send_thread_stop_status(WASMGDBServer *server, uint32_t status, uint64_t tid)
send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
{
int tids_number, len = 0, i = 0;
uint64_t tids[20];
int32 len = 0;
uint64 pc;
korp_tid tids[20];
char pc_string[17];
uint32_t gdb_status = status;
uint32 tids_count, i = 0;
uint32 gdb_status = status;
if (status == 0) {
sprintf(tmpbuf, "W%02x", status);
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf), "W%02x", status);
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
return;
}
tids_number = wasm_debug_instance_get_tids(
tids_count = wasm_debug_instance_get_tids(
(WASMDebugInstance *)server->thread->debug_instance, tids, 20);
uint64_t pc = wasm_debug_instance_get_pc(
pc = wasm_debug_instance_get_pc(
(WASMDebugInstance *)server->thread->debug_instance);
if (status == WAMR_SIG_SINGSTEP) {
gdb_status = WAMR_SIG_TRAP;
}
os_mutex_lock(&tmpbuf_lock);
// TODO: how name a wasm thread?
len +=
sprintf(tmpbuf, "T%02xthread:%lx;name:%s;", gdb_status, tid, "nobody");
if (tids_number > 0) {
len += sprintf(tmpbuf + len, "threads:");
while (i < tids_number) {
if (i == tids_number - 1)
len += sprintf(tmpbuf + len, "%lx;", tids[i]);
len += snprintf(tmpbuf, sizeof(tmpbuf), "T%02xthread:%" PRIx64 ";name:%s;",
gdb_status, (uint64)(uintptr_t)tid, "nobody");
if (tids_count > 0) {
len += snprintf(tmpbuf + len, sizeof(tmpbuf) - len, "threads:");
while (i < tids_count) {
if (i == tids_count - 1)
len += snprintf(tmpbuf + len, sizeof(tmpbuf) - len,
"%" PRIx64 ";", (uint64)(uintptr_t)tids[i]);
else
len += sprintf(tmpbuf + len, "%lx,", tids[i]);
len += snprintf(tmpbuf + len, sizeof(tmpbuf) - len,
"%" PRIx64 ",", (uint64)(uintptr_t)tids[i]);
i++;
}
}
@ -319,18 +368,22 @@ send_thread_stop_status(WASMGDBServer *server, uint32_t status, uint64_t tid)
pc_string[8 * 2] = '\0';
if (status == WAMR_SIG_TRAP) {
len += sprintf(tmpbuf + len, "thread-pcs:%lx;00:%s,reason:%s;", pc,
pc_string, "breakpoint");
len += snprintf(tmpbuf + len, sizeof(tmpbuf) - len,
"thread-pcs:%" PRIx64 ";00:%s,reason:%s;", pc,
pc_string, "breakpoint");
}
else if (status == WAMR_SIG_SINGSTEP) {
len += sprintf(tmpbuf + len, "thread-pcs:%lx;00:%s,reason:%s;", pc,
pc_string, "trace");
len += snprintf(tmpbuf + len, sizeof(tmpbuf) - len,
"thread-pcs:%" PRIx64 ";00:%s,reason:%s;", pc,
pc_string, "trace");
}
else if (status > 0) {
len += sprintf(tmpbuf + len, "thread-pcs:%lx;00:%s,reason:%s;", pc,
pc_string, "signal");
len += snprintf(tmpbuf + len, sizeof(tmpbuf) - len,
"thread-pcs:%" PRIx64 ";00:%s,reason:%s;", pc,
pc_string, "signal");
}
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
void
@ -338,7 +391,8 @@ handle_v_packet(WASMGDBServer *server, char *payload)
{
const char *name;
char *args;
uint32_t status;
uint32 status;
args = strchr(payload, ';');
if (args)
*args++ = '\0';
@ -353,8 +407,12 @@ handle_v_packet(WASMGDBServer *server, char *payload)
if (args[0] == 's' || args[0] == 'c') {
char *numstring = strchr(args, ':');
if (numstring) {
uint64 tid_number;
korp_tid tid;
*numstring++ = '\0';
uint64_t tid = strtol(numstring, NULL, 16);
tid_number = strtoll(numstring, NULL, 16);
tid = (korp_tid)(uintptr_t)tid_number;
wasm_debug_instance_set_cur_thread(
(WASMDebugInstance *)server->thread->debug_instance,
tid);
@ -383,9 +441,9 @@ handle_v_packet(WASMGDBServer *server, char *payload)
void
handle_threadstop_request(WASMGDBServer *server, char *payload)
{
uint64_t tid = wasm_debug_instance_get_tid(
korp_tid tid = wasm_debug_instance_get_tid(
(WASMDebugInstance *)server->thread->debug_instance);
uint32_t status;
uint32 status;
tid = wasm_debug_instance_wait_thread(
(WASMDebugInstance *)server->thread->debug_instance, tid, &status);
@ -398,11 +456,11 @@ handle_set_current_thread(WASMGDBServer *server, char *payload)
{
LOG_VERBOSE("%s:%s\n", __FUNCTION__, payload, payload);
if ('g' == *payload++) {
uint64_t tid;
tid = strtol(payload, NULL, 16);
uint64 tid = strtoll(payload, NULL, 16);
if (tid > 0)
wasm_debug_instance_set_cur_thread(
(WASMDebugInstance *)server->thread->debug_instance, tid);
(WASMDebugInstance *)server->thread->debug_instance,
(korp_tid)(uintptr_t)tid);
}
write_packet(server, "OK");
}
@ -410,17 +468,21 @@ handle_set_current_thread(WASMGDBServer *server, char *payload)
void
handle_get_register(WASMGDBServer *server, char *payload)
{
int i = strtol(payload, NULL, 16);
uint64 regdata;
int32 i = strtol(payload, NULL, 16);
if (i != 0) {
write_packet(server, "E01");
return;
}
uint64_t regdata = wasm_debug_instance_get_pc(
regdata = wasm_debug_instance_get_pc(
(WASMDebugInstance *)server->thread->debug_instance);
os_mutex_lock(&tmpbuf_lock);
mem2hex((void *)&regdata, tmpbuf, 8);
tmpbuf[8 * 2] = '\0';
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
void
@ -443,16 +505,20 @@ handle_get_read_binary_memory(WASMGDBServer *server, char *payload)
void
handle_get_read_memory(WASMGDBServer *server, char *payload)
{
size_t maddr, mlen;
uint64 maddr, mlen;
bool ret;
sprintf(tmpbuf, "%s", "");
if (sscanf(payload, "%zx,%zx", &maddr, &mlen) == 2) {
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf), "%s", "");
if (sscanf(payload, "%" SCNx64 ",%" SCNx64, &maddr, &mlen) == 2) {
char *buff;
if (mlen * 2 > MAX_PACKET_SIZE) {
LOG_ERROR("Buffer overflow!");
mlen = MAX_PACKET_SIZE / 2;
}
char *buff = wasm_runtime_malloc(mlen);
buff = wasm_runtime_malloc(mlen);
if (buff) {
ret = wasm_debug_instance_get_mem(
(WASMDebugInstance *)server->thread->debug_instance, maddr,
@ -464,21 +530,26 @@ handle_get_read_memory(WASMGDBServer *server, char *payload)
}
}
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
void
handle_get_write_memory(WASMGDBServer *server, char *payload)
{
size_t maddr, mlen, hex_len;
int offset, act_len;
size_t hex_len;
int32 offset, act_len;
uint64 maddr, mlen;
char *buff;
bool ret;
sprintf(tmpbuf, "%s", "");
if (sscanf(payload, "%zx,%zx:%n", &maddr, &mlen, &offset) == 2) {
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf), "%s", "");
if (sscanf(payload, "%" SCNx64 ",%" SCNx64 ":%n", &maddr, &mlen, &offset)
== 2) {
payload += offset;
hex_len = strlen(payload);
act_len = hex_len / 2 < mlen ? hex_len / 2 : mlen;
buff = wasm_runtime_malloc(act_len);
if (buff) {
hex2mem(payload, buff, act_len);
@ -486,20 +557,22 @@ handle_get_write_memory(WASMGDBServer *server, char *payload)
(WASMDebugInstance *)server->thread->debug_instance, maddr,
buff, &mlen);
if (ret) {
sprintf(tmpbuf, "%s", "OK");
snprintf(tmpbuf, sizeof(tmpbuf), "%s", "OK");
}
wasm_runtime_free(buff);
}
}
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
void
handle_add_break(WASMGDBServer *server, char *payload)
{
size_t type, addr, length;
size_t type, length;
uint64 addr;
if (sscanf(payload, "%zx,%zx,%zx", &type, &addr, &length) == 3) {
if (sscanf(payload, "%zx,%" SCNx64 ",%zx", &type, &addr, &length) == 3) {
if (type == eBreakpointSoftware) {
bool ret = wasm_debug_instance_add_breakpoint(
(WASMDebugInstance *)server->thread->debug_instance, addr,
@ -517,9 +590,10 @@ handle_add_break(WASMGDBServer *server, char *payload)
void
handle_remove_break(WASMGDBServer *server, char *payload)
{
size_t type, addr, length;
size_t type, length;
uint64 addr;
if (sscanf(payload, "%zx,%zx,%zx", &type, &addr, &length) == 3) {
if (sscanf(payload, "%zx,%" SCNx64 ",%zx", &type, &addr, &length) == 3) {
if (type == eBreakpointSoftware) {
bool ret = wasm_debug_instance_remove_breakpoint(
(WASMDebugInstance *)server->thread->debug_instance, addr,
@ -537,8 +611,8 @@ handle_remove_break(WASMGDBServer *server, char *payload)
void
handle_continue_request(WASMGDBServer *server, char *payload)
{
uint64_t tid;
uint32_t status;
korp_tid tid;
uint32 status;
wasm_debug_instance_continue(
(WASMDebugInstance *)server->thread->debug_instance);
@ -555,8 +629,8 @@ handle_continue_request(WASMGDBServer *server, char *payload)
void
handle_kill_request(WASMGDBServer *server, char *payload)
{
uint64_t tid;
uint32_t status;
korp_tid tid;
uint32 status;
wasm_debug_instance_kill(
(WASMDebugInstance *)server->thread->debug_instance);
@ -574,11 +648,8 @@ static void
handle_malloc(WASMGDBServer *server, char *payload)
{
char *args;
uint64_t size;
int map_port = MMAP_PROT_NONE;
uint64_t addr;
sprintf(tmpbuf, "%s", "E03");
uint64 addr, size;
int32 map_port = MMAP_PROT_NONE;
args = strstr(payload, ",");
if (args) {
@ -589,7 +660,10 @@ handle_malloc(WASMGDBServer *server, char *payload)
return;
}
size = strtol(payload, NULL, 16);
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf), "%s", "E03");
size = strtoll(payload, NULL, 16);
if (size > 0) {
while (*args) {
if (*args == 'r') {
@ -607,27 +681,31 @@ handle_malloc(WASMGDBServer *server, char *payload)
(WASMDebugInstance *)server->thread->debug_instance, size,
map_port);
if (addr) {
sprintf(tmpbuf, "%lx", addr);
snprintf(tmpbuf, sizeof(tmpbuf), "%" PRIx64, addr);
}
}
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
static void
handle_free(WASMGDBServer *server, char *payload)
{
uint64_t addr;
uint64 addr;
bool ret;
sprintf(tmpbuf, "%s", "E03");
addr = strtol(payload, NULL, 16);
os_mutex_lock(&tmpbuf_lock);
snprintf(tmpbuf, sizeof(tmpbuf), "%s", "E03");
addr = strtoll(payload, NULL, 16);
ret = wasm_debug_instance_ummap(
(WASMDebugInstance *)server->thread->debug_instance, addr);
if (ret) {
sprintf(tmpbuf, "%s", "OK");
snprintf(tmpbuf, sizeof(tmpbuf), "%s", "OK");
}
write_packet(server, tmpbuf);
os_mutex_unlock(&tmpbuf_lock);
}
void