Skip to content
| Marketplace
Sign in
Visual Studio Code>Debuggers>Assemblyscript-DebuggerNew to Visual Studio Code? Get it now.

Assemblyscript-Debugger

Congcong Cai

|
640 installs
| (1) | Free
Assemblyscript Debugger
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

assemblyscript-dbg

vscode extension for assemblyscript debugger

How to use

environment

  • rustc >= 1.63
  • protobuf >= 3.15

Before using, please install wasmdbg-grpc from github

cargo install wasmdbg-grpc --git https://github.com/HerrCai0907/wasmdbg.git

recommand compile flag

"options": {
  "disable": ["sign-extension", "nontrapping-f2i", "bulk-memory"],
  "runtime": "stub"
}

Due to some compiler bug, in increment runtime souce-map miss lots of information, so use stub runtime is easy to debug.

Now interpreter does not support some instruction, so disable some ASC feature is also needed.

import function

in launch.json, you can define a list of files to provide import function

"configurations": [
  {
    "type": "assemblyscript-debug",
    "request": "launch",
    "name": "Ask for file name",
    "program": "${workspaceFolder}/build/debug.wasm",
    "cwd": "${workspaceFolder}",
    "apiFiles": ["${workspaceFolder}/api.cjs"]
  }
]
// api.cjs
module.exports = {
  env: {
    trace: (extension, args, memory, globals) => {
      // actually extension already provide it, but you can replace it by yourself
      const offset = args[0];
      const n = args[1];
      extension.logInfo(
        `trace: ${extension.helper.getString(offset, memory)}${n ? " " : ""}${args.slice(2, 2 + n).join(", ")}`
      );
      return null;
    },
  },
  index: {
    getI32: (extension, args, memory, globals) => {
      extension.logInfo(`call getI32, will return ${1024}`);
      return 1024;
    },
  },
};
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft