summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/regress/regress-3960.js
blob: 4aaab0b0674b7ae17a6a2a27f979e78673019c25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --allow-natives-syntax

// Test that setting break point is works correctly when the debugger is
// activated late, which leads to duplicate shared function infos.

(function() {
  var Debug = %GetDebugContext().Debug;

  function listener(event, exec_state, event_data, data) {
    if (event != Debug.DebugEvent.Break) return;
    try {
      assertTrue(/foo/.test(exec_state.frame(0).sourceLineText()));
      break_count++;
    } catch (e) {
      exception = e;
    }
  }

  for (var i = 0; i < 3; i++) {
    var foo = function() { a = 1; }
    var exception = null;
    var break_count = 0;
    Debug.setListener(listener);
    if (i < 2) Debug.setBreakPoint(foo, 0, 0);
    assertTrue(/\[B\d\]a = 1/.test(Debug.showBreakPoints(foo)));
    foo();
    assertEquals(1, break_count);
    assertNull(exception);
  }

  Debug.setListener(null);
})();