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

Side by Side Diff: tools/ddbg.dart

Issue 13533016: Add line table command to debugger (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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" as json; 9 import "dart:json" as json;
10 import "dart:utf"; 10 import "dart:utf";
(...skipping 30 matching lines...) Expand all
41 rbp <id> Remove breakpoint with given id 41 rbp <id> Remove breakpoint with given id
42 po <id> Print object info for given id 42 po <id> Print object info for given id
43 pl <id> <idx> [<len>] Print list element/slice 43 pl <id> <idx> [<len>] Print list element/slice
44 pc <id> Print class info for given id 44 pc <id> Print class info for given id
45 ll List loaded libraries 45 ll List loaded libraries
46 plib <id> Print library info for given library id 46 plib <id> Print library info for given library id
47 slib <id> <true|false> Set library id debuggable 47 slib <id> <true|false> Set library id debuggable
48 pg <id> Print all global variables visible within given library id 48 pg <id> Print all global variables visible within given library id
49 ls <lib_id> List loaded scripts in library 49 ls <lib_id> List loaded scripts in library
50 gs <lib_id> <script_url> Get source text of script in library 50 gs <lib_id> <script_url> Get source text of script in library
51 tok <lib_id> <script_url> Get line and token table of script in library
51 epi <none|all|unhandled> Set exception pause info 52 epi <none|all|unhandled> Set exception pause info
52 i <id> Interrupt execution of given isolate id 53 i <id> Interrupt execution of given isolate id
53 h Print help 54 h Print help
54 """); 55 """);
55 } 56 }
56 57
57 58
58 void quitShell() { 59 void quitShell() {
59 streamSubscription.cancel(); 60 streamSubscription.cancel();
60 vmSock.close(); 61 vmSock.close();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 "params": { "isolateId" : isolate_id, 175 "params": { "isolateId" : isolate_id,
175 "libraryId": int.parse(args[1]) } }; 176 "libraryId": int.parse(args[1]) } };
176 sendCmd(cmd).then((result) => handleGetGlobalVarsResponse(result)); 177 sendCmd(cmd).then((result) => handleGetGlobalVarsResponse(result));
177 } else if (command == "gs" && args.length == 3) { 178 } else if (command == "gs" && args.length == 3) {
178 var cmd = { "id": seqNum, 179 var cmd = { "id": seqNum,
179 "command": "getScriptSource", 180 "command": "getScriptSource",
180 "params": { "isolateId" : isolate_id, 181 "params": { "isolateId" : isolate_id,
181 "libraryId": int.parse(args[1]), 182 "libraryId": int.parse(args[1]),
182 "url": args[2] } }; 183 "url": args[2] } };
183 sendCmd(cmd).then((result) => handleGetSourceResponse(result)); 184 sendCmd(cmd).then((result) => handleGetSourceResponse(result));
185 } else if (command == "tok" && args.length == 3) {
186 var cmd = { "id": seqNum,
187 "command": "getLineNumberTable",
188 "params": { "isolateId" : isolate_id,
189 "libraryId": int.parse(args[1]),
190 "url": args[2] } };
191 sendCmd(cmd).then((result) => handleGetLineTableResponse(result));
184 } else if (command == "epi" && args.length == 2) { 192 } else if (command == "epi" && args.length == 2) {
185 var cmd = { "id": seqNum, 193 var cmd = { "id": seqNum,
186 "command": "setPauseOnException", 194 "command": "setPauseOnException",
187 "params": { "isolateId" : isolate_id, 195 "params": { "isolateId" : isolate_id,
188 "exceptions": args[1] } }; 196 "exceptions": args[1] } };
189 sendCmd(cmd).then((result) => handleGenericResponse(result)); 197 sendCmd(cmd).then((result) => handleGenericResponse(result));
190 } else if (command == "i" && args.length == 2) { 198 } else if (command == "i" && args.length == 2) {
191 var cmd = { "id": seqNum, 199 var cmd = { "id": seqNum,
192 "command": "interrupt", 200 "command": "interrupt",
193 "params": { "isolateId": int.parse(args[1]) } }; 201 "params": { "isolateId": int.parse(args[1]) } };
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 325 }
318 326
319 327
320 handleGetSourceResponse(response) { 328 handleGetSourceResponse(response) {
321 Map result = response["result"]; 329 Map result = response["result"];
322 String source = result["text"]; 330 String source = result["text"];
323 print("Source text:\n$source\n--------"); 331 print("Source text:\n$source\n--------");
324 } 332 }
325 333
326 334
335 handleGetLineTableResponse(response) {
336 Map result = response["result"];
337 var info = result["lines"];
338 print("Line info table:\n$info");
339 }
340
341
327 void handleGetLibraryResponse(response) { 342 void handleGetLibraryResponse(response) {
328 Map result = response["result"]; 343 Map result = response["result"];
329 List libs = result["libraries"]; 344 List libs = result["libraries"];
330 print("Loaded libraries:"); 345 print("Loaded libraries:");
331 print(libs); 346 print(libs);
332 for (int i = 0; i < libs.length; i++) { 347 for (int i = 0; i < libs.length; i++) {
333 print(" ${libs[i]["id"]} ${libs[i]["url"]}"); 348 print(" ${libs[i]["id"]} ${libs[i]["url"]}");
334 } 349 }
335 } 350 }
336 351
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 void printStackTrace(List frames) { 399 void printStackTrace(List frames) {
385 for (int i = 0; i < frames.length; i++) { 400 for (int i = 0; i < frames.length; i++) {
386 printStackFrame(i, frames[i]); 401 printStackFrame(i, frames[i]);
387 } 402 }
388 } 403 }
389 404
390 405
391 void handlePausedEvent(msg) { 406 void handlePausedEvent(msg) {
392 assert(msg["params"] != null); 407 assert(msg["params"] != null);
393 var reason = msg["params"]["reason"]; 408 var reason = msg["params"]["reason"];
394 isolate_id = msg["params"]["id"]; 409 isolate_id = msg["params"]["isolateId"];
395 stackTrace = msg["params"]["callFrames"]; 410 stackTrace = msg["params"]["callFrames"];
396 assert(stackTrace != null); 411 assert(stackTrace != null);
397 assert(stackTrace.length >= 1); 412 assert(stackTrace.length >= 1);
398 curFrame = stackTrace[0]; 413 curFrame = stackTrace[0];
399 if (reason == "breakpoint") { 414 if (reason == "breakpoint") {
400 print("Isolate $isolate_id paused on breakpoint"); 415 print("Isolate $isolate_id paused on breakpoint");
401 } else if (reason == "interrupted") { 416 } else if (reason == "interrupted") {
402 print("Isolate $isolate_id paused due to an interrupt"); 417 print("Isolate $isolate_id paused due to an interrupt");
403 } else { 418 } else {
404 assert(reason == "exception"); 419 assert(reason == "exception");
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 process.stdin.close(); 573 process.stdin.close();
559 process.exitCode.then((int exitCode) { 574 process.exitCode.then((int exitCode) {
560 print('${arguments.join(" ")} exited with $exitCode'); 575 print('${arguments.join(" ")} exited with $exitCode');
561 }); 576 });
562 debuggerMain(); 577 debuggerMain();
563 }); 578 });
564 } else { 579 } else {
565 debuggerMain(); 580 debuggerMain();
566 } 581 }
567 } 582 }
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