Re: Solution to debugging eval code with JSD interface

"John J. Barton" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.