Solution to debugging eval code with JSD interface

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Solution to debugging eval code with JSD interface

John J Barton
Thanks to hints from people here, I found a way to debug eval() code
using the current JSD interface. I track all jsdIScript objects created
using onScriptCreated. For objects from eval() calls I create a maps
indexed by jsdIScript.tag giving the eval() source buffer and new
baseLineNumber.  Then whenever the debugger needs source (and would use
jdsIScript.fileName) I check these maps.  Details are here:

http://www.almaden.ibm.com/cs/people/bartonjj/fireclipse/test/DynLoadTest/WebContent/DynamicJavascriptErrors.htm

I will be working to help Joe Hewitt include this in Firebug and to help
the Eclipse ATF team to include this in their debugger.

John.
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Solution to debugging eval code with JSD interface

James Ross
John J. Barton wrote:
> Thanks to hints from people here, I found a way to debug eval() code
> using the current JSD interface. I track all jsdIScript objects created
> using onScriptCreated. For objects from eval() calls I create a maps
> indexed by jsdIScript.tag giving the eval() source buffer and new
> baseLineNumber.  Then whenever the debugger needs source (and would use
> jdsIScript.fileName) I check these maps.  Details are here:

I don't have the time to read any details right now (at work), but is
this the same as using the pretty print source option in JSD, or is
there some other method you use for obtaining the source to these
virtual files?

--
James Ross <[hidden email]>
ChatZilla Developer
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Solution to debugging eval code with JSD interface

John J Barton
James Ross wrote:

> John J. Barton wrote:
>> Thanks to hints from people here, I found a way to debug eval() code
>> using the current JSD interface. I track all jsdIScript objects created
>> using onScriptCreated. For objects from eval() calls I create a maps
>> indexed by jsdIScript.tag giving the eval() source buffer and new
>> baseLineNumber.  Then whenever the debugger needs source (and would use
>> jdsIScript.fileName) I check these maps.  Details are here:
>
> I don't have the time to read any details right now (at work), but is
> this the same as using the pretty print source option in JSD, or is
> there some other method you use for obtaining the source to these
> virtual files?
>
I use jsdIStackFrame.eval("new String("+evalExpr+");") to get the
source. I construct the evalExpr by looking at the source of the caller
of the eval(), relying on the supposed immutable name "eval".  Surely
there are cases where the evalExpr will be tough to extract without
a full parser (I'm just using regexp), but I guess most cases that
programmers write will work.
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger