|
1 // |jit-test| debug |
|
2 // The GC can cope with old and new breakpoints at the same position. |
|
3 |
|
4 // This is a regression test for a bug Bill McCloskey found just by looking at |
|
5 // the source code. See bug 677386 comment 8. Here we're testing that the trap |
|
6 // string is correctly marked. (The silly expression for the trap string is to |
|
7 // ensure that it isn't constant-folded; it's harder to get a compile-time |
|
8 // constant to be GC'd.) |
|
9 |
|
10 var g = newGlobal(); |
|
11 g.eval("var d = 0;\n" + |
|
12 "function f() { return 'ok'; }\n" + |
|
13 "trap(f, 0, Array(17).join('\\n') + 'd++;');\n"); |
|
14 |
|
15 var dbg = new Debugger; |
|
16 var gw = dbg.addDebuggee(g); |
|
17 var fw = gw.getOwnPropertyDescriptor("f").value; |
|
18 var bp = {hits: 0, hit: function (frame) { this.hits++; }}; |
|
19 fw.script.setBreakpoint(0, bp); |
|
20 |
|
21 gc(); |
|
22 |
|
23 g.f(); |
|
24 assertEq(g.d, 1); |
|
25 assertEq(bp.hits, 1); |