napi-rs / napi-rs/napi-rs

how debug with cppvsdbg

Open
#2,830 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7.9k
Forks
412
Avg merge
1d 20h
Merged PRs (30d)
64

Description

Hi to all,
I've been racking my brain for days trying to set up debugging through Visual Studio Code and cppvsdbg, how can I do it?

Everythings I tried not worked.

I created a launch.json file like this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug NAPI in Node.js",
      "type": "cppvsdbg",
      "request": "launch",
      "program": "node",
      "args": [
        "--inspect",
        "${workspaceFolder}/main.mjs"
      ],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [
        {
          "name": "RUST_BACKTRACE",
          "value": "full"
        },
        {
          "name": "RUST_LOG",
          "value": "debug"
        }
      ],
      "symbolSearchPath": "${workspaceFolder}/target/debug;${workspaceFolder}/target/debug/deps",
      "sourceFileMap": {
        "/rustc/": "${env:USERPROFILE}/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust"
      },
      "console": "integratedTerminal",
      "preLaunchTask": "napi build debug"
    },
  ]
}

and a tasks.json file like this:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "napi build debug",
      "type": "shell",
      "command": "napi",
      "args": [
        "build",
        "--platform"
      ],
      "problemMatcher": [
        "$rustc"
      ],
      "group": "build"
    },
  ]
}

Also I have this configuration active in my "windows 10" machine

> rustup show
Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\x-etienne\.rustup

installed toolchains
--------------------
stable-x86_64-pc-windows-msvc (active, default)

active toolchain
----------------
name: stable-x86_64-pc-windows-msvc
active because: it's the default toolchain
installed targets:
  wasm32-unknown-unknown
  x86_64-pc-windows-msvc

and rs-napi version: 3.0.4

Somebody can I help me?

thanks in advance

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the launch.json and tasks.json configurations, including the cppvsdbg entry point, the napi build debug task, and main.mjs. Determine the supported Windows debugging setup for the Rust N-API project, then document a working configuration and verification steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, rust, vscode
Domain
devtools
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.