js/src/jit-test/tests/debug/breakpoint-multi-03.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // Multiple Debugger objects can set breakpoints at the same instruction.
     3 var g = newGlobal();
     4 function attach(g, i) {
     5     var dbg = Debugger(g);
     6     dbg.onDebuggerStatement = function (frame) {
     7         var s = frame.eval("f").return.script;
     8         var offs = s.getLineOffsets(g.line0 + 3);
     9         for (var j = 0; j < offs.length; j++)
    10             s.setBreakpoint(offs[j], {hit: function () { g.log += "" + i; }});
    11     };
    12 }
    14 g.eval("var line0 = Error().lineNumber;\n" +
    15        "function f() {\n" +     // line0 + 1
    16        "    log += 'a';\n" +    // line0 + 2
    17        "    log += 'b';\n" +    // line0 + 3
    18        "}\n");
    20 for (var i = 0; i < 3; i++)
    21     attach(g, i);
    23 g.log = '';
    24 g.eval('debugger;');
    25 g.log += 'x';
    26 g.f();
    27 assertEq(g.log, 'xa012b');

mercurial