Debug Move
Move Trace Debugger
Prerequisites
Move Trace Debugger
https://marketplace.visualstudio.com/items?itemName=mysten.move-trace-debug
Start Debug
- in
deepmove
cli, typedebug <module> <func>
to generate trace file as example, you can type the following commands
shell
debug wasm_test use_const
- in vscode open the move source code file
- Select Run -> Start Debugging from the menu.
Move Source Mapping
when your move contracts abort with error codes, in this move example, will abort with assert!
, you may get the following error messages
shell
VMError with status ABORTED with sub status 1 at location Module ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000000, name: Identifier("wasm_test") } and message 0x0000000000000000000000000000000000000000000000000000000000000000::wasm_test::get_vec at offset 19 at code offset 19 in function definition 4
as we can see, it is not quite easy to locate the wrong code position
will deepmove move vm runtime, you will get the extra message with source mapping to the original wrong code position
→ VMError with status ABORTED with sub status 1 at location Module ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000000, name: Identifier("wasm_test") } and message 0x0000000000000000000000000000000000000000000000000000000000000000::wasm_test::get_vec at offset 19 at code offset 19 in function definition 4
move code error at:
0x0::wasm_test:59
59| assert
59
shows the source code line number to your move codes