OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, 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 // Test to verify that a breakpoint can be set in code that is not yet |
| 6 // loaded, i.e. in a deferred library. |
| 7 // |
| 8 // This test forks a second vm process that runs this dart script as |
| 9 // a debug target. |
| 10 // Run this test with option --wire to see the json messages sent |
| 11 // between the processes. |
| 12 // Run this test with option --verbose to see the stdout and stderr output |
| 13 // of the debug target process. |
| 14 |
| 15 import "debug_lib.dart"; |
| 16 import "deferred_code_lib.dart" deferred as D; |
| 17 |
| 18 |
| 19 main(List<String> arguments) { |
| 20 if (RunScript(testScript, arguments)) return; |
| 21 var loaded = false; |
| 22 print("Hello from debuggee"); |
| 23 D.loadLibrary().then((_) { |
| 24 loaded = true; |
| 25 print("Done loading deferred library"); |
| 26 D.stopTheBuck(); |
| 27 }); |
| 28 print("main terminates"); |
| 29 } |
| 30 |
| 31 |
| 32 // Expected debugger events and commands. |
| 33 var testScript = [ |
| 34 MatchFrame(0, "main"), // Top frame in trace is function "main". |
| 35 SetBreakpoint(22), // Breakpoint just before call to loadLibrary(). |
| 36 Resume(), |
| 37 // Set BP in deferred library code before the loadLibrary() call is executed. |
| 38 MatchFrame(0, "main"), |
| 39 MatchLine(22), |
| 40 MatchLocals({"loaded": "false"}), |
| 41 SetBreakpoint(10, url: "deferred_code_lib.dart"), |
| 42 Resume(), |
| 43 MatchFrame(0, "stopTheBuck"), // Expect to be stopped in deferred library cod
e. |
| 44 // MatchLine(10), // Line matching only works for the main script. |
| 45 Resume(), |
| 46 ]; |
OLD | NEW |