mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-18 02:59:21 +00:00
Compare commits
5 Commits
faf5c3e781
...
d768390d6e
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d768390d6e | ||
![]() |
0e8b57d8a8 | ||
![]() |
88b5f6a535 | ||
![]() |
ac2fe552d5 | ||
![]() |
8ee9cc84e1 |
|
@ -4007,8 +4007,12 @@ aot_resolve_object_relocation_group(AOTObjectData *obj_data,
|
|||
&& (str_starts_with(relocation->symbol_name, ".LCPI")
|
||||
|| str_starts_with(relocation->symbol_name, ".LJTI")
|
||||
|| str_starts_with(relocation->symbol_name, ".LBB")
|
||||
|| str_starts_with(relocation->symbol_name,
|
||||
".Lswitch.table."))) {
|
||||
|| str_starts_with(relocation->symbol_name, ".Lswitch.table.")
|
||||
#if LLVM_VERSION_MAJOR >= 16
|
||||
/* cf. https://reviews.llvm.org/D123264 */
|
||||
|| str_starts_with(relocation->symbol_name, ".Lpcrel_hi")
|
||||
#endif
|
||||
)) {
|
||||
/* change relocation->relocation_addend and
|
||||
relocation->symbol_name */
|
||||
LLVMSectionIteratorRef contain_section;
|
||||
|
|
|
@ -383,7 +383,7 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
|
|||
|
||||
if (status == 0) {
|
||||
os_mutex_lock(&tmpbuf_lock);
|
||||
snprintf(tmpbuf, MAX_PACKET_SIZE, "W%02" PRIx32, status);
|
||||
(void)snprintf(tmpbuf, MAX_PACKET_SIZE, "W%02" PRIx32, status);
|
||||
write_packet(server, tmpbuf);
|
||||
os_mutex_unlock(&tmpbuf_lock);
|
||||
return;
|
||||
|
@ -399,18 +399,38 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
|
|||
|
||||
os_mutex_lock(&tmpbuf_lock);
|
||||
// TODO: how name a wasm thread?
|
||||
len += snprintf(tmpbuf, MAX_PACKET_SIZE,
|
||||
"T%02" PRIx32 "thread:%" PRIx64 ";name:%s;", gdb_status,
|
||||
(uint64)(uintptr_t)tid, "nobody");
|
||||
len = snprintf(tmpbuf, MAX_PACKET_SIZE,
|
||||
"T%02" PRIx32 "thread:%" PRIx64 ";name:%s;", gdb_status,
|
||||
(uint64)(uintptr_t)tid, "nobody");
|
||||
if (len < 0 || len >= MAX_PACKET_SIZE) {
|
||||
os_mutex_unlock(&tmpbuf_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tids_count > 0) {
|
||||
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "threads:");
|
||||
int n = snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "threads:");
|
||||
if (n < 0 || n >= MAX_PACKET_SIZE - len) {
|
||||
os_mutex_unlock(&tmpbuf_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
len += n;
|
||||
while (i < tids_count) {
|
||||
if (i == tids_count - 1)
|
||||
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"%" PRIx64 ";", (uint64)(uintptr_t)tids[i]);
|
||||
else
|
||||
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"%" PRIx64 ",", (uint64)(uintptr_t)tids[i]);
|
||||
if (i == tids_count - 1) {
|
||||
n = snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"%" PRIx64 ";", (uint64)(uintptr_t)tids[i]);
|
||||
}
|
||||
else {
|
||||
n = snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"%" PRIx64 ",", (uint64)(uintptr_t)tids[i]);
|
||||
}
|
||||
|
||||
if (n < 0 || n >= MAX_PACKET_SIZE - len) {
|
||||
os_mutex_unlock(&tmpbuf_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
len += n;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -427,32 +447,45 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
|
|||
/* When exception occurs, use reason:exception so the description can be
|
||||
* correctly processed by LLDB */
|
||||
uint32 exception_len = strlen(exception);
|
||||
len +=
|
||||
int n =
|
||||
snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"thread-pcs:%" PRIx64 ";00:%s;reason:%s;description:", pc,
|
||||
pc_string, "exception");
|
||||
if (n < 0 || n >= MAX_PACKET_SIZE - len) {
|
||||
os_mutex_unlock(&tmpbuf_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
len += n;
|
||||
/* The description should be encoded as HEX */
|
||||
for (i = 0; i < exception_len; i++) {
|
||||
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "%02x",
|
||||
exception[i]);
|
||||
n = snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, "%02x",
|
||||
exception[i]);
|
||||
if (n < 0 || n >= MAX_PACKET_SIZE - len) {
|
||||
os_mutex_unlock(&tmpbuf_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
len += n;
|
||||
}
|
||||
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, ";");
|
||||
|
||||
(void)snprintf(tmpbuf + len, MAX_PACKET_SIZE - len, ";");
|
||||
}
|
||||
else {
|
||||
if (status == WAMR_SIG_TRAP) {
|
||||
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc,
|
||||
pc_string, "breakpoint");
|
||||
(void)snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc,
|
||||
pc_string, "breakpoint");
|
||||
}
|
||||
else if (status == WAMR_SIG_SINGSTEP) {
|
||||
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc,
|
||||
pc_string, "trace");
|
||||
(void)snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc,
|
||||
pc_string, "trace");
|
||||
}
|
||||
else { /* status > 0 (== 0 is checked at the function beginning) */
|
||||
len += snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc,
|
||||
pc_string, "signal");
|
||||
(void)snprintf(tmpbuf + len, MAX_PACKET_SIZE - len,
|
||||
"thread-pcs:%" PRIx64 ";00:%s;reason:%s;", pc,
|
||||
pc_string, "signal");
|
||||
}
|
||||
}
|
||||
write_packet(server, tmpbuf);
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
# WARM API
|
||||
# WAMR API
|
||||
|
||||
* **Notice**: The python package `wamr.wamrapi.wamr` need python >= `3.10`.
|
||||
* **Notice**: The python package `wamr.wamrapi.wamr` requires a python version >= `3.10`.
|
||||
|
||||
## Setup
|
||||
|
||||
### Pre-requisites
|
||||
#### Install requirements
|
||||
Before proceeding it is necessary to make sure your Python environment is correctly configured. To do ths open a terminal session in this directory and perfom the following:
|
||||
|
||||
Install requirements,
|
||||
|
||||
```shell
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
|
|
|
@ -205,12 +205,3 @@ foreach(EX ${EXAMPLES})
|
|||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
find_program(VALGRIND
|
||||
valgrind
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
# run `ctest -T memcheck -V --test-dir build`
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue
Block a user