Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakpoints issues #2

Open
LordJZ opened this issue Mar 22, 2013 · 15 comments
Open

Breakpoints issues #2

LordJZ opened this issue Mar 22, 2013 · 15 comments

Comments

@LordJZ
Copy link

LordJZ commented Mar 22, 2013

Hi,

I'm experiencing weird breakpoint behavior.

First issue: Breakpoints set before starting debugging are not usually taken into account. This happens because DebuggedProcess.SetBreakpoint is called before Modules are loaded (i.e. before a series of afterCompile events).

Second issue: Breakpoints set in a file that is not node.js entry point don't properly break. The process breaks, but no location in code is shown (instead you see another window: Source not available - Code not running), and call stack is empty.

I'm running 64-bit node.js v0.8.22 on Windows 8, and developing in MSVS 2012.2 CTP 11.0.60115.01.

P. S. I've started developing support for source maps and typescript here but these issues are blocking me.

@omgtehlion
Copy link
Owner

Thank you!

I'll look into these issues soon.
Could you provide some details on the second issue? These files are your project files or builtin libraries?

@LordJZ
Copy link
Author

LordJZ commented Mar 22, 2013

These are my own project files, connected via require.

@omgtehlion
Copy link
Owner

I tried to reproduce this issue with simple program and have not succeeded, everything worked fine.

Could help me investigating this more?

  1. What version of extension are you using? One from gallery or built from the latest source?
  2. Are you debugging a project (Ctrl+E,A) or standalone document (Ctrl+E,D)?
  3. I have added a sample project https://github.com/omgtehlion/NodeVsDebugger/tree/master/Sample
    Please try to debug it with fresh version of code from my master branch (I have fixed one simple bug with configuration).

@LordJZ
Copy link
Author

LordJZ commented Mar 22, 2013

Hi,
Thanks for the sample project!
I've set 2 breakpoints: in included.js onload, and on require in main.js and made a series of tests. Here's what I have right now.

Running experimental instance of MSVS (tried both in run mode and connect mode, both auto and document) results in an immediate crash when a breakpoint is triggered. It didn't crash when I used release version of debugger from the gallery, and also it doesn't crash on my own project.

Running normal instance of MSVS:

  • Auto Debugging (Ctrl-E, Ctrl-A which does not work for me, I use it through the menu):
    • connect mode: neither of two breakpoints were hit (I tried many times), probably because of issue no. 1. debugger; statement acted as a breakpoint properly.
    • run mode:
      • Hangs and throws exceptions every third try, see below for screenshot
      • Sometimes breakpoint in main.js don't show code (screenshot) but it works fine in included.js.
  • Document Debugging:
    • Both breakpoints triggered fine
    • Second try hanged the studio the moment node started, after node was killed an exception was thrown, screenshot
    • Third try: breakpoints trigger, but even in the entry file it doesn't show the code; the call stack is visible, screenshot

So, to me it feels like something doesn't clean itself up. Also, the MSVS crash (not exception, but crash) is really creepy (), and it looks like it replaces the empty call stack issue (no. 2) for the sample project.

Let me know if you need anything else.

@omgtehlion
Copy link
Owner

Thank you for detailed response.

Unfortunately I still cannot reproduce this issue on my machine. But I have received similar bugreport from another person.

I am going to add logging (and tracing) to the code soon, and track down where this bug is.

@LordJZ
Copy link
Author

LordJZ commented Mar 24, 2013

Thanks, looking forward to it.

@omgtehlion
Copy link
Owner

Hello!

Sorry for very long delay. Please try the latest version from my “master” branch.
Logs can be found in %LOCALAPPDATA%\NodeVsDebugger\logs

I hope this will make things clear.

@H23120
Copy link

H23120 commented Apr 25, 2013

Sir,
I had used the latest version and the sample project from your master branch but still no luck to make it work. Both auto and document debugging hang. Does NodeVsDebugger require specific OS or Visual Studio version to run? I'm using Windows 8 x64 with VS2012 Update 3 and Node v0.8.9. The auto debugging command prompt outputs as following. Thanks for your great work.

hello
, World!
Error 10054
D:\repo\NodeVsDebugger\Sample\included.js loaded


And the log is:

Created 2013.04.25 07:12:16.951

   0 > DebuggedProcess
   3 > DebuggedProcess.ParseConfig
   3 <2 DebuggedProcess.ParseConfig
   3 < DebuggedProcess
 111 > DebuggedProcess.Attach
 113 < DebuggedProcess.Attach
 114 > DebuggedProcess.WaitForAttach
 115 DebuggedProcess.dbg_Connected
 115 <2 DebuggedProcess.WaitForAttach
 120 > DebuggedProcess.SetBreakpoint @D:\repo\NodeVsDebugger\Sample\included.js:3
 161 < DebuggedProcess.SetBreakpoint
 164 DebuggedProcess.ResumeFromLaunch
 166 > DebuggedProcess.dbg_EventReceived evt = afterCompile
