Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1091)

Unified Diff: test/mjsunit/debug-stepframe.js

Issue 690263004: Introduce new stepping mode to step into another frame. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix test case and fix throw-catch handling Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8f4ee4ca11ccaf8befd6c95ac2f8a0d0372266ea
--- /dev/null
+++ b/test/mjsunit/debug-stepframe.js
@@ -0,0 +1,111 @@
+// 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) {
+ try{
+ f1();
+ } catch (e) {
+ 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;
+ // Exit function by throw.
+ throw 1;
+ var v17 = 7;
+}
+
+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;
+var step_size;
+
+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]));
+ break_count += step_size;
+ exec_state.prepareStep(Debug.StepAction.StepFrame, step_size);
+ } catch (e) {
+ print(e + e.stack);
+ exception = e;
+ }
+}
+
+for (step_size = 1; step_size < 6; step_size++) {
+ print("step size = " + step_size);
+ break_count = 0;
+ Debug.setListener(listener);
+ debugger; // Break 0
+ f0();
+ Debug.setListener(null); // Break 14
+ assertTrue(break_count > 14);
+}
+
+assertNull(exception);
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698