| 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 var localStr = "foo"; | 15 var localStr = "foo"; |
| 16 int localInt = 1; | 16 int localInt = 1; |
| 17 double localDouble = 1.1; | 17 double localDouble = 1.1; |
| 18 | 18 |
| 19 print(x); | 19 print(x); |
| 20 } | 20 } |
| 21 | 21 |
| 22 bam(a) => bar(a); | 22 bam(a) => bar(a); |
| 23 | 23 |
| 24 foo(i) { | 24 foo(i) { |
| 25 bar("baz"); | 25 bar("baz"); |
| 26 print(i); | 26 print(i); |
| 27 } | 27 } |
| 28 | 28 |
| 29 main() { | 29 main(List<String> arguments) { |
| 30 if (RunScript(testScript)) return; | 30 if (RunScript(testScript, arguments)) return; |
| 31 print("Hello from debuggee"); | 31 print("Hello from debuggee"); |
| 32 foo(42); | 32 foo(42); |
| 33 bam("bam"); | 33 bam("bam"); |
| 34 print("Hello again"); | 34 print("Hello again"); |
| 35 } | 35 } |
| 36 | 36 |
| 37 | 37 |
| 38 // Expected debugger events and commands. | 38 // Expected debugger events and commands. |
| 39 var testScript = [ | 39 var testScript = [ |
| 40 MatchFrame(0, "main"), // Top frame in trace is function "main". | 40 MatchFrame(0, "main"), // Top frame in trace is function "main". |
| 41 Step(), | 41 Step(), |
| 42 MatchFrame(0, "main"), // Should still be in "main". | 42 MatchFrame(0, "main"), // Should still be in "main". |
| 43 SetBreakpoint(19), // Set breakpoint a line 19, in function bar. | 43 SetBreakpoint(19), // Set breakpoint a line 19, in function bar. |
| 44 Resume(), | 44 Resume(), |
| 45 MatchFrames(["bar", "foo", "main"]), | 45 MatchFrames(["bar", "foo", "main"]), |
| 46 MatchFrame(1, "foo"), | 46 MatchFrame(1, "foo"), |
| 47 MatchLocals({"localStr": '"foo"', "localInt": "1", "localDouble": "1.1", | 47 MatchLocals({"localStr": '"foo"', "localInt": "1", "localDouble": "1.1", |
| 48 "x": '"baz"'}), | 48 "x": '"baz"'}), |
| 49 SetBreakpoint(22), // Set breakpoint a line 22, in function bam. | 49 SetBreakpoint(22), // Set breakpoint a line 22, in function bam. |
| 50 Resume(), | 50 Resume(), |
| 51 MatchFrames(["bam", "main"]), | 51 MatchFrames(["bam", "main"]), |
| 52 Resume(), | 52 Resume(), |
| 53 MatchFrames(["bar", "bam", "main"]), | 53 MatchFrames(["bar", "bam", "main"]), |
| 54 Resume(), | 54 Resume(), |
| 55 ]; | 55 ]; |
| OLD | NEW |