Hook Eval execution.

121 views
Skip to first unread message

Lautaro Dolberg

unread,
Jul 26, 2010, 12:20:56 PM7/26/10
to Firebug
Hello, I'm working with the jsd services for trapping javascript
execution but I noticed that the jsd.functionHook {onCall:} does not
trap the eval() code.
Is there any hook on the service for traping code executed via eval()?
Thanks in advance. Lautaro Dolberg

John J Barton

unread,
Jul 26, 2010, 12:48:52 PM7/26/10
to Firebug
I don't understand your question. jsd.functionHook is called for JS
function call and return. eval() looks like a function but it is a
platform call and they don't show up in jsd.functionHook.

Code executed via eval() is almost exactly like code executed by
<script> tag:
1) Current flow is interrupted (page parsing for script tag, JS
function for eval).
2) text is compiled,
3) outer (aka top-level aka file-scope) function runs,
4) Current flow continues.
(This similarity makes all the comments about eval being somehow evil
or special puzzling to me).
The funky thing about eval() in Mozilla's implementation is that the
file name is the outer file name and the line numbers make the
functions appear to overlay the outer source. That makes debugging
eval() impossible with jsd,

jjb

Lautaro Dolberg

unread,
Jul 28, 2010, 4:05:34 AM7/28/10
to Firebug
Hello. Im still working on how to trace eval execution, but since is
not posible using JSD I'm still looking for a mechanism that allow me
instrument the code.
I have been reading this material
http://www.almaden.ibm.com/u/bartonjj/fireclipse/test/DynLoadTest/WebContent/DynamicJavascriptErrors.htm
But does somebody has already passed trough this or might know where I
should read (Documentation, API, etc).
Thanks. Lautaro

Lautaro Dolberg

unread,
Jul 28, 2010, 5:51:14 AM7/28/10
to Firebug
Hello.
John: Im intrested in how did you set breakpoints at some PC value (0
in you article) so the hook for the breakpoints its executed.
Thanks. Lautaro

On 28 juil, 10:05, Lautaro Dolberg <lautaro.dolb...@gmail.com> wrote:
> Hello. Im still working on how to trace eval execution, but since is
> not posible using JSD I'm still looking for a mechanism that allow me
> instrument the code.
> I have been reading this materialhttp://www.almaden.ibm.com/u/bartonjj/fireclipse/test/DynLoadTest/Web...

John J Barton

unread,
Jul 28, 2010, 10:34:08 AM7/28/10
to Firebug


On Jul 28, 1:05 am, Lautaro Dolberg <lautaro.dolb...@gmail.com> wrote:
> Hello. Im still working on how to trace eval execution, but since is
> not posible using JSD I'm still looking for a mechanism that allow me
> instrument the code.
> I have been reading this materialhttp://www.almaden.ibm.com/u/bartonjj/fireclipse/test/DynLoadTest/Web...
> But does somebody has already passed trough this or might know where I
> should read (Documentation, API, etc).

You can also read our paper from WWW 2010,
http://getfirebug.com/doc/breakpoints/paper/breakpoints.pdf

I don't know of any jsd documentation other than the source, esp
http://mxr.mozilla.org/mozilla1.9.2/source/js/jsd/idl/jsdIDebuggerService.idl
In any case you need to ask mozilla folks, it's their code.

jjb

John J Barton

unread,
Jul 28, 2010, 10:37:12 AM7/28/10
to Firebug


On Jul 28, 2:51 am, Lautaro Dolberg <lautaro.dolb...@gmail.com> wrote:
> Hello.
> John:  Im intrested in how did you set breakpoints at some PC value (0
> in you article) so the hook for the breakpoints its executed.

It's just:
script.setBreakpoint(0);

http://code.google.com/p/fbug/source/browse/branches/firebug1.6/modules/firebug-service.js#1764

jjb
Reply all
Reply to author
Forward
0 new messages