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 --no-lazy | 5 // Flags: --no-lazy |
6 | 6 |
7 Debug = debug.Debug; | 7 Debug = debug.Debug; |
8 var exception = null; | 8 var exception = null; |
9 var break_count = 0; | 9 var break_count = 0; |
10 | 10 |
11 function f() { | 11 function f() { |
12 function g(p) { | 12 function g(p) { |
13 return 1; | 13 return 1; |
14 } | 14 } |
15 g(1); | 15 g(1); |
16 }; | 16 }; |
17 | 17 |
18 function listener(event, exec_state, event_data, data) { | 18 function listener(event, exec_state, event_data, data) { |
19 try { | 19 try { |
20 if (event == Debug.DebugEvent.Break) break_count++; | 20 if (event == Debug.DebugEvent.Break) break_count++; |
21 } catch (e) { | 21 } catch (e) { |
22 exception = e; | 22 exception = e; |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 Debug.setListener(listener); | 26 Debug.setListener(listener); |
27 var bp = Debug.setBreakPoint(f, 2); | 27 var bp = Debug.setBreakPoint(f, 2); |
28 f(); | 28 f(); |
29 Debug.clearBreakPoint(bp); | 29 Debug.clearBreakPoint(bp); |
30 Debug.setListener(null); | 30 Debug.setListener(null); |
31 | 31 |
32 assertEquals(1, break_count); | 32 assertEquals(1, break_count); |
33 assertNull(exception); | 33 assertNull(exception); |
OLD | NEW |