OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 part of fletch.vm_session; | 5 part of dartino.vm_session; |
6 | 6 |
7 const String BANNER = """ | 7 const String BANNER = """ |
8 Starting session. Type 'help' for a list of commands. | 8 Starting session. Type 'help' for a list of commands. |
9 """; | 9 """; |
10 | 10 |
11 const String HELP = """ | 11 const String HELP = """ |
12 Commands: | 12 Commands: |
13 'help' show list of commands | 13 'help' show list of commands |
14 'r'/'run' start program | 14 'r'/'run' start program |
15 'b [method name] [bytecode index]' set breakpoint | 15 'b [method name] [bytecode index]' set breakpoint |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 break; | 394 break; |
395 default: | 395 default: |
396 writeStdoutLine('### unknown command: $command'); | 396 writeStdoutLine('### unknown command: $command'); |
397 break; | 397 break; |
398 } | 398 } |
399 previousLine = line; | 399 previousLine = line; |
400 if (!session.terminated) printPrompt(); | 400 if (!session.terminated) printPrompt(); |
401 } | 401 } |
402 | 402 |
403 // This method is used to deal with the stopped process command responses | 403 // This method is used to deal with the stopped process command responses |
404 // that can be returned when sending the Fletch VM a command request. | 404 // that can be returned when sending the Dartino VM a command request. |
405 Future handleProcessStopResponse( | 405 Future handleProcessStopResponse( |
406 VmCommand response, | 406 VmCommand response, |
407 SessionState state) async { | 407 SessionState state) async { |
408 String output = await session.processStopResponseToString(response, state); | 408 String output = await session.processStopResponseToString(response, state); |
409 if (output != null && output.isNotEmpty) { | 409 if (output != null && output.isNotEmpty) { |
410 writeStdout(output); | 410 writeStdout(output); |
411 } | 411 } |
412 } | 412 } |
413 | 413 |
414 bool checkLoaded([String postfix]) { | 414 bool checkLoaded([String postfix]) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 int choice = int.parse(line, onError: (_) => 0); | 505 int choice = int.parse(line, onError: (_) => 0); |
506 if (choice > 0 && choice <= length) { | 506 if (choice > 0 && choice <= length) { |
507 return <int>[choice - 1]; | 507 return <int>[choice - 1]; |
508 } | 508 } |
509 writeStdoutLine("Invalid choice: $choice"); | 509 writeStdoutLine("Invalid choice: $choice"); |
510 writeStdoutLine("Please select a number between 1 and $length, " + | 510 writeStdoutLine("Please select a number between 1 and $length, " + |
511 "'a' for all, or 'n' for none."); | 511 "'a' for all, or 'n' for none."); |
512 } | 512 } |
513 } | 513 } |
514 } | 514 } |
OLD | NEW |