| 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 // Library used by debugger wire protocol tests (standalone VM debugging). | 5 // Library used by debugger wire protocol tests (standalone VM debugging). |
| 6 | 6 |
| 7 library DartDebugger; | 7 library DartDebugger; |
| 8 | 8 |
| 9 import "dart:io"; | 9 import "dart:io"; |
| 10 import "dart:utf"; | 10 import "dart:utf"; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // Class to buffer wire protocol data from debug target and | 23 // Class to buffer wire protocol data from debug target and |
| 24 // break it down to individual json messages. | 24 // break it down to individual json messages. |
| 25 class JsonBuffer { | 25 class JsonBuffer { |
| 26 String buffer = null; | 26 String buffer = null; |
| 27 | 27 |
| 28 append(String s) { | 28 append(String s) { |
| 29 if (buffer == null || buffer.length == 0) { | 29 if (buffer == null || buffer.length == 0) { |
| 30 buffer = s; | 30 buffer = s; |
| 31 } else { | 31 } else { |
| 32 buffer = buffer.concat(s); | 32 buffer += s; |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 String getNextMessage() { | 36 String getNextMessage() { |
| 37 if (buffer == null) return null; | 37 if (buffer == null) return null; |
| 38 int msgLen = objectLength(); | 38 int msgLen = objectLength(); |
| 39 if (msgLen == 0) return null; | 39 if (msgLen == 0) return null; |
| 40 String msg = null; | 40 String msg = null; |
| 41 if (msgLen == buffer.length) { | 41 if (msgLen == buffer.length) { |
| 42 msg = buffer; | 42 msg = buffer; |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 process.exitCode.then((int exitCode) { | 532 process.exitCode.then((int exitCode) { |
| 533 Expect.equals(0, exitCode); | 533 Expect.equals(0, exitCode); |
| 534 Expect.equals(0, exitCode); | 534 Expect.equals(0, exitCode); |
| 535 print("Debug target process exited with exit code $exitCode"); | 535 print("Debug target process exited with exit code $exitCode"); |
| 536 }); | 536 }); |
| 537 var debugger = new Debugger(process, debugPort); | 537 var debugger = new Debugger(process, debugPort); |
| 538 debugger.runScript(script); | 538 debugger.runScript(script); |
| 539 }); | 539 }); |
| 540 return true; | 540 return true; |
| 541 } | 541 } |
| OLD | NEW |