https://github.com/xtuc/wasm-edit
Edit and instrument already compiled Wasm binaries
https://github.com/xtuc/wasm-edit
Last synced: over 1 year ago
JSON representation
Edit and instrument already compiled Wasm binaries
- Host: GitHub
- URL: https://github.com/xtuc/wasm-edit
- Owner: xtuc
- Created: 2022-10-20T13:45:07.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-27T17:05:24.000Z (about 3 years ago)
- Last Synced: 2025-05-07T15:09:10.257Z (over 1 year ago)
- Language: Rust
- Homepage: https://crates.io/crates/wasm-edit
- Size: 56.6 KB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# wasm-edit
> Edit and instrument already compiled Wasm binaries
## Coredump generation
Moved to https://github.com/xtuc/wasm-coredump.
## Install
```
cargo install wasm-edit
```
## Edit the main memory
Change the initial memory amount (in pages):
```
wasm-edit edit-memory --initial-memory=1000 < input.wasm > output.wasm
```
## Trace calls to `memory.grow`
Trace calls to the `memory.grow` instruction:
```
wasm-edit instrument-memory < input.wasm > output.wasm
```
Requires Wasi, but doesn't require any change on the host.
Tested with Rust and theoretically working with C/C++ (clang).
## Running into stack overflow
Some Wasm binaries have very recursive flow of control, increase the maximum stack size:
```
$ ulimit -s 160000
```
[wasmgdb]: https://github.com/xtuc/wasmgdb