Debugger: Difference between revisions

892 bytes added ,  23 March 2011
→‎Properties of the Debug.Frame Prototype Object: Add evalWithBindings to Debug.Frame.prototype.
(→‎Property Conventions: Clarify debug object property writability.)
(→‎Properties of the Debug.Frame Prototype Object: Add evalWithBindings to Debug.Frame.prototype.)
Line 262: Line 262:
<dl>
<dl>
<dt>eval(<i>code</i>)
<dt>eval(<i>code</i>)
<dd>Begin evaluating <i>code</i> in the scope of this frame. <i>Code</i> is a string. This pushes a <code>"debugger"</code> frame on the debuggee's stack, evaluates <i>code</i> with all extant hook functions active, and returns a value of the sort passed to an <code>enterFrame</code> completion function describing how the code completed.
<dd>Begin evaluating <i>code</i> in the scope of this frame. <i>Code</i> is a string. This pushes a <code>"debugger"</code> frame on the debuggee's stack, evaluates <i>code</i>, and returns a value of the sort passed to an <code>enterFrame</code> completion function describing how the code completed. All extant hook functions, breakpoints, watchpoints, and so on remain active during the call.


Note that, although this method mixes the debugger's own stack frames with the debuggee's, walking the stack only shows the debuggee's frames; the continuation of the debugger's call to this method, up to the debugging hook function call, is represented by a single <code>"debugger"</code> frame. The next younger frame is an <code>"eval"</code> frame running <i>code</i> itself.
Note that, although this method mixes the debugger's own stack frames with the debuggee's, walking the stack only shows the debuggee's frames; the continuation of the debugger's call to this method, up to the debugging hook function call, is represented by a single <code>"debugger"</code> frame. The next younger frame is an <code>"eval"</code> frame running <i>code</i> itself.
<dt>evalWithBindings(<i>code</i>, <i>bindings</i>)
<dd>Like <code>eval</code>, but evaluate <i>code</i> in the scope of this frame, extended with bindings from the object <i>bindings</i>. For each enumerable data property of <i>bindings</i> named <i>name</i> whose value is <i>value</i>, include a variable in the environment in which <i>code</i> is evaluated named <i>name</i>, whose value is <i>value</i>. Each <i>value</i> must be a debuggee value. (This is not like a <code>with</code> statement: <i>code</i> may access, assign to, and delete the introduced bindings without having any effect on the <i>bindings</i> object.)
This method allows debugger code to introduce temporary bindings that are visible to the given debuggee code and which refer to debugger-held debuggee values, without mutating any existing debuggee scope.


<dt>finish(<i>result</i>) <i>(future plan)</i>
<dt>finish(<i>result</i>) <i>(future plan)</i>
Confirmed users
497

edits