Nodeclipse / nodeclipse

Nodeclipse-1 : Eclipse plugin for Node.js, PhantomJS development (Nodeclipse core plugin); Maven and Gradle (with Android) plugins
https://nodeclipse.github.io/
158 stars 78 forks source link

Integrate the debugger and add remote debugging support #22

Open pushkar-g opened 11 years ago

pushkar-g commented 11 years ago

Integrate the debugger - Currently the debugger utilizes the V8 debugger plugin. We can integrate the debugger in our code itself and the breakpoints can be activated within the same tab instead of creating a new tab.

More details - http://nodejs.org/api/debugger.html

We can also add remote debug support as part of this enhancement.

paulvi commented 11 years ago

This is great idea!

However link provided is for node command client or REPL mode, that is not aplicable.

This is related to #3 and #12

paulvi commented 10 years ago

Remote debugging should be separate issues, as actually Chromium Remote Debugger can connect to any Node.js app start with -debug[=port] option. If interested, try to play with V8LaunchConfigurations. Likely no programming needed at all.

Quote from http://nodejs.org/api/debugger.html#debugger_advanced_usage

The V8 debugger can be enabled and accessed either by starting Node with the --debug command-line flag or by signaling an existing Node process with SIGUSR1.

That mean that it is possible to start debugging already running app.

RaymondQiu commented 9 years ago

I am trying to use Nodeclipse on my computer to debug a node.js app running on a sever (another machine). I have played around with the current V8 launch configuration but got no luck. Any one know how to do that?

ghost commented 9 years ago

The answer was too long for a simple comment here therefore I wrote a full post to explain how I am doing it — see: http://nodeleaf.net/editing-remote-projects-with-nodeclipse/

RaymondQiu commented 9 years ago

Thanks for the reply. But that is a little bit different than what I want to do. I want to run an node.js app on the server by calling "node --debug Helloworld". Then, on my desktop, I want to use the V8 engine to debug it. Since the V8 engine only look the 127.0.0.1 address, I can not attach the debugger to the remote server. I also read some articles about creating a SSH tunnel to do that but no success so far. :-(

RaymondQiu commented 9 years ago

Today, I tried to set up SSH tunnel. I forwarded both 3000 and 5858 ports. On my machine, I could use the localhost:3000 to view the app's web pate. However, when I launch V8 to localhost:5858, it gave me an error saying "Failed to get version". Any idea what could cause this?

ghost commented 9 years ago

I don't think you need SSH tunneling to access localhost:3000 - assuming your nodejs app is an HTTP server listening on localhost port 3000. Could you expose how the ssh tunnel on port 5858 was setup?

ghost commented 9 years ago

This new post is exposing how I debug nodejs application remotely: http://nodeleaf.net/how-to-debug-a-nodejs-application-remotely/

RaymondQiu commented 9 years ago

Thanks for the reply. I will try the solution in the new post.As for your question, I used Putty to forwarded both 3000 and 5858 ports from my machine to the remote server. I used localhost:3000 to access the app running on the server which meant the SSH tunnel was established (before I created the SSH tunnel, I could not visit the app through localhost:3000).

RaymondQiu commented 9 years ago

I just went through the post. The solution is using Chrome (webkits debug engine) to debug which we tried already. We still prefer to use nodeclipse as a one stop IDE to do the debug. Is there any way to do that? :-)

ghost commented 9 years ago

None that I am aware of but it's never too late to learn. On a principle I do aggree with that you it would be much better to debug from IDE. Pratically I don't think the current Nodeclipse can really handle this but I'll be glad to be corrected if I was wrong as this is a most sensible issue indeed.

ghost commented 9 years ago

I still don't get how you are setting your SSH tunnel. The last time I had to do this to debug a web app remotely was in 2010. So I don't remember the specifics precisely but in the principle I had to forward the debugger port on the remote server to the local machine - doing something like this:

# ssh -R 10137:127.0.0.1:10137 user@domain.name

At the time I was using another avatar of Eclipse (Zend Studio) as it was a PHP application and 10137 was the port for Zend Debuger: a different situation but possibly a similar solution for a different port?