How to debug javascript files through ClearScript ?

Apr 2, 2013 at 9:01 AM
I have a requirement in my project to load a javascript file in a editor( I used avlonedit) and provide a debugging feature like step in[F11] and step over[F10]. Is this possible in ClearScript ? If it is not how can I implement in ClearScript ?
Coordinator
Apr 2, 2013 at 4:56 PM
Hi Waqaar,

If you use V8ScriptEngine and enable debugging via V8ScriptEngineFlags.EnableDebugging, the underlying V8 code implements a TCP/IP-based, JSON-oriented debugging protocol. This protocol is documented here. This is probably your best bet.

Good luck!
Jul 18, 2013 at 4:42 AM
And if we just want to use the simple JScriptEngine from windows (it'll be enough for our purposes), how do you debug the script there? I tried adding debugger; attaching from another visualstudio process.

I'm sure it's something easy, but there's all the talk about Eclipse and such. but that'll be a deal breaker as I evaluate adding dynamic code to my particular project.
Coordinator
Jul 18, 2013 at 9:25 AM
Hi paulkth,

JScriptEngine supports script debugging via Visual Studio. Once your application has created an instance of JScriptEngine with debugging enabled, you should be able to attach the Visual Studio script debugger. You'll then see the list of loaded script documents in Solution Explorer; you can view the script code, set breakpoints, etc. The one caveat is that you cannot attach the script debugger if another debugger (managed or native) is already attached.

If on the other hand you need to implement a script debugger like Waqaar above, that's also possible, but it's a much bigger task, and it might be easier to create a debugger for V8 than for JScript/VBScript.

Good luck!
Jul 18, 2013 at 7:17 PM
Thanks, I got it. The trick was, as you said, "with debugging enabled"
_scriptEngine = new JScriptEngine(WindowsScriptEngineFlags.EnableDebugging);
Sep 24, 2013 at 8:03 PM
Hi there,
I would also like to implement a debugger for the JScript engine to enable debugging JScript from within my application, but either my Google-fu has gone bad or there is just to little information out there. If by chance you have any links pointing into that direction, I'd be grateful if you would share them.

A last resort would be utilizing Google V8-Engine's JSON debugging interface, but when I looked at the "documentation" and tried to make some sense of it, a bunch of question marks miraculously appeared, dangling over my head. :P

Regards,

Manfred
Coordinator
Sep 25, 2013 at 4:50 PM
Hi Manfred,

Unfortunately we can't offer much help in the area of debugger development, as we've never investigated it to any depth. There seem to be a handful of commercial Windows Script debuggers out there, but you're right, developer information is nearly nonexistent. On the V8 side, the Google Chrome Developer Tools for Java is open source.

Good luck!