xtuc / wasm-edit

Edit and instrument already compiled Wasm binaries

Home Page:https://crates.io/crates/wasm-edit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Edit and instrument already compiled Wasm binaries

https://crates.io/crates/wasm-edit


Languages

Language:Rust 51.5%Language:WebAssembly 47.8%Language:Makefile 0.8%