| Summary: | Breakpoints are not respected by eclipse JSDT while doing remote debugging of Rhino server side javascript files | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] JSDT | Reporter: | Ravi <test.ravi4me> | ||||||
| Component: | Debug | Assignee: | Project Inbox <jsdt.debug-inbox> | ||||||
| Status: | CLOSED DUPLICATE | QA Contact: | Michael Rennie <Michael_Rennie> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | test.ravi4me, thatnitind | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 183773 [details]
screenshot shows eclipse project structure
screenshot shows eclipse project structure
Created attachment 183774 [details]
debug snapshot
I think this is a dupe of bug 328531 *** This bug has been marked as a duplicate of bug 328531 *** |
Build Identifier: M20100909-0800 Rhino remote debugging is enabled in server side Rhino VM. But breakpoints set in Eclipse Javascript / Java project for Javascript files are completely ignored as Eclipse Javascript Script path doesn't match the Rhino's Path location in evaluate Reader API call. An example will be given below. Reproducible: Always Steps to Reproduce: Step1: Enabled remote debugging in Rhino in server side Java VM. try{ String rhinoDebug = "transport=socket,suspend=y,address=9000,trace=y"; if ( rhinoDebug != null) { RhinoDebugger debugger = new RhinoDebugger(rhinoDebug); debugger.start(); ContextFactory.getGlobal().addListener(debugger); } }catch(Exception e) { throw new RuntimeException(e); } Step 2. Downloaded eclipse 3.6 helios and here are the JSDT version jars in my eclipse. ./org.eclipse.wst.jsdt.debug.rhino_1.0.1.v201008170101.jar ./org.eclipse.wst.jsdt.doc_1.0.301.v201007150153.jar ./org.eclipse.wst.jsdt.ui_1.1.2.v201009010353.jar ./org.eclipse.wst.jsdt.support.firefox_1.0.300.v201004150600.jar ./org.eclipse.wst.jsdt.support.ie_1.0.300.v201004150600.jar ./org.eclipse.wst.jsdt.debug.core_1.0.1.v201008170101.jar ./org.eclipse.wst.jsdt.core_1.1.2.v201009011528.jar ./org.eclipse.wst.jsdt.debug.ui_1.0.1.v201008170101.jar ./org.eclipse.wst.jsdt.manipulation_1.0.200.v201004150600.jar ./org.eclipse.wst.jsdt.debug.rhino.debugger_1.0.1.v201008170101.jar ./org.mozilla.javascript_1.7.2.v201005080400.jar Step 3. Created a new eclipse project named "test" Step 4. Linked an external directory "~/testrhino/" to this project "test". ~/testrhino/ contains ~/testrhino/bin ~/testrhino/build.xml ~/testrhino/classes ~/testrhino/lib/eclipse*jsdt*jars ~/testrhino/src/Test.java - Loads Run and executes test.js ~/testrhino/test.js Source code for Test.java ------------------------ import org.eclipse.wst.jsdt.debug.rhino.debugger.RhinoDebugger; //import org.eclipse.e4.languages.javascript.debug.rhino.RhinoDebugger; import org.mozilla.javascript.ContextFactory; import org.mozilla.javascript.*; import java.io.*; public class Test { public static void main(String args[]) throws Exception { Context cx=null; ContextFactory contextFactory = new ContextFactory(); // In eclipse this is generally provided via system property String rhinoDebug = "transport=socket,suspend=y,address=9000,trace=y"; if ( rhinoDebug != null) { RhinoDebugger debugger = new RhinoDebugger(rhinoDebug); debugger.start(); contextFactory.addListener(debugger); } try{ cx=contextFactory.enterContext(); ScriptableObject so=cx.initStandardObjects(); FileReader f=new FileReader("test.js"); cx.evaluateReader(so, f, "test.js", 1, null); }finally{ cx.exit(); } } } --> test.js is in Test.class classpath. 4. After running this Test.java in listening mode, launched eclipse javascript rhino debug connector on port 9000. It connected succesfully. Now loaded test.js from eclipse "test" project and set a breakpoint. Observed that, eclipse doesn't send breakpoint request to remote Rhino instance as the relative location of the test.js in eclipse project doesn't match with the relative location of the test.js in Rhino's Test.java's classpath. relative location that is observed in variable's view for test.js is test/testrhino/test.js but relative location in remmote rhino instance is "test.js". cx.evaluateReader(so, f, "test.js", 1, null); When eclipse jsdt request for script command, This is the script command response from remote rhino instance... {command=script, type=response, seq=6, request_seq=3, running=true, success=true, body={script={lines=[43, 48, 42, 44], functions=[sayHello], generated=false, location=test.js, source=...} When debugging JavascriptLineBreakpoint:149, observed that scriptPath coming as "test/testrhino/test.js" hence scriptPathMatches method at Line 159 of JavascriptLineBreakPoint.java always returns false as relative paths are not matched hence breakpoint request is not sent to remote rhino instance. It would be great if you let me know how to address this issue. Either i might not be setting up eclipse project correctly or there is a bug. This bug needs to be fixed to enable remote rhino debugging. I have spent 2 weeks to understand this eclipse rhino integration and nailed down the root cause to scriptPathMatches method where relative paths are not equal. Please let me know if you have any questions.