Node.js breakpoints

CodeLite installation/troubleshooting forum
NuSkooler
CodeLite Enthusiast
Posts: 10
Joined: Fri Sep 04, 2015 12:33 am
Genuine User: Yes
IDE Question: C++
Location: USA
Contact:

Node.js breakpoints

Post by NuSkooler » Fri Sep 04, 2015 12:41 am

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!

User avatar
eranif
CodeLite Plugin
Posts: 6141
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Node.js breakpoints

Post by eranif » Fri Sep 04, 2015 12:44 pm

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
Make sure you have read the HOW TO POST thread

NuSkooler
CodeLite Enthusiast
Posts: 10
Joined: Fri Sep 04, 2015 12:33 am
Genuine User: Yes
IDE Question: C++
Location: USA
Contact:

Re: Node.js breakpoints

Post by NuSkooler » Fri Sep 04, 2015 8:50 pm

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.
You do not have the required permissions to view the files attached to this post.

DavidGH
CodeLite Plugin
Posts: 702
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Node.js breakpoints

Post by DavidGH » Fri Sep 04, 2015 10:31 pm

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

NuSkooler
CodeLite Enthusiast
Posts: 10
Joined: Fri Sep 04, 2015 12:33 am
Genuine User: Yes
IDE Question: C++
Location: USA
Contact:

Re: Node.js breakpoints

Post by NuSkooler » Sat Sep 05, 2015 2:16 am

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.

User avatar
eranif
CodeLite Plugin
Posts: 6141
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Node.js breakpoints

Post by eranif » Sat Sep 05, 2015 9:27 am

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
Make sure you have read the HOW TO POST thread

User avatar
eranif
CodeLite Plugin
Posts: 6141
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Node.js breakpoints

Post by eranif » Sat Sep 05, 2015 10:49 am

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
Make sure you have read the HOW TO POST thread

NuSkooler
CodeLite Enthusiast
Posts: 10
Joined: Fri Sep 04, 2015 12:33 am
Genuine User: Yes
IDE Question: C++
Location: USA
Contact:

Re: Node.js breakpoints

Post by NuSkooler » Sat Sep 05, 2015 9:22 pm

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).
You do not have the required permissions to view the files attached to this post.

User avatar
eranif
CodeLite Plugin
Posts: 6141
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Node.js breakpoints

Post by eranif » Sat Sep 05, 2015 10:26 pm

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
Make sure you have read the HOW TO POST thread

User avatar
eranif
CodeLite Plugin
Posts: 6141
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Node.js breakpoints

Post by eranif » Sun Sep 06, 2015 1:30 am

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
Make sure you have read the HOW TO POST thread

Post Reply