Crates.io | mbtmap |
lib.rs | mbtmap |
version | 0.1.1 |
source | src |
created_at | 2024-10-09 08:26:57.083189 |
updated_at | 2024-10-09 11:40:41.760325 |
description | Attach source location to MoonBit traceback |
homepage | |
repository | https://github.com/NKID00/mbtmap |
max_upload_size | |
id | 1402134 |
size | 34,585 |
This tool filters traceback generated by moon run -g
, automatically attaches source location resolved from sourcemap.
Install it with cargo install mbtmap
, pass the location of source map and pipe stderr from moon run -g
to it. For example on bash, use |&
:
moon run -g src/bin/main.mbt |& mbtmap target/wasm-gc/debug/build/bin/bin.wasm.map
RuntimeError: unreachable
- at Option::unwrap|@moonbitlang/minimbt/closure.LowType|.fn/653 (wasm://wasm/001ac3c6:wasm-function[695]:0x112cd)
+ at Option::unwrap|@moonbitlang/minimbt/closure.LowType|.fn/653 (wasm://wasm/001ac3c6:wasm-function[695]:0x112cd /home/nkid00/.moon/lib/core/builtin/option.mbt:34:13)
- at $moonbitlang/minimbt/wasm.emit_inst.fn/979 (wasm://wasm/001ac3c6:wasm-function[1073]:0x2a182)
+ at $moonbitlang/minimbt/wasm.emit_inst.fn/979 (wasm://wasm/001ac3c6:wasm-function[1073]:0x2a182 src/wasm/wasm.mbt:524:9)
- at $moonbitlang/minimbt/wasm.emit_inst.fn/979 (wasm://wasm/001ac3c6:wasm-function[1073]:0x2a004)
+ at $moonbitlang/minimbt/wasm.emit_inst.fn/979 (wasm://wasm/001ac3c6:wasm-function[1073]:0x2a004 src/wasm/wasm.mbt:496:28)
- at $moonbitlang/minimbt/wasm.emit_inst.fn/979 (wasm://wasm/001ac3c6:wasm-function[1073]:0x2a004)
+ at $moonbitlang/minimbt/wasm.emit_inst.fn/979 (wasm://wasm/001ac3c6:wasm-function[1073]:0x2a004 src/wasm/wasm.mbt:496:28)
- at $moonbitlang/minimbt/wasm.emit_inst.fn/979 (wasm://wasm/001ac3c6:wasm-function[1073]:0x29c44)
+ at $moonbitlang/minimbt/wasm.emit_inst.fn/979 (wasm://wasm/001ac3c6:wasm-function[1073]:0x29c44 src/wasm/wasm.mbt:419:30)
error: failed to run
moon run -g
If stdin of mbtmap is piped from moon run -g
, the sourcemap may be stale after compilation and its content won't update before program and moon exit. Mbtmap will wait until stdin has been closed to try to make sure sourcemap has been freshly emitted and then resolve source locations. If this is not applicable or interactive is needed, pass -l
option to mbtmap to fall back to line-buffered filter. This way, it is necessary to build and generate fresh sourcemap beforehand.