| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --expose-debug-as debug | 5 // Flags: --expose-debug-as debug |
| 6 | 6 |
| 7 function f0() { | 7 function f0() { |
| 8 var v00 = 0; // Break 1 | 8 var v00 = 0; // Break 1 |
| 9 var v01 = 1; | 9 var v01 = 1; |
| 10 // Normal function call in a catch scope. | 10 // Normal function call in a catch scope. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 var b0 = f3.bind(o); | 76 var b0 = f3.bind(o); |
| 77 | 77 |
| 78 var o = {}; | 78 var o = {}; |
| 79 Object.defineProperty(o, "get", { get : get }); | 79 Object.defineProperty(o, "get", { get : get }); |
| 80 Object.defineProperty(o, "set", { set : set }); | 80 Object.defineProperty(o, "set", { set : set }); |
| 81 | 81 |
| 82 Debug = debug.Debug; | 82 Debug = debug.Debug; |
| 83 var break_count = 0 | 83 var break_count = 0 |
| 84 var exception = null; | 84 var exception = null; |
| 85 var step_size; | |
| 86 | 85 |
| 87 function listener(event, exec_state, event_data, data) { | 86 function listener(event, exec_state, event_data, data) { |
| 88 if (event != Debug.DebugEvent.Break) return; | 87 if (event != Debug.DebugEvent.Break) return; |
| 89 try { | 88 try { |
| 90 var line = exec_state.frame(0).sourceLineText(); | 89 var line = exec_state.frame(0).sourceLineText(); |
| 91 print(line); | 90 print(line); |
| 92 var match = line.match(/\/\/ Break (\d+)$/); | 91 var match = line.match(/\/\/ Break (\d+)$/); |
| 93 assertEquals(2, match.length); | 92 assertEquals(2, match.length); |
| 94 assertEquals(break_count, parseInt(match[1])); | 93 assertEquals(break_count, parseInt(match[1])); |
| 95 break_count += step_size; | 94 break_count ++; |
| 96 exec_state.prepareStep(Debug.StepAction.StepFrame, step_size); | 95 exec_state.prepareStep(Debug.StepAction.StepFrame); |
| 97 } catch (e) { | 96 } catch (e) { |
| 98 print(e + e.stack); | 97 print(e + e.stack); |
| 99 exception = e; | 98 exception = e; |
| 100 } | 99 } |
| 101 } | 100 } |
| 102 | 101 |
| 103 for (step_size = 1; step_size < 6; step_size++) { | 102 |
| 104 print("step size = " + step_size); | 103 break_count = 0; |
| 105 break_count = 0; | 104 Debug.setListener(listener); |
| 106 Debug.setListener(listener); | 105 debugger; // Break 0 |
| 107 debugger; // Break 0 | 106 f0(); |
| 108 f0(); | 107 Debug.setListener(null); // Break 16 |
| 109 Debug.setListener(null); // Break 16 | 108 assertTrue(break_count > 14); |
| 110 assertTrue(break_count > 14); | |
| 111 } | |
| 112 | 109 |
| 113 assertNull(exception); | 110 assertNull(exception); |
| OLD | NEW |