v8 debugger wire protocol for Rhino

Skip to first unread message

Bobby Rullo

May 19, 2010, 6:19:27 PM5/19/10
to dev-tech-js-...@lists.mozilla.org
Hi all,

I saw that there was some work being done by Attila Szegedi on making
Rhino talk the v8 debugger protocol, so I checked out the stuff at
dynalang, but it doesn't seem to be in a compilable state (missing
files, methods)- is there something more up-to-date somewhere else, or
has someone else done something similar?



Attila Szegedi

May 20, 2010, 3:23:16 AM5/20/10
to Bobby Rullo, dev-tech-js-...@lists.mozilla.org
No, it's not -- sorry about that. I never got proper amount of time to work on it, and what is in the repository is pretty much in "scratchpad" phase. Additionally, protocol documentation is both incomplete and outdated (at least it was when I last looked at it), so best I could do was reverse-engineering the protocol from its client-side code from ChromeDevTools Java source and V8 C++ source; quite daunting and slowing progress. And then there are impedance mismatches you'll inevitably run into - the protocol exposes a lot of implementation-specific V8 bits that don't have direct equivalents in Rhino (i.e. internal object handles, some stack constructs, etc.). All-in-all, it's a hard task. I estimate that if I could only work on this full time, I would probably need around two months to fully implement it. So, if anyone else wants to give it a shot, feel free to.


Bobby Rullo

May 25, 2010, 4:54:10 PM5/25/10
to Attila Szegedi, dev-tech-js-...@lists.mozilla.org

Thanks for the reply. I might end up giving it a shot. Once I dig in
there I'll probably have a few questions for you if you don't mind
helping me get up to speed a bit.

Thanks again,


Bobby Rullo

Jun 7, 2010, 8:53:54 PM6/7/10
to Simon Kaegi, dev-tech-js-...@lists.mozilla.org

This is awesome. I'll take a look and report back.


On May 26, 2010, at 11:58 AM, Simon Kaegi wrote:

> Eclipse JSDT has been working on a debug platform which for our
> integration
> with Rhino that uses a remote debugger protocol very similar to the v8
> protocol. The team is also working closely with the Firebug guys on a
> "crossfire" version. This is the first release of the JavaScript
> debugger
> however is fully functional and essentially done in terms of coding
> for this
> year's release -- we're now working on documentation.
> If you want to look at the code --
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jsdt/plugins/?root=WebTools_Project
> The "rhino.debugger" project is the bit that integrates with the rhino
> runtime and all the other "debug" projects help to provide the UI and
> JavaScript debug platform. The debugger is implemented as a
> ContextFactory.Listener and listens for a special property to provide
> configuration...
> ContextFactory contextFactory = new ContextFactory();
> String rhinoDebug = context.getProperty("rhino.debug"); // In
> eclipse this
> is generally provided via system property
> if ( rhinoDebug != null) {
> RhinoDebugger debugger = new RhinoDebugger(rhinoDebug);
> debugger.start();
> contextFactory.addListener(debugger);
> }
> This "rhinoDebug" string is something like the
> following -Drhino.debug=transport=socket,suspend=true,address=9000
> in this
> case e.g. a system property but you can of course inject that string
> into
> RhinoDebugger however you like.
> If you just want to use a rhino debugger well we're about to release
> RC3 and
> that version should be very close to the final bits. I'll provide a
> link
> when it's ready and perhaps put together a podcast to show how to
> use it.
> If you're keen and know your way around eclipse you can download a
> recent
> eclipse 3.6 build [1] as well as clicking through to the latest "wst
> sdk"
> build repo[2][3] and download that somewhere. Add the wst sdk zip as
> an
> archive in the install software ui and then install the "JavaScript
> Development Tooling" from the zipped repo and you should have the
> debugger.
> -Simon
> [1] Eclipse SDK -- http://download.eclipse.org/eclipse/downloads/
> [2] WTP Development - http://build.eclipse.org/webtools/committers/
> [3] WTP Release - http://download.eclipse.org/webtools/downloads/
> "Bobby Rullo" <bo...@metaweb.com> wrote in message
> news:mailman.727.1274307571.193...@lists.mozilla.org
> ...

> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> dev-tech-js-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Bobby Rullo

Jun 9, 2010, 8:47:27 PM6/9/10
to Simon Kaegi, dev-tech-js-...@lists.mozilla.org

This is perhaps a silly question, but can one use this debugger to
debug scripts that are compiled using the ClassCompiler?

I've gotten to the point where I can attach the debugger to an
existing ContextFactory, but the "debugger" keyword doesn't seem to
work - execution doesn't stop, the various Rhino threads all say
"running". I'm suspect that this is because I'm using compiled vs.
interpreted mode here.


Jürg Lehni

Jun 28, 2010, 8:27:54 AM6/28/10
to Simon Kaegi, dev-tech-js-...@lists.mozilla.org

Using the recently released Eclipse 3.6 and WTP 3.2, I was able to install the JavaScript Debugger through the standard 'Install New Software...' update.

I then used the org.eclipse.wst.jsdt.debug.rhino.debugger_1.0.0.v201005200117.jar file to bundle it with my standalone software that uses Rhino internally, created the RhinoDebugger as described in your message and managed to connect to it from Eclipse successfully!

But when I tried to debug any scripts, I run into a row of issues.

Whenever I try to set a breakpoint in any of the scripts, I get a lot of Exceptions such as the one below. Is there anything I am doing wrong?

This all looks very promising and I cannot wait to finally get it working.


at org.eclipse.wst.jsdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2490)
at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1016)
at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1480)
at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:734)
at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1417)
at org.eclipse.wst.jsdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2637)
at org.eclipse.wst.jsdt.core.dom.ASTConverter.convertToVariableDeclarationStatement(ASTConverter.java:2662)
at org.eclipse.wst.jsdt.core.dom.ASTConverter.checkAndAddMultipleLocalDeclaration(ASTConverter.java:317)
at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1142)
at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.convert(JavaScriptUnitResolver.java:262)
at org.eclipse.wst.jsdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:887)
at org.eclipse.wst.jsdt.core.dom.ASTParser.createAST(ASTParser.java:647)
at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:581)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:574)
at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:509)
at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:150)
at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:135)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Simon Kaegi

Jun 28, 2010, 10:00:58 AM6/28/10
Thanks Jürg,

...and I'm sorry you're hitting such a fundamental problem.
It looks like the JSDT AST generator is having a problem parsing your
JavaScript file and the problems is being highlighted when you try and set
the breakpoint. I've created a bug report from your comments here --

If you could please add yourself to the CC and provide any context and
script source that would really help narrow down the problem.


"Jürg Lehni" <li...@scratchdisk.com> wrote in message

Reply all
Reply to author
0 new messages