Debugger: Difference between revisions

Jump to navigation Jump to search
m
→‎Beginning to Debug: Describe Debug methods the way we described Debug.Frame methods.
m (→‎Debug.Frame: more formatting and clarifications.)
m (→‎Beginning to Debug: Describe Debug methods the way we described Debug.Frame methods.)
Line 22: Line 22:


The <i>object</i> must be in a different compartment than the calling code, and debugger/debuggee compartments may not form a cycle. <i>Object</i>'s compartment must not be in use by another thread while this call runs.
The <i>object</i> must be in a different compartment than the calling code, and debugger/debuggee compartments may not form a cycle. <i>Object</i>'s compartment must not be in use by another thread while this call runs.
</dl>


<dt><i>D</i>.setHooks(<i>hooks</i>)
Instances of <code>Debug</code> have the following methods:
<dd>Use the functions in <i>hooks</i> to handle events occurring in D's debuggee. <i>Hooks</i> should be an object; each property should be named after a debugging event, and its value should be a function SpiderMonkey should call when the named event occurs. See below for descriptions of specific debugging hooks.


This removes all previously registered hooks; after the call, only the hooks mentioned in <i>hooks</i> are in force. Thus, a call like <code><i>D</i>.setHooks({})</code> removes all debugging hooks.
<dl>
<dt>setHooks(<i>hooks</i>)
<dd>Use the functions in <i>hooks</i> to handle events occurring in this debuggee. <i>Hooks</i> should be an object; each property should be named after a debugging event, and its value should be a function SpiderMonkey should call when the named event occurs. See below for descriptions of specific debugging hooks.
 
This removes all previously registered hooks; after the call, only the hooks mentioned in <i>hooks</i> are in force. Thus, a call like <code>setHooks({})</code> removes all debugging hooks.


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.


<dt><i>D</i>.getHooks()
<dt>getHooks()
<dd>Return an object holding all the event hooks currently in force. The returned object is suitable for use with <code><i>D</i>.setHooks</code>.
<dd>Return an object holding all the event hooks currently in force. The returned object is suitable for use with <code>setHooks</code>.
</dl>
</dl>


Confirmed users
497

edits

Navigation menu