| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 } | 449 } |
| 450 | 450 |
| 451 | 451 |
| 452 void processVmData(String data) { | 452 void processVmData(String data) { |
| 453 final printMessages = false; | 453 final printMessages = false; |
| 454 if (vmData == null || vmData.length == 0) { | 454 if (vmData == null || vmData.length == 0) { |
| 455 vmData = data; | 455 vmData = data; |
| 456 } else { | 456 } else { |
| 457 vmData = vmData.concat(data); | 457 vmData = vmData + data; |
| 458 } | 458 } |
| 459 int msg_len = jsonObjectLength(vmData); | 459 int msg_len = jsonObjectLength(vmData); |
| 460 if (printMessages && msg_len == 0) { | 460 if (printMessages && msg_len == 0) { |
| 461 print("have partial or illegal json message" | 461 print("have partial or illegal json message" |
| 462 " of ${vmData.length} chars:\n'$vmData'"); | 462 " of ${vmData.length} chars:\n'$vmData'"); |
| 463 return; | 463 return; |
| 464 } | 464 } |
| 465 while (msg_len > 0 && msg_len <= vmData.length) { | 465 while (msg_len > 0 && msg_len <= vmData.length) { |
| 466 if (msg_len == vmData.length) { | 466 if (msg_len == vmData.length) { |
| 467 if (printMessages) { print("have one full message:\n$vmData"); } | 467 if (printMessages) { print("have one full message:\n$vmData"); } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 process.stdin.close(); | 558 process.stdin.close(); |
| 559 process.exitCode.then((int exitCode) { | 559 process.exitCode.then((int exitCode) { |
| 560 print('${arguments.join(" ")} exited with $exitCode'); | 560 print('${arguments.join(" ")} exited with $exitCode'); |
| 561 }); | 561 }); |
| 562 debuggerMain(); | 562 debuggerMain(); |
| 563 }); | 563 }); |
| 564 } else { | 564 } else { |
| 565 debuggerMain(); | 565 debuggerMain(); |
| 566 } | 566 } |
| 567 } | 567 } |
| OLD | NEW |