| Index: tools/ddbg.dart
|
| ===================================================================
|
| --- tools/ddbg.dart (revision 8073)
|
| +++ tools/ddbg.dart (working copy)
|
| @@ -33,9 +33,11 @@
|
| so Step over
|
| si Step into
|
| sbp [<file>] <line> Set breakpoint
|
| + rbp <id> Remove breakpoint with given id
|
| po <id> Print object info for given id
|
| pc <id> Print class info for given id
|
| ll List loaded libraries
|
| + pl <id> Print dlibrary info for given id
|
| ls <libname> List loaded scripts in library
|
| h Print help
|
| """);
|
| @@ -78,7 +80,7 @@
|
| var cmd = { "id": seqNum, "command": "getStackTrace" };
|
| sendCmd(cmd).then((result) => handleStackTraceResponse(result));
|
| } else if (command == "ll") {
|
| - var cmd = { "id": seqNum, "command": "getLibraryURLs" };
|
| + var cmd = { "id": seqNum, "command": "getLibraries" };
|
| sendCmd(cmd).then((result) => handleGetLibraryResponse(result));
|
| } else if (command == "sbp" && args.length >= 2) {
|
| var url, line;
|
| @@ -93,10 +95,15 @@
|
| "command": "setBreakpoint",
|
| "params": { "url": url, "line": line }};
|
| sendCmd(cmd).then((result) => handleSetBpResponse(result));
|
| + } else if (command == "rbp" && args.length == 2) {
|
| + var cmd = { "id": seqNum,
|
| + "command": "removeBreakpoint",
|
| + "params": { "breakpointId": Math.parseInt(args[1]) }};
|
| + sendCmd(cmd).then((result) => handleGenericResponse(result));
|
| } else if (command == "ls" && args.length == 2) {
|
| var cmd = { "id": seqNum,
|
| - "command": "getScriptURLs",
|
| - "params": { "library": args[1] }};
|
| + "command": "getScriptURLs",
|
| + "params": { "libraryId": Math.parseInt(args[1]) }};
|
| sendCmd(cmd).then((result) => handleGetScriptsResponse(result));
|
| } else if (command == "po" && args.length == 2) {
|
| var cmd = { "id": seqNum, "command": "getObjectProperties",
|
| @@ -106,6 +113,10 @@
|
| var cmd = { "id": seqNum, "command": "getClassProperties",
|
| "params": {"classId": Math.parseInt(args[1]) }};
|
| sendCmd(cmd).then((result) => handleGetClassPropsResponse(result));
|
| + } else if (command == "pl" && args.length == 2) {
|
| + var cmd = { "id": seqNum, "command": "getLibraryProperties",
|
| + "params": {"libraryId": Math.parseInt(args[1]) }};
|
| + sendCmd(cmd).then((result) => handleGetLibraryPropsResponse(result));
|
| } else if (command == "q") {
|
| quitShell();
|
| } else if (command == "h") {
|
| @@ -135,6 +146,10 @@
|
| handleGetObjPropsResponse(response) {
|
| Map props = response["result"];
|
| int class_id = props["classId"];
|
| + if (class_id == -1) {
|
| + print(" null");
|
| + return;
|
| + }
|
| List fields = props["fields"];
|
| print(" class id: $class_id");
|
| for (int i = 0; i < fields.length; i++) {
|
| @@ -159,12 +174,36 @@
|
| }
|
|
|
|
|
| +handleGetLibraryPropsResponse(response) {
|
| + Map props = response["result"];
|
| + assert(props["url"] != null);
|
| + print(" library url=${props["url"]}");
|
| + List imports = props["imports"];
|
| + assert(imports != null);
|
| + if (imports.length > 0) {
|
| + print(" imports:");
|
| + for (int i = 0; i < imports.length; i++) {
|
| + print(" id ${imports[i]["libraryId"]} prefix ${imports[i]["prefix"]}");
|
| + }
|
| + }
|
| + List globals = props["globals"];
|
| + assert(globals != null);
|
| + if (globals.length > 0) {
|
| + print(" global variables:");
|
| + for (int i = 0; i < globals.length; i++) {
|
| + printNamedObject(globals[i]);
|
| + }
|
| + }
|
| +}
|
| +
|
| +
|
| void handleGetLibraryResponse(response) {
|
| Map result = response["result"];
|
| - List urls = result["urls"];
|
| + List libs = result["libraries"];
|
| print("Loaded libraries:");
|
| - for (int i = 0; i < urls.length; i++) {
|
| - print(" $i ${urls[i]}");
|
| + print(libs);
|
| + for (int i = 0; i < libs.length; i++) {
|
| + print(" ${libs[i]["id"]} ${libs[i]["url"]}");
|
| }
|
| }
|
|
|
|
|