Page 1 of 3

Node.js breakpoints

Posted: Fri Sep 04, 2015 12:41 am
by NuSkooler
Hello,

I recently tried CodeLite with Node.js. Overall, this looks very promising! Unfortunately for me at least, breakpoints are not functioning. When I run in debug mode, only the initial break is hit (the implicit one). Any breakpoints I explicitly set in the UI are passed over as if they do not exist.

Here is some system information that may be helpful:
OS: Elementary OS freya fully updated (Linux eos-freya 3.16.0-46-generic #62~14.04.1-Ubuntu SMP Tue Aug 11 16:27:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux)
Node: v0.12.2 installed to ~/local/bin
CodeLite IDE v8.1.0 installed via http://repos.codelite.org/ubuntu/ trusty universe

Any help/tips appreciated!

Re: Node.js breakpoints

Posted: Fri Sep 04, 2015 12:44 pm
by eranif
Since it works for me on all 3 platforms (OSX, Windows and Linux), I am guessing that we will have to debug this using CodeLite log file where it logs all the communication with nodejs during the debug session.

Can you please do this:
1. Set CodeLite logging to "Debug" from: Settings->Global Editor Preferences->Misc->Log
2. Open a terminal and empty the log file, by typing this command:

Code: Select all

> ~/.codelite/codelite.log
3. Start a new debug session as you did before
4. Post here the log file

Thanks,
Eran

Re: Node.js breakpoints

Posted: Fri Sep 04, 2015 8:50 pm
by NuSkooler
Thanks for the reply. Attached is a debug log file as requested.

Something I didn't notice before (not sure how I missed it?!): The debugger is in fact stopping on breakpoints and waiting for user input (e.g. Next). However:
  • CodeLite does not "jump" to the breakpoint
  • No visual indicator of the breakpoint that I'm currently on (e.g. no arrow)
  • Debugger window with locals, args, etc. remains grayed out.

Re: Node.js breakpoints

Posted: Fri Sep 04, 2015 10:31 pm
by DavidGH
Hi,

I had a similar problem recently when debugging C++ with gdb. I eventually realised it was self-inflicted: I'd unticked 'Raise CodeLite when a breakpoint is hit' in Debugger Settings.

That's probably irrelevant to your Node.js situation, but just in case...

Regards,

David

Re: Node.js breakpoints

Posted: Sat Sep 05, 2015 2:16 am
by NuSkooler
DavidGH wrote: I had a similar problem recently when debugging C++ with gdb. I eventually realised it was self-inflicted: I'd unticked 'Raise CodeLite when a breakpoint is hit' in Debugger Settings.
This is a fresh install of CodeLite on this box. I went ahead and checked, but I could not find a option for Node.js similar to this. The C++ option was enabled FWIW.

Re: Node.js breakpoints

Posted: Sat Sep 05, 2015 9:27 am
by eranif
NuSkooler wrote:Thanks for the reply. Attached is a debug log file as requested.

Something I didn't notice before (not sure how I missed it?!): The debugger is in fact stopping on breakpoints and waiting for user input (e.g. Next). However:
CodeLite does not "jump" to the breakpoint
No visual indicator of the breakpoint that I'm currently on (e.g. no arrow)
Debugger window with locals, args, etc. remains grayed out.
ATTACHMENTS
codelite.log
Debug Log
(267.76 KiB) Downloaded 3 times
Thanks for the log, I can see that you are setting breakpoint on line /home/bashby/dev/enigma-bbs/core/fse.js:74
The request CodeLite is sending to Node.js is "seq":5 (you can see the request sent on line 69 in codelite.log):

Code: Select all

{
 "type": "request",
 "command": "setbreakpoint",
 "arguments": {
  "type": "script",
  "target": "/home/bashby/dev/enigma-bbs/core/fse.js",
  "line": 74,
  "column": 0
 },
 "seq": 5
}
So CodeLite now waits for a response with '"request_seq":5 '
Which arrives (you can see it in line 85 in codelite.log):

Code: Select all

{"seq":6,"request_seq":5,"type":"response","command":"setbreakpoint","success":true,"body":{"type":"scriptName","breakpoint":2,"script_name":"/home/bashby/dev/enigma-bbs/core/fse.js","line":74,"column":0,"actual_locations":[]},"refs":[],"running":false}
HOWEVER, the protocol was broken earlier (from the log file is seems that it is broken from Node.js side) on line: codelite.log:62

Code: Select all

[ 10:41:30:860 DBG ] Node.js  <<<< ntent-Length: 29925
This line should have been "Content-Length: 29925", so CodeLite's inner buffer is now containing some junk that will never get process (we process it by searching for "Content-Length: XXX\r\n\r\n", reading the number of bytes from the buffer and we assume that the inner buffer always starts with "Content-Length: XXX"

Strangely, the rest of message handling between CodeLite and Node.js is working as it should... no more glitches that I could found in the protocol

I will try and make CodeLite "swallow" broken messages coming from Node.js

Eran

Re: Node.js breakpoints

Posted: Sat Sep 05, 2015 10:49 am
by eranif
I made some fixes to the way CodeLite is handling the protocol between CodeLite <-> Node.js
It should be more resilient now.

I have uploaded a .deb file for Ubuntu 14.04/64 bit (which from you wrote above it should work for you)
You can get it from here:

http://codelite.org/downloads/codelite/ ... x86_64.deb

It contains many changes since 8.1 release, the main ones are described here:
http://codelite.org/LiteEditor/ReleaseNotesCodeLite83

To install the .deb file, just download it and run this from the terminal:

Code: Select all

sudo dpkg -i CodeLite-8.2.3-ubuntu-trusty-x86_64.deb
Please let me know if it works for you with these changes

Thanks
Eran

Re: Node.js breakpoints

Posted: Sat Sep 05, 2015 9:22 pm
by NuSkooler
Thank you very much for your time and effort on this.

I tried the package you posted. Progress, but not quite there. Breakpoints are now visually hit, but the inspection window/variables are still not accessible. Also, I noticed that the console output is now in a separate xterm window. See attached screen shot which may make my description more clear.

Lastly, there is something odd with the .dep itself. When attempting to install I get this error:
Lintian check results for /home/nuskooler/Downloads/CodeLite-8.2.3-ubuntu-trusty-x86_64.deb:
E: codelite: control-file-has-bad-permissions md5sums 0664 != 0644

Attempting to install anyway results in other errors. I ended up doing a apt-get remove on the previous installation then force installing this one (past the error above).

Re: Node.js breakpoints

Posted: Sat Sep 05, 2015 10:26 pm
by eranif
thanks for testing.
I will remove the "disable" views feature...
it was there to give indication that node.js has the control and not codelite. obviously this has a bad side effect if the protocol is broken somehow.

I will try to upload a new package in a couple of hours

thanks,
Eran

Re: Node.js breakpoints

Posted: Sun Sep 06, 2015 1:30 am
by eranif
Hi,
I have updated the package on the website with a fix that should allow you to interact with Node.js (same link as before):
http://codelite.org/downloads/codelite/ ... x86_64.deb

Please give it a try and report back :)
NuSkooler wrote:Also, I noticed that the console output is now in a separate xterm window
Yes, this is intentional, since the window used in CodeLIte 8.1 had no way of passing input to node.js if required. So the decision was to move using the native OS terminal
(CMD.EXE, Konsole/gnome-terminal/xterm, Terminal.app for OSX)

Thanks,
Eran