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

Unified Diff: test/mjsunit/debug-liveedit-exceptions.js

Issue 1973213003: [liveedit] fix stepping after replacing bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@liveeditbreaks
Patch Set: add another testcase Created 4 years, 7 months 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') | test/mjsunit/debug-liveedit-stepin.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/debug-liveedit-exceptions.js
diff --git a/test/mjsunit/debug-liveedit-exceptions.js b/test/mjsunit/debug-liveedit-exceptions.js
new file mode 100644
index 0000000000000000000000000000000000000000..28ec01dbad5bff921a61dcd5714e58c63e19e605
--- /dev/null
+++ b/test/mjsunit/debug-liveedit-exceptions.js
@@ -0,0 +1,67 @@
+// Copyright 2016 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
+
+Debug = debug.Debug
+
+function BestEditor() {
+ throw 'Emacs';
+}
+
+var exception = null;
+var results = [];
+var log = []
+
+function listener(event, exec_state, event_data, data) {
+ if (event != Debug.DebugEvent.Exception) return;
+ try {
+ var source_line = event_data.sourceLineText();
+ print(source_line);
+ log.push(source_line);
+ switch (results.length) {
+ case 0:
+ Replace(BestEditor, "Emacs", "Eclipse");
+ break;
+ case 1:
+ Replace(BestEditor, "Eclipse", "Vim");
+ break;
+ case 2:
+ break;
+ default:
+ assertUnreachable();
+ }
+ } catch (e) {
+ exception = e;
+ }
+};
+
+function Replace(fun, original, patch) {
+ var script = Debug.findScript(fun);
+ if (fun.toString().indexOf(original) < 0) return;
+ var patch_pos = script.source.indexOf(original);
+ var change_log = [];
+ Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, original.length, patch, change_log);
+}
+
+Debug.setListener(listener);
+Debug.setBreakOnException();
+
+for (var i = 0; i < 3; i++) {
+ try {
+ BestEditor();
+ } catch (e) {
+ results.push(e);
+ }
+}
+Debug.setListener(null);
+
+assertNull(exception);
+assertEquals(["Emacs", "Eclipse", "Vim"], results);
+print(JSON.stringify(log, 1));
+assertEquals([
+ " throw 'Emacs';",
+ " throw 'Eclipse';",
+ " throw 'Vim';",
+], log);
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/mjsunit/debug-liveedit-stepin.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698