| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Library used by debugger wire protocol tests (standalone VM debugging). | 5 // Library used by debugger wire protocol tests (standalone VM debugging). |
| 6 | 6 |
| 7 library DartDebugger; | 7 library DartDebugger; |
| 8 | 8 |
| 9 import "dart:async"; | 9 import "dart:async"; |
| 10 import "dart:convert"; | 10 import "dart:convert"; |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // If the process was already dead exitCode is already | 587 // If the process was already dead exitCode is already |
| 588 // available and we call exit() in the next event loop cycle. | 588 // available and we call exit() in the next event loop cycle. |
| 589 // Otherwise this will wait for the process to exit. | 589 // Otherwise this will wait for the process to exit. |
| 590 targetProcess.exitCode.then((exitCode) { | 590 targetProcess.exitCode.then((exitCode) { |
| 591 print("process $targetPid terminated with exit code $exitCode."); | 591 print("process $targetPid terminated with exit code $exitCode."); |
| 592 if (errorsDetected) { | 592 if (errorsDetected) { |
| 593 print("\n===== Errors detected: ====="); | 593 print("\n===== Errors detected: ====="); |
| 594 for (int i = 0; i < errors.length; i++) print(errors[i]); | 594 for (int i = 0; i < errors.length; i++) print(errors[i]); |
| 595 print("============================\n"); | 595 print("============================\n"); |
| 596 } | 596 } |
| 597 exit(exitCode); | 597 exit(errors.length); |
| 598 }); | 598 }); |
| 599 cleanupDone = true; | 599 cleanupDone = true; |
| 600 } | 600 } |
| 601 } | 601 } |
| 602 | 602 |
| 603 | 603 |
| 604 bool RunScript(List script) { | 604 bool RunScript(List script) { |
| 605 var options = new Options(); | 605 var options = new Options(); |
| 606 if (options.arguments.contains("--debuggee")) { | 606 if (options.arguments.contains("--debuggee")) { |
| 607 return false; | 607 return false; |
| 608 } | 608 } |
| 609 verboseWire = options.arguments.contains("--wire"); | 609 verboseWire = options.arguments.contains("--wire"); |
| 610 | 610 |
| 611 // Port number 0 means debug target picks a free port dynamically. | 611 // Port number 0 means debug target picks a free port dynamically. |
| 612 var targetOpts = [ "--debug:0" ]; | 612 var targetOpts = [ "--debug:0" ]; |
| 613 targetOpts.add(Platform.script); | 613 targetOpts.add(Platform.script); |
| 614 targetOpts.add("--debuggee"); | 614 targetOpts.add("--debuggee"); |
| 615 print('args: ${targetOpts.join(" ")}'); | 615 print('args: ${targetOpts.join(" ")}'); |
| 616 | 616 |
| 617 Process.start(Platform.executable, targetOpts).then((Process process) { | 617 Process.start(Platform.executable, targetOpts).then((Process process) { |
| 618 print("Debug target process started, pid ${process.pid}."); | 618 print("Debug target process started, pid ${process.pid}."); |
| 619 process.stdin.close(); | 619 process.stdin.close(); |
| 620 var debugger = new Debugger(process, new DebugScript(script)); | 620 var debugger = new Debugger(process, new DebugScript(script)); |
| 621 }); | 621 }); |
| 622 return true; | 622 return true; |
| 623 } | 623 } |
| OLD | NEW |