| 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:utf"); |
| 11 |
| 10 | 12 |
| 11 Map<int, Completer> outstandingCommands; | 13 Map<int, Completer> outstandingCommands; |
| 12 | 14 |
| 13 Socket vmSock; | 15 Socket vmSock; |
| 14 String vmData; | 16 String vmData; |
| 15 OutputStream vmStream; | 17 OutputStream vmStream; |
| 16 int seqNum = 0; | 18 int seqNum = 0; |
| 17 | 19 |
| 18 bool verbose = false; | 20 bool verbose = false; |
| 19 | 21 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 void main() { | 423 void main() { |
| 422 outstandingCommands = new Map<int, Completer>(); | 424 outstandingCommands = new Map<int, Completer>(); |
| 423 vmSock = new Socket("127.0.0.1", 5858); | 425 vmSock = new Socket("127.0.0.1", 5858); |
| 424 vmStream = new SocketOutputStream(vmSock); | 426 vmStream = new SocketOutputStream(vmSock); |
| 425 var stdinStream = new StringInputStream(stdin); | 427 var stdinStream = new StringInputStream(stdin); |
| 426 stdinStream.onLine = () { | 428 stdinStream.onLine = () { |
| 427 processCommand(stdinStream.readLine()); | 429 processCommand(stdinStream.readLine()); |
| 428 }; | 430 }; |
| 429 var vmInStream = new SocketInputStream(vmSock); | 431 var vmInStream = new SocketInputStream(vmSock); |
| 430 vmInStream.onData = () { | 432 vmInStream.onData = () { |
| 431 var s = new String.fromCharCodes(vmInStream.read()); | 433 String s = decodeUtf8(vmInStream.read()); |
| 432 processVmData(s); | 434 processVmData(s); |
| 433 }; | 435 }; |
| 434 vmInStream.onError = (err) { | 436 vmInStream.onError = (err) { |
| 435 print("Error in debug connection: $err"); | 437 print("Error in debug connection: $err"); |
| 436 quitShell(); | 438 quitShell(); |
| 437 }; | 439 }; |
| 438 vmInStream.onClosed = () { | 440 vmInStream.onClosed = () { |
| 439 print("VM debugger connection closed"); | 441 print("VM debugger connection closed"); |
| 440 quitShell(); | 442 quitShell(); |
| 441 }; | 443 }; |
| 442 } | 444 } |
| OLD | NEW |