c++ - VS 代码调试 C++ Node 插件

标签 c++ node.js visual-studio-code node.js-addon

我尝试在 visual studio 代码中为使用 GYP 编译的 C++ Node-Addon 设置调试。如果可能的话,我想单步执行源代码。我使用 typescript 作为我的服务器语言,并包含由 gyp 编译的“.node”文件。这工作正常,但我如何设置它,以便我不仅可以单步执行 typescript 代码,还可以单步执行 C++ 代码?

.cc 文件的 VSCode 断点:

我知道我可以使用 gyp node-gyp rebuild --debug 编译调试版本,但我没有计划如何在 vscode 中使用它。

最佳答案

如果你使用 Windows,这个 VSCode launch.json 可能会帮助你:

{
  "version": "0.2.0",
  "configurations": [{
      "type": "cppvsdbg",
      "request": "launch",
      "name": "Addon Debug",
      "program": "node",
      "args": ["C:\\repos\\HighloadCup\\db.js"]
  }]
}

确保使用正确的架构和其他选项构建 Node.js 插件。

关于c++ - VS 代码调试 C++ Node 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40719940/

相关文章:

c++ - 通过 ref 传递 const 指针比通过值传递更好?

c++ - 无法使用 fstream 打开新的进出文件

c++ - 文本框 MFC SDI 不会出现

node.js - 简单表单 Node js应用

node.js - 如果我的电脑的 IP 地址每天都在变化,如何编写 Node.js 服务器

angular - Angular VScode 插件

visual-studio-code - VS 代码不会使未使用的变量变灰

C++,VS2010 : Avoid downloading MS redistrubutable package. 静态链接?

keyboard-shortcuts - vscode中一个键盘快捷键的多个操作

node.js - 有没有办法在 zookeeper 中添加观察者队列?