Commit Graph

87 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
212d830eb7
aot-analyzer: Fix macos build (#3589)
* macOS doesn't have -lrt.

* this program doesn't seem to require librt even on ubuntu.

build tested on macOS and ubuntu.
2024-07-02 15:25:03 +08:00
HongxiaWangSSSS
fe4ed6adf2
Fix compilation errors in aot-analyzer tool (#3584)
Corrected compilation failures due to structure changes, like AOTImportTable.
2024-07-02 11:26:13 +08:00
Benbuck Nason
3746534010
Add table type API support (#3515)
Add `wasm_runtime_get_export_table_inst` and `wasm_table_get_func_inst`,
and related wasm_table_type_get_xxx APIs.
2024-06-19 14:50:46 +08:00
Benbuck Nason
8239dd4aa7
Add wasm_export.h APIs to expose memory type (#3496)
Support to get `wasm_memory_type_t memory_type` from API
`wasm_runtime_get_import_type` and `wasm_runtime_get_export_type`,
and then get shared flag, initial page cout, maximum page count
from the memory_type:
```C
bool
wasm_memory_type_get_shared(const wasm_memory_type_t memory_type);
uint32_t
wasm_memory_type_get_init_page_count(const wasm_memory_type_t memory_type);
uint32_t
wasm_memory_type_get_max_page_count(const wasm_memory_type_t memory_type);
```
2024-06-06 09:20:24 +08:00
Wenyong Huang
a2a8b32456
Fix test-wamr-ide CI failure (#3485)
Set `moduleResolution` as `node16` in tsconfig.json.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/9296272681/job/25586420457
```
node_modules/@vscode/test-electron/out/util.d.ts(1,23): error TS1452:
'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.
```
2024-05-30 14:08:18 +08:00
liang.he
480ee02615
append_aot_to_wasm.py: Add --ver-str option to emit more info in custom section name (#3398)
``` shell
$ python3 append_aot_to_wasm.py --wasm waf.wasm --aot waf.aot -o waf.aot.wasm
$ /opt/wabt-1.0.34/bin/wasm-objdump -h waf.aot.wasm | grep wamr-aot
  Custom start=0x007520c7 end=0x00e021a0 (size=0x006b00d9) "wamr-aot"

$ python3 append_aot_to_wasm.py --wasm waf.wasm --aot waf.aot --ver-str 2.0.0 -o waf.aot.wasm
$ /opt/wabt-1.0.34/bin/wasm-objdump -h waf.aot.wasm | grep wamr-aot
  Custom start=0x007520c7 end=0x00e021a4 (size=0x006b00dd) "wamr-aot-2.0.0"
```
2024-05-08 18:06:54 +08:00
GanJingSaiyan
07eae7c424
Add aot binary analysis tool aot-analyzer (#3379)
Add aot binary analysis tool aot-analyzer, samples:

```bash
# parse example.aot, and print basic information about AoT file
$ ./aot-analyzer -i example.aot

# parse example.aot, and print the size of text section of the AoT file
$ ./aot-analyzer -t example.aot

# compare these two files, and show the difference in function size between them
$ ./aot-analyzer -c example.aot example.wasm
```

Signed-off-by: ganjing <ganjing@xiaomi.com>
2024-05-08 16:31:39 +08:00
liang.he
fef26ead3e
addr2line.py: Support sourceMappingURL section produced by emcc (#3302)
And update the debug-tools sample.
2024-04-12 11:43:40 +08:00
liang.he
4ef724bbff
Enhance wasm loading with LoadArgs and support module names (#3265)
- Add new API wasm_runtime_load_ex() in wasm_export.h
  and wasm_module_new_ex in wasm_c_api.h
- Put aot_create_perf_map() into a separated file aot_perf_map.c
- In perf.map, function names include user specified module name
- Enhance the script to help flamegraph generations
2024-04-07 15:04:35 +08:00
liang.he
202abc1937
Small enhancement on addr2line.py (#3276)
- If can't parse function name with dwarf information, use "name
  section" instead
- Add introduction about using custom section
2024-04-04 18:32:53 +08:00
liang.he
8c1269d44d
trans_wasm_func_name.py: Correct function index during translation (#3232)
Adding the N from "aot_func#N" with the import function count is the correct
wasm function index.
2024-03-18 10:32:55 +08:00
Enrico Loparco
f550feb039
Demangle function names in stack trace when using addr2line script (#3211)
Last bit missing from #3206: demangling of function names (useful for wasm
generated from Rust for instance) using `llvm-cxxfilt`.

Before this PR:
```text
0: abort
        at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/panic_abort/src/lib.rs:85
1: _ZN3std3sys4wasi14abort_internal17h50698daab05bf73bE
        at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys/wasi/mod.rs:181
2: _ZN3std7process5abort17h6bc522b6749f17cfE
        at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/process.rs:2278
3: _ZN3std5alloc8rust_oom17h452ad5ba6cebff96E
        at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/alloc.rs:364
```

After:
```text
0: abort
        at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/panic_abort/src/lib.rs:85
1: std::sys::wasi::abort_internal::h50698daab05bf73b
        at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys/wasi/mod.rs:181
2: std::process::abort::h6bc522b6749f17cf
        at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/process.rs:2278
3: std::alloc::rust_oom::h452ad5ba6cebff96
        at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/alloc.rs:364
```
2024-03-11 14:27:09 +08:00
Enrico Loparco
0e4c4799b1
Get location info from function indexes in addr2line script (#3206)
Update the `addr2line` script so that:
- line info is printed in a more convenient format, e.g.
```
0: c
        at wasm-micro-runtime/test-tools/addr2line/trap.c:5:1
1: b
        at wasm-micro-runtime/test-tools/addr2line/trap.c:11:12
2: a
        at wasm-micro-runtime/test-tools/addr2line/trap.c:17:12
```
similar to how Rust prints stack traces when there's a panic. In an IDE, the user
can conveniently click on the printed path and be redirected to the file line.
- a new `--no-addr` argument can be provided to the script 

It can be used in fast interpreter mode (that is not supported by the script otherwise)
or with older wamr versions (where the stack trace only had the function index info
and not the function address). In that case, `wasm-objdump` is used to get the function
name from the index and `llvm-dwarfdump` to obtain the location info (where the line
refers to the start of the function).
2024-03-08 10:20:04 +08:00
liang.he
d555c16d11
Revert PR #3194 (#3199)
- Address values in call stack dump are relative to file beginning
- If running under fast-interp mode, address values are relative to
  every pre-compiled function beginning, which is not compatible
  with addr2line
2024-03-05 18:13:33 +08:00
liang.he
1b9fbb162f
addr2line.py: Fix issue of applying offset in call stacks information (#3194)
The offset value is based on the start of the wasm file, it also equals to
the value of `wasm-objdump -d <wasm_file>`.
2024-03-01 10:56:36 +08:00
TianlongLiang
0fa0beba94
VSCode IDE enhancement and readme update (#3172)
- Temporarily disable the deque test for the VS Code extension, as the
  Rust formatter seems to malfunction after a recent VS Code update.
- Add configuration for iwasm host managed heap size, allowing users
  to flexibly `malloc` memory. This also fixes the current bug that when
  default size is 0, it can't run and debug.
- Apply coding style formatting for WAMR IDE source code and add a
  format check for it in CI.
- Update document and some screenshots.
2024-02-22 12:36:49 +08:00
Wenyong Huang
63cd567b3f
Separate app-manager and app-framework from WAMR (#3129)
As planned, the app-manager and app-framework are to be migrated to
https://github.com/bytecodealliance/wamr-app-framework.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2329
https://github.com/bytecodealliance/wasm-micro-runtime/wiki/TSC-meeting-notes
2024-02-20 18:12:36 +08:00
Wenyong Huang
16a4d71b34
Implement GC (Garbage Collection) feature for interpreter, AOT and LLVM-JIT (#3125)
Implement the GC (Garbage Collection) feature for interpreter mode,
AOT mode and LLVM-JIT mode, and support most features of the latest
spec proposal, and also enable the stringref feature.

Use `cmake -DWAMR_BUILD_GC=1/0` to enable/disable the feature,
and `wamrc --enable-gc` to generate the AOT file with GC supported.

And update the AOT file version from 2 to 3 since there are many AOT
ABI breaks, including the changes of AOT file format, the changes of
AOT module/memory instance layouts, the AOT runtime APIs for the
AOT code to invoke and so on.
2024-02-06 20:47:11 +08:00
liang.he
38019f273a
Append .aot to .wasm as a custom section named "aot" (#2933)
As a pre_compiled wasm plugin for Envoy:
https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/wasm/v3/wasm.proto
2024-01-02 10:30:41 +08:00
liang.he
22c5c90340
Fix a bug that appends '_precheck' to aot_func (#2936) 2023-12-28 22:38:12 +08:00
liang.he
40b430fd24
Add a script to translate jitted function names in flamegraph (#2906) 2023-12-21 10:57:58 +08:00
Cengizhan Pasaoglu
45a4e774de
Upgrade cJSON version to v1.7.16 (#2404) 2023-07-31 18:14:50 +08:00
Ben Riegel
72fc872afe
wamr-ide: Add vscode extension tests (#2292)
This PR adds tests for #2219 by changing the `compilation_on_android_ubuntu.yml` workflow.
The first run will take about two hours, since LLDB is built from scratch. Later, the build is
cached and the whole job should not take more than three minutes.

Core of the PR is an integration test that boots up vscode and lets it debug a test WASM file.
2023-06-20 15:33:01 +08:00
Ben Riegel
fca81fcd98
Add Rust Formatters to Debugger (Vector, Map etc.) (#2219)
This PR adds LLDB formatters so that variables are human-readable when debugging
Rust code in VS Code. This includes Tuple, Slice, String, Vector, Map, Enum etc.

It also distributes a standalone Python version with LLDB. This solution enables high
portability, so Ubuntu 20.04 and 22.04 can for example still be supported with the
same build since glibc is statically linked in the Python build, also making it easier to
support more operating systems in the future.

Known Issues: Enum types are not displayed correctly. 

For more details, refer to:
https://github.com/bytecodealliance/wasm-micro-runtime/pull/2219
2023-06-14 19:53:51 +08:00
Ben
ff0752b4ff
Fix wamr-ide debugger ignoring launch config (#2155)
The `DebugConfigurationProvider` was overwriting configurations provided
in `launch.json`. In particular, this for example prevented from specifying a
custom port for the debugger.

Example `launch.json`
```
{
    "configurations": [
        {
            "type": "wamr-debug",
            "request": "attach",
            "name": "Attach Debugger",
            "stopOnEntry": true,
            "attachCommands": [
                "process connect -p wasm connect://127.0.0.1:1237"
            ]
        }
    ]
}
```

Co-authored-by: Ben Riegel <benjuri@amazon.com>
2023-05-10 12:47:43 +08:00
YAMAMOTO Takashi
8abb153546
VSCode-Extension: Download lldb built for ubuntu 20.04 (#2139)
This should allow users to use the vscode extension on ubuntu 20.04.

After https://github.com/bytecodealliance/wasm-micro-runtime/pull/2132 ,
our lldb binary for 20.04 works on ubuntu 22.04 as well.

On the other hand, lldb for 22.04 has no chance to work on ubuntu 20.04.
(because of glibc version requirement.)
2023-04-23 14:33:52 +08:00
Wenyong Huang
6af87855b4
Update version number and release notes (#2103)
And restore the CI vsce publish and change the wamride publisher name.
2023-04-04 12:13:40 +08:00
Wang Ning
0a7994ac0a
wamr-ide: Modify Dockerfile to update base image version and fix build bug (#2068) 2023-03-28 14:21:32 +08:00
liang.he
d0fb2716b6
Fix several issues in CI binary releasing (#2064) 2023-03-26 12:19:45 +08:00
Wenyong Huang
27e7e160af
Upgrade toolkits (#1878)
Upgrade the version of related toolkits:
- upgrade llvm to 15.0
- upgrade wasi-sdk to 19.0
- upgrade emsdk to 3.1.28
- upgrade wabt to 1.0.31
- upgrade binaryen to 111

And upgrade the CI scripts, sample workload build scripts, Dockerfiles, and documents.
2023-02-02 09:42:25 +08:00
Wang Ning
45c003e6e4
Add docker images auto check and setup support for WAMR-IDE (#1882)
1. Add docker images auto check and setup support for WAMR-IDE
2. Fix bug that the code goes on when user skips install
2023-01-29 09:41:03 +08:00
Qiang
4cd88a96d5
Add more types and APIs for attr_container (#1841)
Add more types for attr_container, e.g. uint8, uint32, uint64
Add more APIs for attr_container for int8, int16 and int32 types
Rename fields of the union 'jvalue' and refactor some files that use attr_container
2023-01-09 21:05:30 +08:00
Fadumina
df4b135086
Add WAMR-IDE vscode extension to the Visual Studio Marketplace (#1868)
Publish an extension to the visual studio marketplace using a secret token.
This allows for automation to take place because downloading and installing
the extension is a manual process so it'd be simpler if the extension was
published automatically through the visual studio marketplace.
2023-01-09 18:23:37 +08:00
Wang Ning
679a8ab3cb
Perfect the codebase for wamr-ide (#1817)
Fix errors and warnings reported by eslint
Add CONTRIBUTING document for vscode-extension
2022-12-27 15:04:36 +08:00
TianlongLiang
6fd8001eb6
Update CIs and documents to make naming of generated binaries consistent (#1823) 2022-12-24 09:17:39 +08:00
Wenyong Huang
fb8727ba68
Update release notes and fix issues reported by Coverity (#1813) 2022-12-16 14:16:58 +08:00
TianlongLiang
d0c4c7036b
vscode-extension: Run docker image with the same version as WAMR (#1815) 2022-12-16 14:15:32 +08:00
Wenyong Huang
97d2b5a060
Publish the docker image with tar/zip files (#1808)
And fix issue found in fast jit call indirect.
2022-12-14 09:42:03 +08:00
Callum Macmillan
6eaf779a2d
Install patched LLDB on vscode extension activation (#1637)
Download and install the WAMR patched LLDB binary on vscode extension activation.

This allows the user to download the packaged .vsix file, where the activation script
should handle determining what LLDB binary they should use, and install it in the
correct location.
2022-12-01 10:39:14 +08:00
TrellixVulnTeam
7ad3412591
Adding tarfile member sanitization to extractall() (#1709)
Fix a widespread bug named CVE-2007-4559, which is a 15 year old bug
in the Python tarfile package. By using extract() or extractall() on a tarfile
object without sanitizing input, a maliciously crafted .tar file could
perform a directory path traversal attack. This patch essentially checks to
see if all tarfile members will be extracted safely and throws an exception
otherwise.
2022-11-17 11:52:30 +08:00
Wenyong Huang
84161fe084
Add CIs to release new version and publish binary files (#1648)
Add CIs to enable the release process of a new version of WAMR,
and build and publish the binary files when a version is released,
including iwasm, wamrc, lldb, vscode-extension and wamr-ide for
Ubuntu-20.04, Ubuntu-22.04 and MacOS.

And refine the CIs to test spec cases.
2022-10-28 13:55:41 +08:00
Christian Clauss
fa736d1ee9
Fix syntax errors and undefined names in Python code (#1515) 2022-09-27 15:57:08 +08:00
Hiroshi Hatake
3693cbe54d
Suppress hadolint warnings for pinning versions part (#1511)
Related to https://github.com/bytecodealliance/wasm-micro-runtime/issues/1418.

Suppress hadolint warnings for pinning version.
This is because these warnings are for reproducible builds.
But for development and CIs, ordinary case developers have to use the latest packages.
2022-09-23 10:34:47 +08:00
TianlongLiang
ee210d019f
Dockerfile lint errors fix (#1493)
Fix the Dockerfile linter errors and most warnings
2022-09-22 13:06:11 +08:00
Wang Ning
7593668066
WARM-IDE: Add check for invalid project name when creating new project (#1461) 2022-09-08 17:34:24 +08:00
YAMAMOTO Takashi
0a08b92662
VSCode-Extension: Add empty platform directories (#1460) 2022-09-07 14:30:39 +08:00
YAMAMOTO Takashi
9f09e2661f
wamr-ide/VSCode-Extension: Make lldb binary path per platform (#1437)
hopefully this allows an extension package to run on multiple platforms.

cf. https://code.visualstudio.com/api/extension-guides/debugger-extension#anatomy-of-the-package.json-of-a-debugger-extension
2022-09-01 12:33:59 +08:00
YAMAMOTO Takashi
47f17ef8f5
wamr-ide/VSCode-Extension: "set -e" in shell scripts (#1436)
To avoid mysterious behaviors caused by ignored errors.
2022-08-31 17:27:24 +08:00
Wenyong Huang
9cf7b88bad
Enhance cmake makefiles (#1390)
Upgrade `cmake_minimum_required` from `(VERSION 2.8)` to `(VERSION 2.9)` to
yield the warning:
"Compatibility with CMake < 2.8.12 will be removed from a future version of CMake"

Add "-Wno-unused" for CMAKE_CXX_FLAGS to yield the compilation warnings
when build LLVM JIT.

Fix the link error when code coverage is enabled.
2022-08-18 16:27:01 +08:00
YAMAMOTO Takashi
e8f0c9580b
Some wamr-ide improvements (#1354)
including:
- enable macOS support
- documentation improvements
- fix some warnings
2022-08-08 17:52:47 +08:00