| 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 23 matching lines...) Expand all Loading... |
| 34 so Step over | 34 so Step over |
| 35 si Step into | 35 si Step into |
| 36 sbp [<file>] <line> Set breakpoint | 36 sbp [<file>] <line> Set breakpoint |
| 37 rbp <id> Remove breakpoint with given id | 37 rbp <id> Remove breakpoint with given id |
| 38 po <id> Print object info for given id | 38 po <id> Print object info for given id |
| 39 pc <id> Print class info for given id | 39 pc <id> Print class info for given id |
| 40 ll List loaded libraries | 40 ll List loaded libraries |
| 41 pl <id> Print dlibrary info for given id | 41 pl <id> Print dlibrary info for given id |
| 42 ls <libname> List loaded scripts in library | 42 ls <libname> List loaded scripts in library |
| 43 gs <lib_id> <script_url> Get source text of script in library | 43 gs <lib_id> <script_url> Get source text of script in library |
| 44 epi <none|all|unhandled> Set exception pause info |
| 44 h Print help | 45 h Print help |
| 45 """); | 46 """); |
| 46 } | 47 } |
| 47 | 48 |
| 48 | 49 |
| 49 void quitShell() { | 50 void quitShell() { |
| 50 vmStream.close(); | 51 vmStream.close(); |
| 51 vmSock.close(); | 52 vmSock.close(); |
| 52 stdin.close(); | 53 stdin.close(); |
| 53 } | 54 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 sendCmd(cmd).then((result) => handleGetClassPropsResponse(result)); | 118 sendCmd(cmd).then((result) => handleGetClassPropsResponse(result)); |
| 118 } else if (command == "pl" && args.length == 2) { | 119 } else if (command == "pl" && args.length == 2) { |
| 119 var cmd = { "id": seqNum, "command": "getLibraryProperties", | 120 var cmd = { "id": seqNum, "command": "getLibraryProperties", |
| 120 "params": {"libraryId": Math.parseInt(args[1]) }}; | 121 "params": {"libraryId": Math.parseInt(args[1]) }}; |
| 121 sendCmd(cmd).then((result) => handleGetLibraryPropsResponse(result)); | 122 sendCmd(cmd).then((result) => handleGetLibraryPropsResponse(result)); |
| 122 } else if (command == "gs" && args.length == 3) { | 123 } else if (command == "gs" && args.length == 3) { |
| 123 var cmd = { "id": seqNum, "command": "getScriptSource", | 124 var cmd = { "id": seqNum, "command": "getScriptSource", |
| 124 "params": { "libraryId": Math.parseInt(args[1]), | 125 "params": { "libraryId": Math.parseInt(args[1]), |
| 125 "url": args[2] }}; | 126 "url": args[2] }}; |
| 126 sendCmd(cmd).then((result) => handleGetSourceResponse(result)); | 127 sendCmd(cmd).then((result) => handleGetSourceResponse(result)); |
| 128 } else if (command == "epi" && args.length == 2) { |
| 129 var cmd = { "id": seqNum, "command": "setPauseOnException", |
| 130 "params": { "exceptions": args[1] }}; |
| 131 sendCmd(cmd).then((result) => handleGenericResponse(result)); |
| 127 } else if (command == "q") { | 132 } else if (command == "q") { |
| 128 quitShell(); | 133 quitShell(); |
| 129 } else if (command == "h") { | 134 } else if (command == "h") { |
| 130 printHelp(); | 135 printHelp(); |
| 131 } else { | 136 } else { |
| 132 print("command '$command' not understood, try h for help"); | 137 print("command '$command' not understood, try h for help"); |
| 133 } | 138 } |
| 134 } | 139 } |
| 135 | 140 |
| 136 | 141 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 }; | 382 }; |
| 378 vmInStream.onError = (err) { | 383 vmInStream.onError = (err) { |
| 379 print("Error in debug connection: $err"); | 384 print("Error in debug connection: $err"); |
| 380 quitShell(); | 385 quitShell(); |
| 381 }; | 386 }; |
| 382 vmInStream.onClosed = () { | 387 vmInStream.onClosed = () { |
| 383 print("VM debugger connection closed"); | 388 print("VM debugger connection closed"); |
| 384 quitShell(); | 389 quitShell(); |
| 385 }; | 390 }; |
| 386 } | 391 } |
| OLD | NEW |