| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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:async"; | 9 import "dart:async"; |
| 10 import "dart:convert"; | 10 import "dart:convert"; |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 lastCommand.matchResponse(this); | 464 lastCommand.matchResponse(this); |
| 465 lastCommand = null; | 465 lastCommand = null; |
| 466 if (errorsDetected) { | 466 if (errorsDetected) { |
| 467 error("Error while matching response to debugger command"); | 467 error("Error while matching response to debugger command"); |
| 468 error("Response received from debug target: $receivedMsg"); | 468 error("Response received from debug target: $receivedMsg"); |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 | 472 |
| 473 // Send next debugger command in the script, if a response | 473 // Send next debugger command in the script, if a response |
| 474 // form the last command has been received and processed. | 474 // from the last command has been received and processed. |
| 475 void sendNextCommand() { | 475 void sendNextCommand() { |
| 476 while (script.isNextEventMatcher) { | 476 while (script.isNextEventMatcher) { |
| 477 EventMatcher matcher = script.currentEntry; | 477 EventMatcher matcher = script.currentEntry; |
| 478 script.advance(); | 478 script.advance(); |
| 479 matcher.matchEvent(this); | 479 matcher.matchEvent(this); |
| 480 } | 480 } |
| 481 | 481 |
| 482 if (lastCommand == null) { | 482 if (lastCommand == null) { |
| 483 if (script.currentEntry is Command) { | 483 if (script.currentEntry is Command) { |
| 484 script.currentEntry.send(this); | 484 script.currentEntry.send(this); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 603 |
| 604 | 604 |
| 605 bool RunScript(List script, List<String> arguments) { | 605 bool RunScript(List script, List<String> arguments) { |
| 606 if (arguments.contains("--debuggee")) { | 606 if (arguments.contains("--debuggee")) { |
| 607 return false; | 607 return false; |
| 608 } | 608 } |
| 609 verboseWire = arguments.contains("--wire"); | 609 verboseWire = arguments.contains("--wire"); |
| 610 | 610 |
| 611 // Port number 0 means debug target picks a free port dynamically. | 611 // Port number 0 means debug target picks a free port dynamically. |
| 612 var targetOpts = [ "--debug:0" ]; | 612 var targetOpts = [ "--debug:0" ]; |
| 613 if (arguments.contains("--verbose")) { |
| 614 targetOpts.add("--verbose_debug"); |
| 615 } |
| 613 targetOpts.add(Platform.script.toFilePath()); | 616 targetOpts.add(Platform.script.toFilePath()); |
| 614 targetOpts.add("--debuggee"); | 617 targetOpts.add("--debuggee"); |
| 615 print('args: ${targetOpts.join(" ")}'); | 618 print('args: ${targetOpts.join(" ")}'); |
| 616 | 619 |
| 617 Process.start(Platform.executable, targetOpts).then((Process process) { | 620 Process.start(Platform.executable, targetOpts).then((Process process) { |
| 618 print("Debug target process started, pid ${process.pid}."); | 621 print("Debug target process started, pid ${process.pid}."); |
| 619 process.stdin.close(); | 622 process.stdin.close(); |
| 620 var debugger = new Debugger(process, new DebugScript(script)); | 623 var debugger = new Debugger(process, new DebugScript(script)); |
| 621 }); | 624 }); |
| 622 return true; | 625 return true; |
| 623 } | 626 } |
| OLD | NEW |