blob: 85f28a7bc897f129b811fc98931630ea2ceb6959 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// Copyright 2015 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
6
7function f() {
Ben Murdochc5610432016-08-08 18:44:38 +01008 print(1);
9 print(2);
10 print(3);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000011}
12
13var Debug = debug.Debug;
14var exception = null;
15var breaks = [];
16
17function listener(event, exec_state, event_data, data) {
18 if (event != Debug.DebugEvent.Break) return;
19 try {
20 Debug.debuggerFlags().breakPointsActive.setValue(false);
21 breaks.push(exec_state.frame().sourceLineText().trimLeft());
22 exec_state.prepareStep(Debug.StepAction.StepIn);
23 } catch (e) {
24 exception = e;
25 }
26}
27
28Debug.setListener(listener);
29Debug.setBreakPoint(f, 0, 0);
30
31f();
32
33Debug.setListener(null);
34Debug.debuggerFlags().breakPointsActive.setValue(true);
35
36assertNull(exception);
Ben Murdochc5610432016-08-08 18:44:38 +010037assertEquals(breaks, ["print(1);", "print(2);", "print(3);", "}",
38 "Debug.setListener(null);"]);