| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 index = skipString(index); | 522 index = skipString(index); |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 return 0; | 525 return 0; |
| 526 } | 526 } |
| 527 | 527 |
| 528 | 528 |
| 529 void main() { | 529 void main() { |
| 530 outstandingCommands = new Map<int, Completer>(); | 530 outstandingCommands = new Map<int, Completer>(); |
| 531 vmSock = new Socket("127.0.0.1", 5858); | 531 vmSock = new Socket("127.0.0.1", 5858); |
| 532 vmStream = new SocketOutputStream(vmSock); | 532 vmStream = vmSock.outputStream; |
| 533 var stdinStream = new StringInputStream(stdin); | 533 var stdinStream = new StringInputStream(stdin); |
| 534 stdinStream.onLine = () { | 534 stdinStream.onLine = () { |
| 535 processCommand(stdinStream.readLine()); | 535 processCommand(stdinStream.readLine()); |
| 536 }; | 536 }; |
| 537 var vmInStream = new SocketInputStream(vmSock); | 537 var vmInStream = vmSock.inputStream; |
| 538 vmInStream.onData = () { | 538 vmInStream.onData = () { |
| 539 String s = decodeUtf8(vmInStream.read()); | 539 String s = decodeUtf8(vmInStream.read()); |
| 540 processVmData(s); | 540 processVmData(s); |
| 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 |