User:GijsKruitbosch/DebuggerDoc

From MozillaWiki
< User:GijsKruitbosch
Revision as of 10:44, 30 March 2012 by GijsKruitbosch (talk | contribs) (Created page with "<h2>Loading the Debugger API </h2> <p>You'll need to include the <tt>jsdebugger.jsm</tt> module:<br><br> <code> Components.utils.import("resource://gre/module/jsdebugger.jsm"); <...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Loading the Debugger API

You'll need to include the jsdebugger.jsm module:

Components.utils.import("resource://gre/module/jsdebugger.jsm");

This will allow you to create a new debugger instance:

var dbg = new Debugger();

Note that debugger is a reserved word in JavaScript, and you won't be able to use that as a variable name.

Exceptions in my debugger hooks are breaking the debuggee!?

You need to set the debugger's uncaughtExceptionHook:

dbg.uncaughtExceptionHook = function(ex) { dump(ex.stack); }

See also the docs. There is a bug on file to make the default value more sensible (ie, not break debuggee code).