Chromium Code Reviews| Index: test/mjsunit/debug-stepframe.js |
| diff --git a/test/mjsunit/debug-stepframe.js b/test/mjsunit/debug-stepframe.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e34ee7d7063d2de3bf489fe895ae2466b4ae8d37 |
| --- /dev/null |
| +++ b/test/mjsunit/debug-stepframe.js |
| @@ -0,0 +1,98 @@ |
| +// Copyright 2014 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: --expose-debug-as debug |
| + |
| +function f0() { |
| + var v00 = 0; // Break 1 |
| + var v01 = 1; |
| + // Normal function call in a catch scope. |
| + try { |
| + throw 1; |
| + } catch (e) { |
| + f1(); // Break 3 |
|
aandrey
2014/11/04 17:28:18
remove comment? should be no break here.
Yang
2014/11/04 17:30:13
right. this is outdated.
|
| + var v02 = 2; // Break 13 |
| + } |
| + var v03 = 3; |
| + var v04 = 4; |
| +} |
| + |
| +function f1() { |
| + var v10 = 0; // Break 2 |
| + var v11 = 1; |
| + // Getter call. |
| + var v12 = o.get; |
| + var v13 = 3 // Break 4 |
| + // Setter call. |
| + o.set = 2; |
| + var v14 = 4; // Break 6 |
| + // Function.prototype.call. |
| + f2.call(); |
| + var v15 = 5; // Break 12 |
| + var v16 = 6; |
| +} |
| + |
| +function get() { |
| + var g0 = 0; // Break 3 |
| + var g1 = 1; |
| + return 3; |
| +} |
| + |
| +function set() { |
| + var s0 = 0; // Break 5 |
| + return 3; |
| +} |
| + |
| +function f2() { |
| + var v20 = 0; // Break 7 |
| + // Construct call. |
| + var v21 = new c0(); |
| + var v22 = 2; // Break 9 |
| + // Bound function. |
| + b0(); |
| + return 2; // Break 11 |
| +} |
| + |
| +function c0() { |
| + this.v0 = 0; // Break 8 |
| + this.v1 = 1; |
| +} |
| + |
| +function f3() { |
| + var v30 = 0; // Break 10 |
| + var v31 = 1; |
| + return 3; |
| +} |
| + |
| +var b0 = f3.bind(o); |
| + |
| +var o = {}; |
| +Object.defineProperty(o, "get", { get : get }); |
| +Object.defineProperty(o, "set", { set : set }); |
| + |
| +Debug = debug.Debug; |
| +var break_count = 0 |
| +var exception = null; |
| + |
| +function listener(event, exec_state, event_data, data) { |
| + if (event != Debug.DebugEvent.Break) return; |
| + try { |
| + var line = exec_state.frame(0).sourceLineText(); |
| + print(line); |
| + var match = line.match(/\/\/ Break (\d+)$/); |
| + assertEquals(2, match.length); |
| + assertEquals(break_count++, parseInt(match[1])); |
| + exec_state.prepareStep(Debug.StepAction.StepFrame, 1); |
| + } catch (e) { |
| + exception = e; |
| + } |
| +} |
| + |
| +Debug.setListener(listener); |
| +debugger; // Break 0 |
| +f0(); |
| +Debug.setListener(null); // Break 14 |
| + |
| +assertEquals(15, break_count); |
| +assertNull(exception); |