• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// 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() {
8  1;
9  2;
10  3;
11}
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);
37assertEquals(breaks, ["1;", "2;", "3;", "}", "Debug.setListener(null);"]);
38