Compare commits

...

5 Commits

Author SHA1 Message Date
liang.he
d768390d6e
Merge 8ee9cc84e1 into 0e8b57d8a8 2025-05-07 13:15:34 +08:00
Chris Woods
0e8b57d8a8
More detail to python setup, and fixed small typo (#4247)
Some checks are pending
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux-sgx) (push) Waiting to run
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux-sgx) (push) Waiting to run
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $AOT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $SIMD_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $XIP_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, fast-jit, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / build (-DWAMR_BUILD_AOT=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_REF_TYPES=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_SIMD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_TAIL_CALL=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Waiting to run
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
2025-05-07 11:32:43 +08:00
YAMAMOTO Takashi
88b5f6a535
samples/wasm-c-api: remove unused valgrind detection (#4249)
- it's unused
- valgrind is basically a linux-only software.
  it isn't a good idea to make it a hard requirement.
  if we want to use valgrind, it's better to introduce
  a separate option to control it.
2025-05-07 11:32:29 +08:00
YAMAMOTO Takashi
ac2fe552d5
aot_resolve_object_relocation_group: adapt to LLVM 16 (#4250)
cf. https://reviews.llvm.org/D123264
2025-05-07 11:32:14 +08:00
liang.he@intel.com
8ee9cc84e1 fix: improve error handling of snprintf() in send_thread_stop_status()
Prevent `MAX_PACKET_SIZE - len` from overflowing.
2025-05-03 05:56:14 +00:00
4 changed files with 69 additions and 38 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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
```

View File

@ -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()