| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 if (true) { | 23 if (true) { |
| 24 var a = foo(); // Breakpoint | 24 var a = foo(); // Breakpoint |
| 25 if (true) { | 25 if (true) { |
| 26 var s = 456; | 26 var s = 456; |
| 27 print(s); | 27 print(s); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 test_no_init() { |
| 33 if (true) { |
| 34 var temp = 777; |
| 35 } |
| 36 if (true) { |
| 37 var a; // Breakpoint |
| 38 if (true) { |
| 39 var s = 456; |
| 40 print(s); |
| 41 } |
| 42 } |
| 43 } |
| 44 |
| 45 |
| 32 main(List<String> arguments) { | 46 main(List<String> arguments) { |
| 33 if (RunScript(testScript, arguments)) return; | 47 if (RunScript(testScript, arguments)) return; |
| 34 print("Hello from debuggee"); | 48 print("Hello from debuggee"); |
| 35 test(); | 49 test(); |
| 50 test_no_init(); |
| 36 print("Hello again"); | 51 print("Hello again"); |
| 37 } | 52 } |
| 38 | 53 |
| 39 | 54 |
| 40 // Expected debugger events and commands. | 55 // Expected debugger events and commands. |
| 41 var testScript = [ | 56 var testScript = [ |
| 42 MatchFrame(0, "main"), // Top frame in trace is function "main". | 57 MatchFrame(0, "main"), // Top frame in trace is function "main". |
| 43 Step(), | 58 Step(), |
| 44 MatchFrame(0, "main"), // Should still be in "main". | 59 MatchFrame(0, "main"), // Should still be in "main". |
| 45 SetBreakpoint(15), // Set breakpoint in function foo. | 60 SetBreakpoint(15), // Set breakpoint in function foo. |
| 46 SetBreakpoint(24), // Set breakpoint in function test. | 61 SetBreakpoint(24), // Set breakpoint in function test. |
| 62 SetBreakpoint(37), // Set breakpoint in function test_no_init. |
| 47 Resume(), | 63 Resume(), |
| 48 MatchFrames(["test", "main"]), | 64 MatchFrames(["test", "main"]), |
| 49 AssertLocalsNotVisible(["a"]), // Here, a is not in scope yet. | 65 AssertLocalsNotVisible(["a"]), // Here, a is not in scope yet. |
| 50 Resume(), | 66 Resume(), |
| 51 MatchFrames(["foo", "test", "main"]), | 67 MatchFrames(["foo", "test", "main"]), |
| 52 AssertLocalsNotVisible(["a"], 1), // In the caller, a is not in scope. | 68 AssertLocalsNotVisible(["a"], 1), // In the caller, a is not in scope. |
| 53 Step(), | 69 Step(), |
| 54 MatchLocals({"y": "null"}), // Expect y initialized to null. | 70 MatchLocals({"y": "null"}), // Expect y initialized to null. |
| 55 Resume(), | 71 Resume(), |
| 72 MatchFrames(["test_no_init", "main"]), |
| 73 AssertLocalsNotVisible(["a"]), // a is not in scope. |
| 74 Step(), |
| 75 MatchLocals({"a": "null"}), |
| 76 Resume() |
| 56 ]; | 77 ]; |
| OLD | NEW |