OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, 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 foo() { |
| 15 var y; // Breakpoint |
| 16 return 123; |
| 17 } |
| 18 |
| 19 test() { |
| 20 if (true) { |
| 21 var temp = 777; |
| 22 } |
| 23 if (true) { |
| 24 var a = foo(); // Breakpoint |
| 25 if (true) { |
| 26 var s = 456; |
| 27 print(s); |
| 28 } |
| 29 } |
| 30 } |
| 31 |
| 32 main(List<String> arguments) { |
| 33 if (RunScript(testScript, arguments)) return; |
| 34 print("Hello from debuggee"); |
| 35 test(); |
| 36 print("Hello again"); |
| 37 } |
| 38 |
| 39 |
| 40 // Expected debugger events and commands. |
| 41 var testScript = [ |
| 42 MatchFrame(0, "main"), // Top frame in trace is function "main". |
| 43 Step(), |
| 44 MatchFrame(0, "main"), // Should still be in "main". |
| 45 SetBreakpoint(15), // Set breakpoint in function foo. |
| 46 SetBreakpoint(24), // Set breakpoint in function test. |
| 47 Resume(), |
| 48 MatchFrames(["test", "main"]), |
| 49 AssertLocalsNotVisible(["a"]), // Here, a is not in scope yet. |
| 50 Resume(), |
| 51 MatchFrames(["foo", "test", "main"]), |
| 52 AssertLocalsNotVisible(["a"], 1), // In the caller, a is not in scope. |
| 53 Step(), |
| 54 MatchLocals({"y": "null"}), // Expect y initialized to null. |
| 55 Resume(), |
| 56 ]; |
OLD | NEW |