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

Side by Side Diff: tools/ddbg.dart

Issue 23067006: Evaluate expression in context of an object (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/symbols.h ('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" as json; 9 import "dart:json" as json;
10 import "dart:utf"; 10 import "dart:utf";
(...skipping 20 matching lines...) Expand all
31 print(""" 31 print("""
32 q Quit debugger shell 32 q Quit debugger shell
33 bt Show backtrace 33 bt Show backtrace
34 r Resume execution 34 r Resume execution
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 eval <id> <expr> Evaluate expr on object id
41 pl <id> <idx> [<len>] Print list element/slice 42 pl <id> <idx> [<len>] Print list element/slice
42 pc <id> Print class info for given id 43 pc <id> Print class info for given id
43 ll List loaded libraries 44 ll List loaded libraries
44 plib <id> Print library info for given library id 45 plib <id> Print library info for given library id
45 slib <id> <true|false> Set library id debuggable 46 slib <id> <true|false> Set library id debuggable
46 pg <id> Print all global variables visible within given library id 47 pg <id> Print all global variables visible within given library id
47 ls <lib_id> List loaded scripts in library 48 ls <lib_id> List loaded scripts in library
48 gs <lib_id> <script_url> Get source text of script in library 49 gs <lib_id> <script_url> Get source text of script in library
49 tok <lib_id> <script_url> Get line and token table of script in library 50 tok <lib_id> <script_url> Get line and token table of script in library
50 epi <none|all|unhandled> Set exception pause info 51 epi <none|all|unhandled> Set exception pause info
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 "command": "removeBreakpoint", 120 "command": "removeBreakpoint",
120 "params": { "isolateId" : isolate_id, 121 "params": { "isolateId" : isolate_id,
121 "breakpointId": int.parse(args[1]) } }; 122 "breakpointId": int.parse(args[1]) } };
122 sendCmd(cmd).then((result) => handleGenericResponse(result)); 123 sendCmd(cmd).then((result) => handleGenericResponse(result));
123 } else if (command == "ls" && args.length == 2) { 124 } else if (command == "ls" && args.length == 2) {
124 var cmd = { "id": seqNum, 125 var cmd = { "id": seqNum,
125 "command": "getScriptURLs", 126 "command": "getScriptURLs",
126 "params": { "isolateId" : isolate_id, 127 "params": { "isolateId" : isolate_id,
127 "libraryId": int.parse(args[1]) } }; 128 "libraryId": int.parse(args[1]) } };
128 sendCmd(cmd).then((result) => handleGetScriptsResponse(result)); 129 sendCmd(cmd).then((result) => handleGetScriptsResponse(result));
130 } else if (command == "eval" && args.length > 2) {
131 var expr = args.getRange(2, args.length).join(" ");
132 var cmd = { "id": seqNum,
133 "command": "evaluateExpr",
134 "params": { "isolateId": isolate_id,
135 "objectId": int.parse(args[1]),
136 "expression": expr } };
137 sendCmd(cmd).then((result) => handleEvalResponse(result));
129 } else if (command == "po" && args.length == 2) { 138 } else if (command == "po" && args.length == 2) {
130 var cmd = { "id": seqNum, 139 var cmd = { "id": seqNum,
131 "command": "getObjectProperties", 140 "command": "getObjectProperties",
132 "params": { "isolateId" : isolate_id, 141 "params": { "isolateId" : isolate_id,
133 "objectId": int.parse(args[1]) } }; 142 "objectId": int.parse(args[1]) } };
134 sendCmd(cmd).then((result) => handleGetObjPropsResponse(result)); 143 sendCmd(cmd).then((result) => handleGetObjPropsResponse(result));
135 } else if (command == "pl" && args.length >= 3) { 144 } else if (command == "pl" && args.length >= 3) {
136 var cmd; 145 var cmd;
137 if (args.length == 3) { 146 if (args.length == 3) {
138 cmd = { "id": seqNum, 147 cmd = { "id": seqNum,
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 void handleGetScriptsResponse(response) { 370 void handleGetScriptsResponse(response) {
362 Map result = response["result"]; 371 Map result = response["result"];
363 List urls = result["urls"]; 372 List urls = result["urls"];
364 print("Loaded scripts:"); 373 print("Loaded scripts:");
365 for (int i = 0; i < urls.length; i++) { 374 for (int i = 0; i < urls.length; i++) {
366 print(" $i ${urls[i]}"); 375 print(" $i ${urls[i]}");
367 } 376 }
368 } 377 }
369 378
370 379
380 void handleEvalResponse(response) {
381 Map result = response["result"];
382 print(remoteObject(result));
383 }
384
385
371 void handleSetBpResponse(response) { 386 void handleSetBpResponse(response) {
372 Map result = response["result"]; 387 Map result = response["result"];
373 var id = result["breakpointId"]; 388 var id = result["breakpointId"];
374 assert(id != null); 389 assert(id != null);
375 print("Set BP $id"); 390 print("Set BP $id");
376 } 391 }
377 392
378 393
379 void handleGenericResponse(response) { 394 void handleGenericResponse(response) {
380 if (response["error"] != null) { 395 if (response["error"] != null) {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 process.stdin.close(); 619 process.stdin.close();
605 process.exitCode.then((int exitCode) { 620 process.exitCode.then((int exitCode) {
606 print('${arguments.join(" ")} exited with $exitCode'); 621 print('${arguments.join(" ")} exited with $exitCode');
607 }); 622 });
608 debuggerMain(); 623 debuggerMain();
609 }); 624 });
610 } else { 625 } else {
611 debuggerMain(); 626 debuggerMain();
612 } 627 }
613 } 628 }
OLDNEW
« no previous file with comments | « runtime/vm/symbols.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698