OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 // This test forks a second vm process that runs this dart script as | |
6 // a debug target. | |
7 // Run this test with option --wire to see the json messages sent | |
8 // between the processes. | |
9 // Run this test with option --verbose to see the stdout and stderr output | |
10 // of the debug target process. | |
11 | |
12 import "debug_lib.dart"; | |
13 | |
14 bar(x) { | |
15 print(x); | |
16 } | |
17 | |
18 main(List<String> arguments) { | |
19 if (RunScript(testScript, arguments)) return; | |
20 print("Hello from debuggee"); | |
21 [1,2].forEach(bar); // Causes implicit closure of bar to be compiled. | |
22 print("stop here"); // Stop here and set breakpoint in bar. | |
23 [3,4].forEach(bar); // Call bar closure and observe breakpoints being hit. | |
24 print("done"); | |
25 } | |
26 | |
27 | |
28 // Expected debugger events and commands. | |
29 var testScript = [ | |
30 MatchFrame(0, "main"), // Top frame in trace is function "main". | |
31 SetBreakpoint(22), // Set breakpoint a line 22, after bar closure is comp
iled. | |
32 Resume(), | |
33 MatchFrame(0, "main"), // Should be at line 22 in main. | |
34 MatchLine(22), | |
35 SetBreakpoint(15), // Set breakpoint in function bar. Bar has not been ca
lled | |
36 // through a regular function call at this point, only | |
37 // through a closure from forEach(). | |
38 Resume(), | |
39 MatchFrames(["bar", "forEach", "main"]), // Should be in closure function now
. | |
40 MatchLine(15), | |
41 MatchLocals({"x": "3"}), | |
42 Resume(), | |
43 MatchFrames(["bar", "forEach", "main"]), // Should be in closure function now
. | |
44 MatchLine(15), | |
45 MatchLocals({"x": "4"}), | |
46 Resume(), | |
47 ]; | |
OLD | NEW |