OLD | NEW |
---|---|
(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 var exception = null; | |
10 var break_count = 0; | |
Jakob Kummerow
2015/12/07 09:20:14
nit: unused variable
| |
11 var log = []; | |
12 | |
13 function listener(event, exec_state, event_data, data) { | |
14 if (event != Debug.DebugEvent.Break) return; | |
15 try { | |
16 print(event_data.sourceLineText()); | |
17 var entry = ""; | |
18 for (var i = 0; i < exec_state.frameCount(); i++) { | |
19 entry += exec_state.frame(i).sourceLineText().substr(-1); | |
20 entry += exec_state.frame(i).sourceColumn(); | |
21 } | |
22 log.push(entry); | |
23 exec_state.prepareStep(Debug.StepAction.StepIn, 1); | |
24 } catch (e) { | |
25 exception = e; | |
26 } | |
27 }; | |
28 | |
29 function u(x) { | |
30 return x.toUpperCase(); // d | |
31 } // e | |
32 | |
33 var n = 3; | |
34 | |
35 var o = { | |
36 toString: function() { | |
37 return "D"; // f | |
38 } // g | |
39 } | |
40 | |
41 | |
42 | |
43 Debug.setListener(listener); | |
44 debugger; // a | |
45 var s = `1 ${u("a")} 2 ${u("b")} 3 ${n} 4 ${o}`; // b | |
46 Debug.setListener(null); // c | |
47 | |
48 assertNull(exception); | |
49 | |
50 assertEquals([ | |
51 "a0", | |
52 "b0", | |
53 "d2b13", | |
54 "e0b13", | |
55 "b25", | |
56 "d2b25", | |
57 "e0b25", | |
58 "f4b44", | |
59 "g2b44", | |
60 "c0" | |
61 ], log); | |
OLD | NEW |