I try to setup debugging in visual studio code for a C++ Node-Addon compiled with GYP. I want to step through the source-code if possible. I use typescript as my server language and include the ".node" file compiled by gyp. This works fine but how do I set it up so I can step not only through the typescript code but also through the C++ code?
VSCode breakpoints for .cc file:
I know I can compile a debug-version with gyp node-gyp rebuild --debug
, but I have no plan how to use that in vscode.
To debug a C or C++ Win32 applicationOpen the project in Visual Studio. On the Debug menu, choose Start. Debug using the techniques discussed in First look at the debugger.
If you use Windows, this VSCode launch.json may help you:
{
"version": "0.2.0",
"configurations": [{
"type": "cppvsdbg",
"request": "launch",
"name": "Addon Debug",
"program": "node",
"args": ["C:\\repos\\HighloadCup\\db.js"]
}]
}
Make sure you build Node.js addon with correct architecture and other options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With