#instrument #edit #transform #call

bin+lib wasm-edit

Edit and instrument already compiled Wasm binaries

7 releases

0.1.7 May 27, 2023
0.1.6 Jan 24, 2023
0.1.5 Dec 13, 2022
0.1.3 Nov 15, 2022

#1090 in WebAssembly

Download history 33/week @ 2024-07-27 10/week @ 2024-08-03 35/week @ 2024-08-10 12/week @ 2024-08-17 8/week @ 2024-08-24 7/week @ 2024-08-31 37/week @ 2024-09-07 84/week @ 2024-09-14 20/week @ 2024-09-21 45/week @ 2024-09-28 56/week @ 2024-10-05 4/week @ 2024-10-12 62/week @ 2024-10-19 37/week @ 2024-10-26 56/week @ 2024-11-02

168 downloads per month

MIT license

12KB
218 lines

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

Dependencies

~5–14MB
~165K SLoC