Quantcast
Channel: Node.js Tools for Visual Studio
Viewing all articles
Browse latest Browse all 4630

Commented Issue: Debugger not behaving correctly when using "vm" module [652]

$
0
0
When using the "vm" module the debugger is not correctly hitting the breakpoints. If a breakpoint is set using the debugger statement you are taken to the correct place in the code only the first execution. Afterwards an empty <unknown> "file" is displayed.
The name of the file is specified as a parameter for the vm module like so:

```
vm.runInContext(fileContents, contextObj, fileName);
```
Comments: Can you please provide the complete repro code for this? I've tried to recreate this with the following setup: app.js: ``` var path = require('path'); var fs = require('fs'); var vm = require('vm'); var code = fs.readFileSync('script2.js'); var context = vm.createContext({x:1}); while (true) { vm.runInContext(code, context, path.resolve('script2.js')); console.log(context.x); } ``` script2.js: ``` x = x + 1; ``` Setting the breakpoint inside script2.js, it is not hit at all, even though it shows as bound (and under debugger, I can see that the request to set the breakpoint is successfully dispatched to V8 - we just never receive the breakpoint hit event). This is with node.js v0.10.26. Reading the docs at http://nodejs.org/api/vm.html#vm_caveats, it seems that this module is a bit of a "here be dragons" territory, and so it's hard to say to what extent debugging it is going to be stable. It would help if you can describe your scenario in more detail, what you're currently seeing, and what you expect to see, and we can then figure out whether this is something that can be done purely on our side, or we need to involve V8 folk as well.

Viewing all articles
Browse latest Browse all 4630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>