This project is read-only.

native debugging?

May 27, 2014 at 11:35 AM
Is it possible to debug native code? I'm using a nodejs project that relies on a c++ library. I can set breakpoints in the c++ code and they get marked like "active" but they never catches anything. Am I doing something wrong or is it not working?
May 27, 2014 at 5:54 PM
True mixed native/JS debugging is not there, unfortunately. We're limited by what the node.js debugging protocol exposes, and it doesn't have any facilities for this kind of thing.

You can get some semblance of it by attaching to the same process twice with the Attach to Process dialog, once using Node.js code type, and once using Native. VS will not let you do it in a straightforward way, because it sets the "this process is being debugged" flag on a process whenever it is attached with any code type. However, you can use the NTVS remote debugging feature and attach to localhost to circumvent that - since you're not attaching directly to the process, as far as it is concerned, VS will not muck around with the flags. And then you can attach to node.exe with Native code type.

Inside VS, this will look like you're debugging two different processes (the debugger toolbar has a process selector combo on the left side), so you won't be able to e.g. transparently step from JS code to C++ and back. But you should be able to set breakpoints and see them hit; and whenever a breakpoint is hit in JS, you should be able to switch between the two "processes" to see both the JS callstack and the C++ callstack, inspect locals etc. On the other hand, if you hit a breakpoint in C++, the JS side of the debugger will likely not work at all while you're paused on that breakpoint (because it will issue node debugging protocol commands over the socket to get call stack, locals etc - and node will be blocked on a breakpoint in native code and so unable to reply to those commands).