Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Flags: --expose-debug-as debug --no-lazy |
| 6 | |
| 7 | Debug = debug.Debug; |
| 8 | var exception = null; |
| 9 | var break_count = 0; |
| 10 | |
| 11 | function f() { |
| 12 | function g(p) { |
| 13 | return 1; |
| 14 | } |
| 15 | g(1); |
| 16 | }; |
| 17 | |
| 18 | function listener(event, exec_state, event_data, data) { |
| 19 | try { |
| 20 | if (event == Debug.DebugEvent.Break) break_count++; |
| 21 | } catch (e) { |
| 22 | exception = e; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | Debug.setListener(listener); |
| 27 | var bp = Debug.setBreakPoint(f, 2); |
| 28 | f(); |
| 29 | Debug.clearBreakPoint(bp); |
| 30 | Debug.setListener(null); |
| 31 | |
| 32 | assertEquals(1, break_count); |
| 33 | assertNull(exception); |