| Crates.io | wasm-coredump-rewriter |
| lib.rs | wasm-coredump-rewriter |
| version | 0.2.2 |
| created_at | 2023-01-24 21:48:01.623803+00 |
| updated_at | 2024-12-31 13:40:14.380518+00 |
| description | Rewrite Wasm binaries to add coredump support |
| homepage | |
| repository | https://github.com/xtuc/wasm-coredump/tree/main/bin/rewriter |
| max_upload_size | |
| id | 766948 |
| size | 62,189 |
wasm-coredump-rewriter is used to add Coredump generation to a compiled Wasm
module.
cargo install wasm-coredump-rewriter
Rewrite Wasm binaries to add coredump support
Usage: wasm-coredump-rewriter [OPTIONS]
Options:
--check-memory-operations Wraps each memory operation. This will likely reduce significantly your program's performance
--debug Enable debugging, mostly useful for developing this tooling
--instance-id <INSTANCE_ID> Specify the instance index to use in stack frames. MUST match the order in which instances are instantiated at runtime [default: 0]
-h, --help Print help
-V, --version Print version
Rewrite the source Wasm module to inject the Coredump runtime code. The runtime will catch traps (excluding traps in host functions or memory violations) and generate a coredump.
Use the following command:
wasm-coredump-rewriter < source.wasm > output.wasm
The Coredump runtime has a performance cost.
Your program entered a trap and a Coredump was generated.
To extract the Coredump write the Wasm instance memory to a file, for instance in JavaScript:
const instance = await WebAssembly.instantiate(...);
try {
wasi.start(instance);
} catch(err) {
const image = new Uint8Array(instance.exports.memory.buffer);
writeFile("coredump." + Date.now(), image);
}
See wasmgdb for analyzing / debugging the coredump.