Debugger

From MozillaWiki
Revision as of 01:16, 26 February 2011 by Jimb (talk | contribs) (If wishes were horses, debuggers would ride.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

SpiderMonkey should provide a debug object with functions providing a safe JavaScript interface to the JSDBGAPI facilities and the debugging hooks. This would be an alternative to JSD, a basis for the future debugging protocol server, and make it easy to test debugging facilities in SM's current JS-based test suite. It will begin life rough and rudimentary, so that we can release early and often as we improve it.

The debug object should be part of SpiderMonkey itself, not a separate directory like JSD. Embeddings would call something like JS_DefineDebugFunctions to add the debugging functions to their global if desired.

To avoid dependencies that may might be annoying to embedders, it should be in straight C++, not based on an IDL interface, to permit an idiomatic JS API (using objects the way Object.getOwnPropertyDescriptor does, for example).

The API should be safe, in that a buggy debugger should not be able to crash SpiderMonkey.

It should use compartments to enforce the boundary between the debugger and debuggee. It should protect the debugger from the debuggee's getters, setters, and so on; it should prevent the debuggee from referring to the debugger's objects at all; it should prevent the debugger from inserting breakpoints in its own code; and so on.

It should be nestable: it should support debugging debuggers. Placing debugger and debuggee in separate compartments makes it clear to whom each trap should be reported.

Having JSDBGAPI functionality available at the JS level will make it easier to test debugging functionality, since it will be testable via ordinary js/src/tests-style tests.

The initial cut will be as direct as practical a reflection of the existing JSDBGAPI functions and debug hooks, so that we can release early and often. The API will be unstable until we've done more hacking and have a better idea what we want.