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

[Feature request] Breakpoints synchronization, submodules #3

Closed paulvi closed 9 years ago

paulvi commented 11 years ago

Asked by tchambard, moved from https://github.com/Nodeclipse/nodeclipse-blog/issues/1

I’m using Streamline module : https://github.com/Sage/streamlinejs The goal of this module is to generate code at node startup to manage easily callbacks. The lines numbers stay the sames.

I added ._js in contentTypes Javascript source files and associated Node editor with ._js files.

The debbuging is working perfectly, but I need to toggle breakpoints directly in STANDALONE_V8 files because the breakpoints synchronisation doesn’t work for those files. When I toggle breakpoint in STANDALONE_V8 files, the breakpoint is added too in original source file, but the opposite doesn’t work.

paulvi commented 11 years ago

We will not add this in coming 0.3. But this is interesting. This is somehow related to coffee-script debugging that I long for.

wrouesnel commented 11 years ago

I'm encountering the same issue - I can toggle breakpoints in app.js in the editor directly and it works. But trying to toggle breakpoints in submodules doesn't work - however if I open them in Standalone V8 (by stepping through the code) it does work.

Seems somewhat related to Standalone V8 not being started with enough parameters to properly match source code files.

paulvi commented 11 years ago

@wrouesnel Thanks Will for the reopening. It is second time I hear that.

I assume you are using nodeclipse 0.4.0

http://www.nodeclipse.org/#support

Should you report a bug, please include the following:

Eclipse version number (like 4.2.2 or 3.8.0) Eclipse distribution (e.g. Eclipse for JEE Developers) A detailed description of the steps necessary to reproduce the problem. The '.log' file from the directory '.metadata' in your workspace.

When you say submodules, do you mean your project submodules or Node.js ones? Also if the project happens to be open-source, it would be nice to reference it.

wrouesnel commented 11 years ago

I'm running Eclipse:

Version: Kepler Release Build id: 20130614-0229

C/C++ developers distribution (after adding other modules) with nodeclipse 0.4.0.

It's a small personal project at the moment. The basic issue is I have a directory layout like so:

app.js
/server/fileWatcher.js

and obviously other node modules.

I can set breakpoints in app.js and when I hit Debug with a nodeclipse run it'll break on them in the debugger. But, if I set breakpoints in fileWatcher.js, which is invoked like so in app.js:

// Start file watcher
var fileWatcher = require('./server/fileWatcher');
fileWatcher.indexAll();
fileWatcher.fileWatcher();

then none of the breakpoints in fileWatcher will be reached. But! If I step through the code in app.js and step into one of those fileWatcher functions, then I can set breakpoints from the nodeclipse editor and they'll be picked up just fine.

Browsing the Standalone V8 project that gets created by the debugger, it doesn't contain fileWatcher.js when it breaks in app.js initially.

paulvi commented 11 years ago

The issue accepted.

tomotaro1065 commented 11 years ago

I investigated the cause of this issue. But this issue was hard to fix.

Nodeclipse add breakpoints, which were set in Javascript source files, into .chromium files, when chromedevtools loaded source code from v8 engine.

In this case, after "require" statement is executed in v8, "afterComplie" event is fired. Then chromedevtools request "script" command to v8 and chromedevtools receives scripts from v8. Nodeclipse adds breakpoints in this timing. But v8 is not suspended, so the next statements are executed, before Nodeclipse add breakpoints. The time rag is about 100ms.

So if you set breakpoint next line of "require" statement or add code waiting 100ms after "require" statement, the breakpoints in new loaded scripts will be worked.

paulvi commented 9 years ago

@tchambard

I am closing

._js will be associate with JS Editor in 1.0,
and Nodeclipse is passing -debug-brk to node to enable debug for small apps already for a year or two.

If there's something left, please open new ticket and reference this #3