Add breakpoints.

This adds a new per-compartment implementation of breakpoints and
reimplements the jsdbgapi.h "trap" entry points on top of it. Most
jsdbgapi.h-using code will still work, but there is no longer a single
runtime-wide trapList protected by a lock. Embeddings must follow the
compartment rules for thread safety.

JS_ClearAllTraps was removed, replaced by the per-compartment API
JS_ClearAllTrapsForCompartment.

The new implementation asserts that the PC passed to JS_SetTrap is
actually an offset of an instruction, not just a random number. This
caused quite a few tests to fail; fixes are included.

Added Debug.Script.prototype.setBreakpoint, getBreakpoints,
clearBreakpoint, and clearAllBreakpoints; and
Debug.prototype.clearAllBreakpoints.

In addition to tests targeting the new functionality, this changeset
includes some tests for Debug.Script.prototype.getLineOffsets, which is
hard to test without breakpoints.
This commit is contained in:
Jason Orendorff
2011-06-28 16:06:34 -05:00
parent 05d7d0c26a
commit 7d20f6a982
74 changed files with 1830 additions and 392 deletions

View File

@@ -360,3 +360,4 @@ MSG_DEF(JSMSG_DEBUG_LOOP, 277, 0, JSEXN_TYPEERR, "cannot debug an ob
MSG_DEF(JSMSG_DEBUG_NOT_IDLE, 278, 0, JSEXN_ERR, "can't start debugging: a debuggee script is on the stack")
MSG_DEF(JSMSG_DEBUG_BAD_OFFSET, 279, 0, JSEXN_TYPEERR, "invalid script offset")
MSG_DEF(JSMSG_DEBUG_BAD_LINE, 280, 0, JSEXN_TYPEERR, "invalid line number")
MSG_DEF(JSMSG_DEBUG_NOT_DEBUGGING, 281, 0, JSEXN_ERR, "can't set breakpoint: script global is not a debuggee")