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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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
7 Debug = debug.Debug
8
9 function BestEditor() {
10 throw 'Emacs';
11 }
12
13 var exception = null;
14 var results = [];
15 var log = []
16
17 function listener(event, exec_state, event_data, data) {
18 if (event != Debug.DebugEvent.Exception) return;
19 try {
20 var source_line = event_data.sourceLineText();
21 print(source_line);
22 log.push(source_line);
23 switch (results.length) {
24 case 0:
25 Replace(BestEditor, "Emacs", "Eclipse");
26 break;
27 case 1:
28 Replace(BestEditor, "Eclipse", "Vim");
29 break;
30 case 2:
31 break;
32 default:
33 assertUnreachable();
34 }
35 } catch (e) {
36 exception = e;
37 }
38 };
39
40 function Replace(fun, original, patch) {
41 var script = Debug.findScript(fun);
42 if (fun.toString().indexOf(original) < 0) return;
43 var patch_pos = script.source.indexOf(original);
44 var change_log = [];
45 Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, original.lengt h, patch, change_log);
46 }
47
48 Debug.setListener(listener);
49 Debug.setBreakOnException();
50
51 for (var i = 0; i < 3; i++) {
52 try {
53 BestEditor();
54 } catch (e) {
55 results.push(e);
56 }
57 }
58 Debug.setListener(null);
59
60 assertNull(exception);
61 assertEquals(["Emacs", "Eclipse", "Vim"], results);
62 print(JSON.stringify(log, 1));
63 assertEquals([
64 " throw 'Emacs';",
65 " throw 'Eclipse';",
66 " throw 'Vim';",
67 ], log);
OLDNEW
« 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