| 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"; |
| 11 import "dart:json"; | 11 import "dart:json" as JSON; |
| 12 | 12 |
| 13 // TODO(hausner): need to select a different port number for each | 13 // TODO(hausner): need to select a different port number for each |
| 14 // test that runs in parallel. | 14 // test that runs in parallel. |
| 15 var debugPort = 5860; | 15 var debugPort = 5860; |
| 16 | 16 |
| 17 // Whether or not to print debug target process on the console. | 17 // Whether or not to print debug target process on the console. |
| 18 var showDebuggeeOutput = true; | 18 var showDebuggeeOutput = true; |
| 19 | 19 |
| 20 // Whether or not to print the debugger wire messages on the console. | 20 // Whether or not to print the debugger wire messages on the console. |
| 21 var verboseWire = false; | 21 var verboseWire = false; |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 if (showDebuggeeOutput) targetOpts.add("--verbose_debug"); | 512 if (showDebuggeeOutput) targetOpts.add("--verbose_debug"); |
| 513 targetOpts.add(options.script); | 513 targetOpts.add(options.script); |
| 514 targetOpts.add("--debuggee"); | 514 targetOpts.add("--debuggee"); |
| 515 | 515 |
| 516 Process.start(options.executable, targetOpts).then((Process process) { | 516 Process.start(options.executable, targetOpts).then((Process process) { |
| 517 print("Debug target process started"); | 517 print("Debug target process started"); |
| 518 process.stdin.close(); | 518 process.stdin.close(); |
| 519 process.stdout.onData = process.stdout.read; | 519 process.stdout.onData = process.stdout.read; |
| 520 process.stderr.onData = process.stderr.read; | 520 process.stderr.onData = process.stderr.read; |
| 521 process.onExit = (int exitCode) { | 521 process.onExit = (int exitCode) { |
| 522 Expect.equals(0, exitCode); |
| 522 print("Debug target process exited with exit code $exitCode"); | 523 print("Debug target process exited with exit code $exitCode"); |
| 523 }; | 524 }; |
| 524 var debugger = new Debugger(process, debugPort); | 525 var debugger = new Debugger(process, debugPort); |
| 525 stdin.onClosed = () => debugger.close(); | 526 stdin.onClosed = () => debugger.close(); |
| 526 stdin.onError = (error) => debugger.close(); | 527 stdin.onError = (error) => debugger.close(); |
| 527 debugger.runScript(script); | 528 debugger.runScript(script); |
| 528 }); | 529 }); |
| 529 return true; | 530 return true; |
| 530 } | 531 } |
| OLD | NEW |