I think 'this' is always returning window within a breakpoint. So if you have to echo let's say, a, where a = (this, b), I think you would get a result that didn't reflect the real run. To recreate, try it with jsrt I went to the Circle function and added an alert that produces the following: when jsrt is run with no breakpoints, what is 'this' in function Circle? [object Object] And I assigned window.preserve_this = this Then I echoed preserve_this from jdb: jdb preserve_this [object Object] ok(preserve_this) r,c,a,q Now I restored Circle, so jsrt is back to factory settings. Now I put a breakpoint in Circle and echoed 'this' at the breakpoint prompt. b base 24269 bp: this [object global] Do you think my experiment is sound and can this be alleviated? thanks Kevin
I hope it made sense from context but I goofed here
> have to echo let's say, a, where a = (this, b), I think you would get a
I meant to say... if a = some_function(this,b). And you're trying to
diagnose why a gets undefined and the code crashes trying to use a, for
instance.
[-- Attachment #1: Type: text/plain, Size: 779 bytes --] Even if you could pass this to the eval function, and there are ways to do it, like eval.call(this,$bp), native eval seems to have no respect for this. It doesn't inject this into the compilation of the string. I fed this to the duktape shell and to the mozilla js shell. You would expect to get 3 and 3, but we get 3 and then undefined. t = {x:3, eval:eval, a:function(){print(this.x)}}; t.a(); t.eval("this.x"); Unless there is some other clever workaround, you'd have to say window.z=this,eval($bp) and refer to z as needed, assuming z was not already a local variable, and remembering to delete z when done (cleaning up), or var z = this; eval($bp); if the point of injection allows that syntax. This is getting kinda awkward but it's all I have. Karl Dahlke