Partial solution to debugging eval() code

"John J. Barton" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Message-ID <[email protected]>
I have worked out a partial solution to the issues discussed in Bug 
#307984, that eval() code line numbers appear to overlap regular code.
For errors in compile, I recompute the line number and extract the 
source into a data: url.  For run time, I breakpoint the eval-creation 
script in an onScriptCreated hook and re-eval it with a file name using
jsdIStackFrame.eval().  Some more details:

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

I implemented this in Firebug and I'll make that code available soon.

Unfortunately the key use case for this code is dojo, and for that the
implementation is not quite enough.  As far as I can tell, dojo calls 
eval() from eval() code. Errors in the second eval() will, in my scheme,
be within the jsdIStackFrame.eval() call.  Code below this call seems to 
be "undebuggable", that I cannot breakpoint it etc.

The question is why?  I cannot see from the spidermonkey or jsd code why
this eval will not act like normal eval.  I do see a number of flags 
that indicate that it is *intended* to be different (eg 
JSFRAME_DEBUGGER), but I can't find where these flags are tested.  I am 
hoping that there may be some way to defeat this and allow such code to 
be debugged.

As it stands the partial implementation should help some folks and 
especially it will help determine if data: url is a good naming scheme.
(Its pretty horrible for debugger debugging BTW ;-).

John.
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.