| 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:io"; | 8 import "dart:io"; |
| 9 import "dart:json" as json; | 9 import "dart:json" as json; |
| 10 import "dart:utf"; | 10 import "dart:utf"; |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 vmSubscription = stringStream.listen( | 568 vmSubscription = stringStream.listen( |
| 569 (String data) { | 569 (String data) { |
| 570 processVmData(data); | 570 processVmData(data); |
| 571 }, | 571 }, |
| 572 onDone: () { | 572 onDone: () { |
| 573 print("VM debugger connection closed"); | 573 print("VM debugger connection closed"); |
| 574 quitShell(); | 574 quitShell(); |
| 575 }, | 575 }, |
| 576 onError: (err) { | 576 onError: (err) { |
| 577 print("Error in debug connection: $err"); | 577 print("Error in debug connection: $err"); |
| 578 // TODO(floitsch): do we want to print the stack trace? |
| 578 quitShell(); | 579 quitShell(); |
| 579 }); | 580 }); |
| 580 stdinSubscription = stdin.transform(new StringDecoder()) | 581 stdinSubscription = stdin.transform(new StringDecoder()) |
| 581 .transform(new LineTransformer()) | 582 .transform(new LineTransformer()) |
| 582 .listen((String line) => processCommand(line)); | 583 .listen((String line) => processCommand(line)); |
| 583 }); | 584 }); |
| 584 } | 585 } |
| 585 | 586 |
| 586 void main() { | 587 void main() { |
| 587 Options options = new Options(); | 588 Options options = new Options(); |
| 588 List<String> arguments = options.arguments; | 589 List<String> arguments = options.arguments; |
| 589 if (arguments.length > 0) { | 590 if (arguments.length > 0) { |
| 590 arguments = <String>['--debug', '--verbose_debug']..addAll(arguments); | 591 arguments = <String>['--debug', '--verbose_debug']..addAll(arguments); |
| 591 Process.start(options.executable, arguments).then((Process process) { | 592 Process.start(options.executable, arguments).then((Process process) { |
| 592 process.stdin.close(); | 593 process.stdin.close(); |
| 593 process.exitCode.then((int exitCode) { | 594 process.exitCode.then((int exitCode) { |
| 594 print('${arguments.join(" ")} exited with $exitCode'); | 595 print('${arguments.join(" ")} exited with $exitCode'); |
| 595 }); | 596 }); |
| 596 debuggerMain(); | 597 debuggerMain(); |
| 597 }); | 598 }); |
| 598 } else { | 599 } else { |
| 599 debuggerMain(); | 600 debuggerMain(); |
| 600 } | 601 } |
| 601 } | 602 } |
| OLD | NEW |