Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: tools/ddbg.dart

Issue 10496006: Add string encoding to wire protocol (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/debugger_api_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 s Single step 32 s Single step
33 so Step over 33 so Step over
34 si Step into 34 si Step into
35 sbp [<file>] <line> Set breakpoint 35 sbp [<file>] <line> Set breakpoint
36 rbp <id> Remove breakpoint with given id 36 rbp <id> Remove breakpoint with given id
37 po <id> Print object info for given id 37 po <id> Print object info for given id
38 pc <id> Print class info for given id 38 pc <id> Print class info for given id
39 ll List loaded libraries 39 ll List loaded libraries
40 pl <id> Print dlibrary info for given id 40 pl <id> Print dlibrary info for given id
41 ls <libname> List loaded scripts in library 41 ls <libname> List loaded scripts in library
42 gs <lib_id> <script_url> Get source text of script in library
42 h Print help 43 h Print help
43 """); 44 """);
44 } 45 }
45 46
46 47
47 void quitShell() { 48 void quitShell() {
48 vmStream.close(); 49 vmStream.close();
49 vmSock.close(); 50 vmSock.close();
50 stdin.close(); 51 stdin.close();
51 } 52 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 "params": {"objectId": Math.parseInt(args[1]) }}; 111 "params": {"objectId": Math.parseInt(args[1]) }};
111 sendCmd(cmd).then((result) => handleGetObjPropsResponse(result)); 112 sendCmd(cmd).then((result) => handleGetObjPropsResponse(result));
112 } else if (command == "pc" && args.length == 2) { 113 } else if (command == "pc" && args.length == 2) {
113 var cmd = { "id": seqNum, "command": "getClassProperties", 114 var cmd = { "id": seqNum, "command": "getClassProperties",
114 "params": {"classId": Math.parseInt(args[1]) }}; 115 "params": {"classId": Math.parseInt(args[1]) }};
115 sendCmd(cmd).then((result) => handleGetClassPropsResponse(result)); 116 sendCmd(cmd).then((result) => handleGetClassPropsResponse(result));
116 } else if (command == "pl" && args.length == 2) { 117 } else if (command == "pl" && args.length == 2) {
117 var cmd = { "id": seqNum, "command": "getLibraryProperties", 118 var cmd = { "id": seqNum, "command": "getLibraryProperties",
118 "params": {"libraryId": Math.parseInt(args[1]) }}; 119 "params": {"libraryId": Math.parseInt(args[1]) }};
119 sendCmd(cmd).then((result) => handleGetLibraryPropsResponse(result)); 120 sendCmd(cmd).then((result) => handleGetLibraryPropsResponse(result));
121 } else if (command == "gs" && args.length == 3) {
122 var cmd = { "id": seqNum, "command": "getScriptSource",
123 "params": { "libraryId": Math.parseInt(args[1]),
124 "url": args[2] }};
125 sendCmd(cmd).then((result) => handleGetSourceResponse(result));
120 } else if (command == "q") { 126 } else if (command == "q") {
121 quitShell(); 127 quitShell();
122 } else if (command == "h") { 128 } else if (command == "h") {
123 printHelp(); 129 printHelp();
124 } else { 130 } else {
125 print("command '$command' not understood, try h for help"); 131 print("command '$command' not understood, try h for help");
126 } 132 }
127 } 133 }
128 134
129 135
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 assert(globals != null); 196 assert(globals != null);
191 if (globals.length > 0) { 197 if (globals.length > 0) {
192 print(" global variables:"); 198 print(" global variables:");
193 for (int i = 0; i < globals.length; i++) { 199 for (int i = 0; i < globals.length; i++) {
194 printNamedObject(globals[i]); 200 printNamedObject(globals[i]);
195 } 201 }
196 } 202 }
197 } 203 }
198 204
199 205
206 handleGetSourceResponse(response) {
207 Map result = response["result"];
208 String source = result["text"];
209 print("Source text:\n$source\n--------");
210 }
211
212
200 void handleGetLibraryResponse(response) { 213 void handleGetLibraryResponse(response) {
201 Map result = response["result"]; 214 Map result = response["result"];
202 List libs = result["libraries"]; 215 List libs = result["libraries"];
203 print("Loaded libraries:"); 216 print("Loaded libraries:");
204 print(libs); 217 print(libs);
205 for (int i = 0; i < libs.length; i++) { 218 for (int i = 0; i < libs.length; i++) {
206 print(" ${libs[i]["id"]} ${libs[i]["url"]}"); 219 print(" ${libs[i]["id"]} ${libs[i]["url"]}");
207 } 220 }
208 } 221 }
209 222
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 }; 359 };
347 vmInStream.onError = (err) { 360 vmInStream.onError = (err) {
348 print("Error in debug connection: $err"); 361 print("Error in debug connection: $err");
349 quitShell(); 362 quitShell();
350 }; 363 };
351 vmInStream.onClosed = () { 364 vmInStream.onClosed = () {
352 print("VM debugger connection closed"); 365 print("VM debugger connection closed");
353 quitShell(); 366 quitShell();
354 }; 367 };
355 } 368 }
OLDNEW
« no previous file with comments | « runtime/vm/debugger_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698