Debugger: Difference between revisions

Jump to navigation Jump to search
286 bytes added ,  8 March 2011
→‎Properties of the Debug Prototype Object: Clarify breakpoint handler calls.
(→‎Properties of the Debug Prototype Object: Clarify breakpoint handler calls.)
Line 58: Line 58:
Hook function calls are cross-compartment, same-thread calls. Hook functions run in the thread in which the event occurred, not in the thread that registered the hooks. (It is your responsibility to ensure that two threads don't try to run in the same compartment). Hook functions run in the compartment to which they belong, not in the debuggee's compartment.
Hook function calls are cross-compartment, same-thread calls. Hook functions run in the thread in which the event occurred, not in the thread that registered the hooks. (It is your responsibility to ensure that two threads don't try to run in the same compartment). Hook functions run in the compartment to which they belong, not in the debuggee's compartment.


Rather than keeping a reference to the <i>hooks</i> object and consulting it when events occur, this function copies the hook functions from the <i>hooks</i> object, and stores them internally. Once the call to <code>setHooks</code> has returned, changes to the <i>hooks</i> object have no effect on the debugger hooks in force.
Rather than keeping a reference to the <i>hooks</i> object and consulting it when each event occurs, this function copies the hook functions present in the <i>hooks</i> object, and stores them internally. Once the call to <code>setHooks</code> has returned, changes to the <i>hooks</i> object have no effect on the debugger hooks in force.


Note that if the debugger object is disabled, hook functions are not called; see the <code>enabled</code> property.
Note that if the debugger object is disabled, hook functions are not called; see the <code>enabled</code> property.
Line 66: Line 66:


<dt>setBreakpoint(<i>script</i>, <i>offset</i>, <i>handler</i>)
<dt>setBreakpoint(<i>script</i>, <i>offset</i>, <i>handler</i>)
<dd>Set a breakpoint at the bytecode instruction at <i>offset</i> in <i>script</i>. When execution reaches this point, SpiderMonkey calls the function <i>handler</i> in the debugger's compartment, passing no arguments. Replace any existing trap at the given instruction.
<dd>Set a breakpoint at the bytecode instruction at <i>offset</i> in <i>script</i>. When execution reaches this point, call the function <i>handler</i>, passing no arguments. This call replaces any existing breakpoint at the given location.
 
Breakpoint handler calls are cross-compartment, intra-thread calls: <i>handler</i> must be a function in the debugger's compartment (and thus calls to it take place in the debugger's compartment), and the call takes place in the same thread that hit the breakpoint.


The new breakpoint belongs to this <code>Debug</code> instance; disabling the <code>Debug</code> instance disables this breakpoint.
The new breakpoint belongs to this <code>Debug</code> instance; disabling the <code>Debug</code> instance disables this breakpoint.
Line 100: Line 102:
Watchpoint handler calls are cross-compartment, intra-thread calls: <i>handler</i> must be a function in the debugger's compartment (and thus calls to it take place in the debugger's compartment), and the call takes place in the same thread that changed the property.
Watchpoint handler calls are cross-compartment, intra-thread calls: <i>handler</i> must be a function in the debugger's compartment (and thus calls to it take place in the debugger's compartment), and the call takes place in the same thread that changed the property.


When this <code>Debug</code> instance is disabled, the watchpoints it owns are also disabled.
The new watchpoint belongs to this <code>Debug</code> instance; disabling the <code>Debug</code> instance disables this watchpoint.


<dt>clearPropertyWatchpoint(<i>object</i>, <i>name</i>) <i>(future plan)</i>
<dt>clearPropertyWatchpoint(<i>object</i>, <i>name</i>) <i>(future plan)</i>
Confirmed users
497

edits

Navigation menu