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 // Simple interactive debugger shell that connects to the Dart VM's debugger | 5 // Simple interactive debugger shell that connects to the Dart VM's debugger |
6 // connection port. | 6 // connection port. |
7 | 7 |
8 import "dart:convert"; | 8 import "dart:convert"; |
9 import "dart:io"; | 9 import "dart:io"; |
10 import "dart:async"; | 10 import "dart:async"; |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 print("Error in debug connection: $err"); | 619 print("Error in debug connection: $err"); |
620 // TODO(floitsch): do we want to print the stack trace? | 620 // TODO(floitsch): do we want to print the stack trace? |
621 quitShell(); | 621 quitShell(); |
622 }); | 622 }); |
623 stdinSubscription = stdin.transform(UTF8.decoder) | 623 stdinSubscription = stdin.transform(UTF8.decoder) |
624 .transform(new LineSplitter()) | 624 .transform(new LineSplitter()) |
625 .listen((String line) => processCommand(line)); | 625 .listen((String line) => processCommand(line)); |
626 }); | 626 }); |
627 } | 627 } |
628 | 628 |
629 void main() { | 629 void main(List<String> arguments) { |
630 Options options = new Options(); | |
631 List<String> arguments = options.arguments; | |
632 if (arguments.length > 0) { | 630 if (arguments.length > 0) { |
633 arguments = <String>['--debug', '--verbose_debug']..addAll(arguments); | 631 arguments = <String>['--debug', '--verbose_debug']..addAll(arguments); |
634 Process.start(options.executable, arguments).then((Process process) { | 632 Process.start(Platform.executable, arguments).then((Process process) { |
635 process.stdin.close(); | 633 process.stdin.close(); |
636 process.exitCode.then((int exitCode) { | 634 process.exitCode.then((int exitCode) { |
637 print('${arguments.join(" ")} exited with $exitCode'); | 635 print('${arguments.join(" ")} exited with $exitCode'); |
638 }); | 636 }); |
639 debuggerMain(); | 637 debuggerMain(); |
640 }); | 638 }); |
641 } else { | 639 } else { |
642 debuggerMain(); | 640 debuggerMain(); |
643 } | 641 } |
644 } | 642 } |
OLD | NEW |