body = {

"script": {
"handle": 1,
"type": "script",
"name": "console.js",
"id": 31,
"lineOffset": 0,
"columnOffset": 0,
"lineCount": 79,
"sourceStart": "(function (exports, require, module, __filename, __dirname) { // Copyright Joyen",
"sourceLength": 2348,
"scriptType": 2,
"compilationType": 0,
"context": {
"ref": 0
},
"text": "console.js (lines: 79)"
}
}
166 < DebuggedProcess.dbg_EventReceived
166 > DebuggedProcess.dbg_EventReceived evt = afterCompile
body = {
"script": {
"handle": 1,
"type": "script",
"name": "tty.js",
"id": 32,
"lineOffset": 0,
"columnOffset": 0,
"lineCount": 141,
"sourceStart": "(function (exports, require, module, __filename, __dirname) { // Copyright Joyen",
"sourceLength": 3984,
"scriptType": 2,
"compilationType": 0,
"context": {
"ref": 0
},
"text": "tty.js (lines: 141)"
}
}
167 < DebuggedProcess.dbg_EventReceived
167 > DebuggedProcess.dbg_EventReceived evt = afterCompile
body = {
"script": {
"handle": 1,
"type": "script",
"name": "net.js",
"id": 33,
"lineOffset": 0,
"columnOffset": 0,
"lineCount": 1149,
"sourceStart": "(function (exports, require, module, __filename, __dirname) { // Copyright Joyen",
"sourceLength": 27680,
"scriptType": 2,
"compilationType": 0,
"context": {
"ref": 0
},
"text": "net.js (lines: 1149)"
}
}
167 < DebuggedProcess.dbg_EventReceived
174 > DebuggedProcess.dbg_EventReceived evt = afterCompile
body = {
"script": {
"handle": 1,
"type": "script",
"name": "D:\repo\NodeVsDebugger\Sample\included.js",
"id": 34,
"lineOffset": 0,
"columnOffset": 0,
"lineCount": 11,
"sourceStart": "(function (exports, require, module, __filename, __dirname) { module.exports = {",
"sourceLength": 311,
"scriptType": 2,
"compilationType": 0,
"context": {
"ref": 0
},
"text": "D:\repo\NodeVsDebugger\Sample\included.js (lines: 11)"
}
}
174 < DebuggedProcess.dbg_EventReceived
176 > DebuggedProcess.dbg_EventReceived evt = break
body = {
"invocationText": "#.onload()",
"sourceLine": 3,
"sourceColumn": 8,
"sourceLineText": " var SET_BREAKPOINT_HERE = __filename + " loaded";",
"script": {
"id": 34,
"name": "D:\repo\NodeVsDebugger\Sample\included.js",
"lineOffset": 0,
"columnOffset": 0,
"lineCount": 11
},
"breakpoints": [
2
]
}
177 < DebuggedProcess.dbg_EventReceived
270 < DebuggedProcess.DoStackWalk
296 > DebuggedProcess.DoStackWalk

@omgtehlion
Copy link
Owner

Thank you!

This log looks fine, so far...
I'm using VS2012 upd2 on Windows 7 x64 sp1, node versions are 0.8, 0.9 and 0.10.

Could you send me *.json logs? From the same folder. These files are larger, please use any file-sharing site or send directly to my e-mail.

And a couple of additional questions:
— Which add-ins or extensions do you have installed into Visual Studio?
— Could you run main.js from sample project using standalone NodeJS? What output it produces?

@H23120
Copy link

H23120 commented Apr 26, 2013

Sir,
Thanks for your reply. I had uploaded the json and log files to http://db.tt/c8oBYBrq.

I only installed Microsoft Web Developer Tools and Web Essentials 2012 extensions and the output of main.js from the sample project is:

тест юникода 0
тест юникода 1
тест юникода 2
тест юникода 3
тест юникода 4

D:\repo\NodeVsDebugger\Sample\main.js:44
throw "asdadasd";
^
asdadasd

I also tried comment those problematic code and a very simple hello world program, but the results are the same, breakpoints were hit then visual studio hang.

@robianmcd
Copy link

Thanks omgtehlion and LordJZ for your work on this. It looks like an awesome project! Is there any way to debug Typescript in a node app yet or should I just wait for this issue to be resolved?

@omgtehlion
Copy link
Owner

@robianmcd, you can try version from this branch: https://github.com/LordJZ/NodeVsDebugger/archive/master.zip

@robianmcd
Copy link

@omgtehlion Thanks for the advice. I tried using that branch but only had a little bit of success. I can debug from my server side typescript files but only if I set the breakpoints in the javascript files. Also I can't seem to hit any breakpoints in client side javascript or typescript files.

@omgtehlion
Copy link
Owner

@robianmcd, thank you for your feedback!

Typescript support may be currently incomplete, but when I have some time I will look into it. Or maybe @LordJZ will develop it further.

About client side: this extension currently deals only with debugging NodeJS. Since client-side script executes in browser, we cannot debug it. Maybe in the future combined debugging will be available though.

@robianmcd
Copy link

Ah I didn't realize it was possible to debug client side code without your plugin but I dug around and figured out how to do it. So now I can just debug normally from VS when I want to debug client side code and debug with your plugin when I want to debug server side code. Not perfect but it'll get the job done for now.

Thanks a lot for your help and for working on this plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants