| 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 // Simple interactive debugger shell that connects to the Dart VM's debugger | 5 // Simple interactive debugger shell that connects to the Dart VM's debugger |
| 6 // connection port. | 6 // connection port. |
| 7 | 7 |
| 8 #import("dart:io"); | 8 #import("dart:io"); |
| 9 #import("dart:json"); | 9 #import("dart:json"); |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 | 63 |
| 64 void processCommand(String cmdLine) { | 64 void processCommand(String cmdLine) { |
| 65 seqNum++; | 65 seqNum++; |
| 66 var args = cmdLine.split(' '); | 66 var args = cmdLine.split(' '); |
| 67 if (args.length == 0) { | 67 if (args.length == 0) { |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 var command = args[0]; | 70 var command = args[0]; |
| 71 if (command == "r") { | 71 var simple_commands = |
| 72 var cmd = { "id": seqNum, "command": "resume" }; | 72 { 'r':'resume', 's':'stepOver', 'si':'stepInto', 'so':'stepOut'}; |
| 73 sendCmd(cmd).then((result) => handleGenericResponse(result)); | 73 if (simple_commands[command] != null) { |
| 74 stackTrace = curFrame = null; | 74 var cmd = { "id": seqNum, "command": simple_commands[command]}; |
| 75 } else if (command == "s") { | |
| 76 var cmd = { "id": seqNum, "command": "stepOver" }; | |
| 77 sendCmd(cmd).then((result) => handleGenericResponse(result)); | |
| 78 stackTrace = curFrame = null; | |
| 79 } else if (command == "si") { | |
| 80 var cmd = { "id": seqNum, "command": "stepInto" }; | |
| 81 sendCmd(cmd).then((result) => handleGenericResponse(result)); | |
| 82 stackTrace = curFrame = null; | |
| 83 } else if (command == "so") { | |
| 84 var cmd = { "id": seqNum, "command": "stepOut" }; | |
| 85 sendCmd(cmd).then((result) => handleGenericResponse(result)); | 75 sendCmd(cmd).then((result) => handleGenericResponse(result)); |
| 86 stackTrace = curFrame = null; | 76 stackTrace = curFrame = null; |
| 87 } else if (command == "bt") { | 77 } else if (command == "bt") { |
| 88 var cmd = { "id": seqNum, "command": "getStackTrace" }; | 78 var cmd = { "id": seqNum, "command": "getStackTrace" }; |
| 89 sendCmd(cmd).then((result) => handleStackTraceResponse(result)); | 79 sendCmd(cmd).then((result) => handleStackTraceResponse(result)); |
| 90 } else if (command == "ll") { | 80 } else if (command == "ll") { |
| 91 var cmd = { "id": seqNum, "command": "getLibraryURLs" }; | 81 var cmd = { "id": seqNum, "command": "getLibraryURLs" }; |
| 92 sendCmd(cmd).then((result) => handleGetLibraryResponse(result)); | 82 sendCmd(cmd).then((result) => handleGetLibraryResponse(result)); |
| 93 } else if (command == "sbp" && args.length >= 2) { | 83 } else if (command == "sbp" && args.length >= 2) { |
| 94 var url, line; | 84 var url, line; |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 }; | 307 }; |
| 318 vmInStream.onError = (err) { | 308 vmInStream.onError = (err) { |
| 319 print("Error in debug connection: $err"); | 309 print("Error in debug connection: $err"); |
| 320 quitShell(); | 310 quitShell(); |
| 321 }; | 311 }; |
| 322 vmInStream.onClosed = () { | 312 vmInStream.onClosed = () { |
| 323 print("VM debugger connection closed"); | 313 print("VM debugger connection closed"); |
| 324 quitShell(); | 314 quitShell(); |
| 325 }; | 315 }; |
| 326 } | 316 } |
| OLD | NEW |