Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: tools/ddbg.dart

Issue 12315097: Updated ddbg to use new streams API. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ddbg.dart
===================================================================
--- tools/ddbg.dart (revision 19019)
+++ tools/ddbg.dart (working copy)
@@ -15,7 +15,7 @@
Socket vmSock;
String vmData;
-OutputStream vmStream;
+Stream stringStream;
int seqNum = 0;
int isolate_id = -1;
@@ -56,9 +56,9 @@
void quitShell() {
- vmStream.close();
vmSock.close();
- stdin.close();
+ stdout.close();
+ exit(0);
Søren Gjesse 2013/02/26 15:40:04 As you mentioned this looks wrong. What should wor
Tom Ball 2013/02/26 18:18:54 I made the change you suggested and sync'd to 1906
}
@@ -69,7 +69,7 @@
if (verbose) {
print("sending: '${json.stringify(cmd)}'");
}
- vmStream.writeString(json.stringify(cmd));
+ vmSock.addString(json.stringify(cmd));
return completer.future;
}
@@ -528,25 +528,25 @@
void debuggerMain() {
outstandingCommands = new Map<int, Completer>();
- vmSock = new Socket("127.0.0.1", 5858);
- vmStream = vmSock.outputStream;
- var stdinStream = new StringInputStream(stdin);
- stdinStream.onLine = () {
- processCommand(stdinStream.readLine());
- };
- var vmInStream = vmSock.inputStream;
- vmInStream.onData = () {
- String s = decodeUtf8(vmInStream.read());
- processVmData(s);
- };
- vmInStream.onError = (err) {
- print("Error in debug connection: $err");
- quitShell();
- };
- vmInStream.onClosed = () {
- print("VM debugger connection closed");
- quitShell();
- };
+ Socket.connect("127.0.0.1", 5858).then((s) {
+ vmSock = s;
+ stringStream = vmSock.transform(new StringDecoder());
+ stringStream.listen(
+ (String data) {
+ processVmData(data);
+ },
+ onDone: () {
+ print("VM debugger connection closed");
+ quitShell();
+ },
+ onError: (err) {
+ print("Error in debug connection: $err");
+ quitShell();
+ });
+ stdin.transform(new StringDecoder())
+ .transform(new LineTransformer())
+ .listen((String line) => processCommand(line));
+ });
}
void main() {
@@ -555,16 +555,10 @@
if (arguments.length > 0) {
arguments = <String>['--debug', '--verbose_debug']..addAll(arguments);
Process.start(options.executable, arguments).then((Process process) {
- process.onExit = (int exitCode) {
- print('${arguments.join(" ")} exited with $exitCode');
- };
process.stdin.close();
- // Redirecting both stdout and stderr of the child process to
- // stdout. This should help users keep track of which errors
- // are coming from the debugger, and which errors are coming
- // from the process being debugged.
- process.stderr.pipe(stdout);
- process.stdout.pipe(stdout);
+ process.exitCode.then((int exitCode) {
+ print('${arguments.join(" ")} exited with $exitCode');
+ });
debuggerMain();
});
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698