Chromium Code Reviews| 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 #import("dart:utf"); | 10 #import("dart:utf"); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 s Single step | 35 s Single step |
| 36 so Step over | 36 so Step over |
| 37 si Step into | 37 si Step into |
| 38 sbp [<file>] <line> Set breakpoint | 38 sbp [<file>] <line> Set breakpoint |
| 39 rbp <id> Remove breakpoint with given id | 39 rbp <id> Remove breakpoint with given id |
| 40 po <id> Print object info for given id | 40 po <id> Print object info for given id |
| 41 pl <id> <idx> [<len>] Print list element/slice | 41 pl <id> <idx> [<len>] Print list element/slice |
| 42 pc <id> Print class info for given id | 42 pc <id> Print class info for given id |
| 43 ll List loaded libraries | 43 ll List loaded libraries |
| 44 plib <id> Print library info for given library id | 44 plib <id> Print library info for given library id |
| 45 slib <id> <true|false> Set library id debuggable | |
| 45 pg <id> Print all global variables visible within given library id | 46 pg <id> Print all global variables visible within given library id |
| 46 ls <lib_id> List loaded scripts in library | 47 ls <lib_id> List loaded scripts in library |
| 47 gs <lib_id> <script_url> Get source text of script in library | 48 gs <lib_id> <script_url> Get source text of script in library |
| 48 epi <none|all|unhandled> Set exception pause info | 49 epi <none|all|unhandled> Set exception pause info |
| 49 h Print help | 50 h Print help |
| 50 """); | 51 """); |
| 51 } | 52 } |
| 52 | 53 |
| 53 | 54 |
| 54 void quitShell() { | 55 void quitShell() { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 } | 131 } |
| 131 sendCmd(cmd).then((result) => handleGetListResponse(result)); | 132 sendCmd(cmd).then((result) => handleGetListResponse(result)); |
| 132 } else if (command == "pc" && args.length == 2) { | 133 } else if (command == "pc" && args.length == 2) { |
| 133 var cmd = { "id": seqNum, "command": "getClassProperties", | 134 var cmd = { "id": seqNum, "command": "getClassProperties", |
| 134 "params": {"classId": Math.parseInt(args[1]) }}; | 135 "params": {"classId": Math.parseInt(args[1]) }}; |
| 135 sendCmd(cmd).then((result) => handleGetClassPropsResponse(result)); | 136 sendCmd(cmd).then((result) => handleGetClassPropsResponse(result)); |
| 136 } else if (command == "plib" && args.length == 2) { | 137 } else if (command == "plib" && args.length == 2) { |
| 137 var cmd = { "id": seqNum, "command": "getLibraryProperties", | 138 var cmd = { "id": seqNum, "command": "getLibraryProperties", |
| 138 "params": {"libraryId": Math.parseInt(args[1]) }}; | 139 "params": {"libraryId": Math.parseInt(args[1]) }}; |
| 139 sendCmd(cmd).then((result) => handleGetLibraryPropsResponse(result)); | 140 sendCmd(cmd).then((result) => handleGetLibraryPropsResponse(result)); |
| 141 } else if (command == "slib" && args.length == 3) { | |
|
regis
2012/07/19 20:40:57
This source file is not following our (C++) style
hausner
2012/07/19 22:50:35
I don't see anything in the style guide that requi
| |
| 142 var cmd = { "id": seqNum, "command": "setLibraryProperties", | |
| 143 "params": {"libraryId": Math.parseInt(args[1]), | |
| 144 "debuggingEnabled": args[2] }}; | |
| 145 sendCmd(cmd).then((result) => handleSetLibraryPropsResponse(result)); | |
| 140 } else if (command == "pg" && args.length == 2) { | 146 } else if (command == "pg" && args.length == 2) { |
| 141 var cmd = { "id": seqNum, "command": "getGlobalVariables", | 147 var cmd = { "id": seqNum, "command": "getGlobalVariables", |
| 142 "params": {"libraryId": Math.parseInt(args[1]) }}; | 148 "params": {"libraryId": Math.parseInt(args[1]) }}; |
| 143 sendCmd(cmd).then((result) => handleGetGlobalVarsResponse(result)); | 149 sendCmd(cmd).then((result) => handleGetGlobalVarsResponse(result)); |
| 144 } else if (command == "gs" && args.length == 3) { | 150 } else if (command == "gs" && args.length == 3) { |
| 145 var cmd = { "id": seqNum, "command": "getScriptSource", | 151 var cmd = { "id": seqNum, "command": "getScriptSource", |
| 146 "params": { "libraryId": Math.parseInt(args[1]), | 152 "params": { "libraryId": Math.parseInt(args[1]), |
| 147 "url": args[2] }}; | 153 "url": args[2] }}; |
| 148 sendCmd(cmd).then((result) => handleGetSourceResponse(result)); | 154 sendCmd(cmd).then((result) => handleGetSourceResponse(result)); |
| 149 } else if (command == "epi" && args.length == 2) { | 155 } else if (command == "epi" && args.length == 2) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 for (int i = 0; i < fields.length; i++) { | 237 for (int i = 0; i < fields.length; i++) { |
| 232 printNamedObject(fields[i]); | 238 printNamedObject(fields[i]); |
| 233 } | 239 } |
| 234 } | 240 } |
| 235 } | 241 } |
| 236 | 242 |
| 237 | 243 |
| 238 handleGetLibraryPropsResponse(response) { | 244 handleGetLibraryPropsResponse(response) { |
| 239 Map props = response["result"]; | 245 Map props = response["result"]; |
| 240 assert(props["url"] != null); | 246 assert(props["url"] != null); |
| 241 print(" library url=${props["url"]}"); | 247 print(" library url: ${props["url"]}"); |
| 248 assert(props["debuggingEnabled"] != null); | |
| 249 print(" debugging enabled: ${props["debuggingEnabled"]}"); | |
| 242 List imports = props["imports"]; | 250 List imports = props["imports"]; |
| 243 assert(imports != null); | 251 assert(imports != null); |
| 244 if (imports.length > 0) { | 252 if (imports.length > 0) { |
| 245 print(" imports:"); | 253 print(" imports:"); |
| 246 for (int i = 0; i < imports.length; i++) { | 254 for (int i = 0; i < imports.length; i++) { |
| 247 print(" id ${imports[i]["libraryId"]} prefix ${imports[i]["prefix"]}"); | 255 print(" id ${imports[i]["libraryId"]} prefix ${imports[i]["prefix"]}"); |
| 248 } | 256 } |
| 249 } | 257 } |
| 250 List globals = props["globals"]; | 258 List globals = props["globals"]; |
| 251 assert(globals != null); | 259 assert(globals != null); |
| 252 if (globals.length > 0) { | 260 if (globals.length > 0) { |
| 253 print(" global variables:"); | 261 print(" global variables:"); |
| 254 for (int i = 0; i < globals.length; i++) { | 262 for (int i = 0; i < globals.length; i++) { |
| 255 printNamedObject(globals[i]); | 263 printNamedObject(globals[i]); |
| 256 } | 264 } |
| 257 } | 265 } |
| 258 } | 266 } |
| 259 | 267 |
| 260 | 268 |
| 269 handleSetLibraryPropsResponse(response) { | |
| 270 Map props = response["result"]; | |
| 271 assert(props["debuggingEnabled"] != null); | |
| 272 print(" debugging enabled: ${props["debuggingEnabled"]}"); | |
| 273 } | |
| 274 | |
| 275 | |
| 261 handleGetGlobalVarsResponse(response) { | 276 handleGetGlobalVarsResponse(response) { |
| 262 List globals = response["result"]["globals"]; | 277 List globals = response["result"]["globals"]; |
| 263 for (int i = 0; i < globals.length; i++) { | 278 for (int i = 0; i < globals.length; i++) { |
| 264 printNamedObject(globals[i]); | 279 printNamedObject(globals[i]); |
| 265 } | 280 } |
| 266 } | 281 } |
| 267 | 282 |
| 268 | 283 |
| 269 handleGetSourceResponse(response) { | 284 handleGetSourceResponse(response) { |
| 270 Map result = response["result"]; | 285 Map result = response["result"]; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 }; | 450 }; |
| 436 vmInStream.onError = (err) { | 451 vmInStream.onError = (err) { |
| 437 print("Error in debug connection: $err"); | 452 print("Error in debug connection: $err"); |
| 438 quitShell(); | 453 quitShell(); |
| 439 }; | 454 }; |
| 440 vmInStream.onClosed = () { | 455 vmInStream.onClosed = () { |
| 441 print("VM debugger connection closed"); | 456 print("VM debugger connection closed"); |
| 442 quitShell(); | 457 quitShell(); |
| 443 }; | 458 }; |
| 444 } | 459 } |
| OLD | NEW |