| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This test forks a second vm process that runs this dart script as | 5 // This test forks a second vm process that runs this dart script as |
| 6 // a debug target. | 6 // a debug target. |
| 7 // Run this test with option --wire to see the json messages sent | 7 // Run this test with option --wire to see the json messages sent |
| 8 // between the processes. | 8 // between the processes. |
| 9 // Run this test with option --verbose to see the stdout and stderr output | 9 // Run this test with option --verbose to see the stdout and stderr output |
| 10 // of the debug target process. | 10 // of the debug target process. |
| 11 | 11 |
| 12 import "debug_lib.dart"; | 12 import "debug_lib.dart"; |
| 13 | 13 |
| 14 bar(x) { | 14 bar(x) { |
| 15 print(x); | 15 print(x); |
| 16 } | 16 } |
| 17 | 17 |
| 18 bam(a) => bar(a); |
| 19 |
| 18 foo(i) { | 20 foo(i) { |
| 19 bar("baz"); | 21 bar("baz"); |
| 20 print(i); | 22 print(i); |
| 21 } | 23 } |
| 22 | 24 |
| 23 main() { | 25 main() { |
| 24 if (RunScript(testScript)) return; | 26 if (RunScript(testScript)) return; |
| 25 print("Hello from debuggee"); | 27 print("Hello from debuggee"); |
| 26 foo(42); | 28 foo(42); |
| 29 bam("bam"); |
| 27 print("Hello again"); | 30 print("Hello again"); |
| 28 } | 31 } |
| 29 | 32 |
| 30 | 33 |
| 31 // Expected debugger events and commands. | 34 // Expected debugger events and commands. |
| 32 var testScript = [ | 35 var testScript = [ |
| 33 MatchFrame(0, "main"), // Top frame in trace is function "main". | 36 MatchFrame(0, "main"), // Top frame in trace is function "main". |
| 34 Step(), | 37 Step(), |
| 35 MatchFrame(0, "main"), // Should still be in "main". | 38 MatchFrame(0, "main"), // Should still be in "main". |
| 36 SetBreakpoint(15), // Set breakpoint a line 15, in function bar. | 39 SetBreakpoint(15), // Set breakpoint a line 15, in function bar. |
| 37 Resume(), | 40 Resume(), |
| 38 MatchFrames(["bar", "foo", "main"]), | 41 MatchFrames(["bar", "foo", "main"]), |
| 39 MatchFrame(1, "foo"), | 42 MatchFrame(1, "foo"), |
| 43 SetBreakpoint(18), // Set breakpoint a line 18, in function bam. |
| 44 Resume(), |
| 45 MatchFrames(["bam", "main"]), |
| 46 Resume(), |
| 47 MatchFrames(["bar", "bam", "main"]), |
| 40 Resume(), | 48 Resume(), |
| 41 ]; | 49 ]; |
| OLD | NEW |