Trouble evaluating expression with JSD in SpiderMonkey 1.7

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

Trouble evaluating expression with JSD in SpiderMonkey 1.7

dassburger (Bugzilla)
Hello!

We develop some industrial system which uses SpiderMonkey as the
interpretator
for a script language. After we updated it from 1.5 to 1.7 we stuck
with a
problem in our script debugger. Consider the following example

 1: function pow3mine(x)
 2: {
 3:   return x*x*x;
 4: }
 5:
 6: function Btn1_Click()
 7: {
 8:   var x = 1;
 9:   var y = 5;
10:   var z = x + y;
11:   Log.WriteLine("z = " + z);
12:   for (i=0; i < 10; i++)
13:   {
14:     z = z + 1;
15:     Log.WriteLine('z now is ' + z);
16:     if (i % 2 == 0)
17:         Log.WriteLine('z^3 is ' + pow3mine(z));
18:   }
19: }
20:
21: function Btn2_Click()
22: {
23:   for (i=0; i<10; i++)
24:     Log.WriteLine('fjfjfj');
25: }

This script is evaluated with JS_EvaluateScript(). Then, with
JS_CallFunctionName()
we call Btn1_Click() which is a callback function for some event in
our system.
The execution of Btn1_Click() is interrupted at line 11 (by execution
hook) where
I try to evaluate expresssion "x" in order to get the value of
variable x. This
leads to access violation accessing address 0x00000004.

Further investigation shows that AV occurs at jsemit.c:1956:

    clasp = OBJ_GET_CLASS(cx, obj);

Here, obj (in fact it is fp->varobj) is a null-pointer. It turns out
that
MaybeSetupFrame in jsparse.c assignes null varobj to the expressions
frame pointer
when it tries to find the FP which contains local ("var") variables.
The FP which
was passed to JSD_EvaluateUCScriptInStackFrame is marked as
JSFRAME_SPECIAL
temporarily for the time of evaluation and is nok taken into account
by
MaybeSetupFrame. It takes the next frame down from it which has varobj
null.
I tried to comment marking the original frame as JSFRAME_SPECIAL but
the result
is that it can't find "x" variable.

So, my question is what is the right way to eval some expression in
execution
hook? Yes, we use JSD as debugging API for SpiderMonkey.
_______________________________________________
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: Trouble evaluating expression with JSD in SpiderMonkey 1.7

John J Barton
Dassburger wrote:
> So, my question is what is the right way to eval some expression in
> execution
> hook? Yes, we use JSD as debugging API for SpiderMonkey.

In Javascript, Firebug uses jsdIStackFrame.eval() available because the
execution hook provides the jsdIStackFrame of the call.

John.
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger