| 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"); | 9 #import("dart:json"); |
| 10 #import("dart:math", prefix: "Math"); | 10 #import("dart:math", prefix: "Math"); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 void quitShell() { | 58 void quitShell() { |
| 59 vmStream.close(); | 59 vmStream.close(); |
| 60 vmSock.close(); | 60 vmSock.close(); |
| 61 stdin.close(); | 61 stdin.close(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 Future sendCmd(Map<String, Dynamic> cmd) { | 65 Future sendCmd(Map<String, dynamic> cmd) { |
| 66 var completer = new Completer(); | 66 var completer = new Completer(); |
| 67 int id = cmd["id"]; | 67 int id = cmd["id"]; |
| 68 outstandingCommands[id] = completer; | 68 outstandingCommands[id] = completer; |
| 69 if (verbose) { | 69 if (verbose) { |
| 70 print("sending: '${JSON.stringify(cmd)}'"); | 70 print("sending: '${JSON.stringify(cmd)}'"); |
| 71 } | 71 } |
| 72 vmStream.writeString(JSON.stringify(cmd)); | 72 vmStream.writeString(JSON.stringify(cmd)); |
| 73 return completer.future; | 73 return completer.future; |
| 74 } | 74 } |
| 75 | 75 |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 }; | 541 }; |
| 542 vmInStream.onError = (err) { | 542 vmInStream.onError = (err) { |
| 543 print("Error in debug connection: $err"); | 543 print("Error in debug connection: $err"); |
| 544 quitShell(); | 544 quitShell(); |
| 545 }; | 545 }; |
| 546 vmInStream.onClosed = () { | 546 vmInStream.onClosed = () { |
| 547 print("VM debugger connection closed"); | 547 print("VM debugger connection closed"); |
| 548 quitShell(); | 548 quitShell(); |
| 549 }; | 549 }; |
| 550 } | 550 } |
| OLD | NEW |