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

Side by Side Diff: test/mjsunit/debug-liveedit-stepin.js

Issue 2503293002: [debug-wrapper] LiveEdit, frame.restart(), breakpoints (Closed)
Patch Set: Address comments Created 4 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/debug-liveedit-stack-padding.js ('k') | test/mjsunit/debug-liveedit-utils.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 2015 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 return '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.Break) return;
19 try {
20 var source_line = event_data.sourceLineText();
21 log.push(source_line);
22 if (source_line.indexOf("return") >= 0) {
23 switch (results.length) {
24 case 0:
25 break;
26 case 1:
27 Replace(BestEditor, "Emacs", "Eclipse");
28 break;
29 case 2:
30 Replace(BestEditor, "Eclipse", "Vim");
31 break;
32 default:
33 assertUnreachable();
34 }
35 }
36 exec_state.prepareStep(Debug.StepAction.StepIn);
37 } catch (e) {
38 exception = e;
39 }
40 };
41
42 function Replace(fun, original, patch) {
43 var script = Debug.findScript(fun);
44 if (fun.toString().indexOf(original) < 0) return;
45 var patch_pos = script.source.indexOf(original);
46 var change_log = [];
47 Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, original.lengt h, patch, change_log);
48 }
49
50 Debug.setListener(listener);
51
52 debugger;
53 results.push(BestEditor());
54 results.push(BestEditor());
55 results.push(BestEditor());
56 Debug.setListener(null);
57
58 assertNull(exception);
59 assertEquals(["Emacs", "Eclipse", "Vim"], results);
60 print(JSON.stringify(log, 1));
61 assertEquals([
62 "debugger;",
63 "results.push(BestEditor());",
64 " return 'Emacs';","}",
65 "results.push(BestEditor());",
66 "results.push(BestEditor());",
67 " return 'Emacs';",
68 " return 'Eclipse';","}",
69 "results.push(BestEditor());",
70 "results.push(BestEditor());",
71 " return 'Eclipse';",
72 " return 'Vim';",
73 "}","results.push(BestEditor());",
74 "Debug.setListener(null);"
75 ], log);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-liveedit-stack-padding.js ('k') | test/mjsunit/debug-liveedit-utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698