| 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" as json; | 9 import "dart:json" as json; |
| 10 import "dart:utf"; | 10 import "dart:utf"; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 void handleStackTraceResponse(response) { | 386 void handleStackTraceResponse(response) { |
| 387 Map result = response["result"]; | 387 Map result = response["result"]; |
| 388 List callFrames = result["callFrames"]; | 388 List callFrames = result["callFrames"]; |
| 389 assert(callFrames != null); | 389 assert(callFrames != null); |
| 390 printStackTrace(callFrames); | 390 printStackTrace(callFrames); |
| 391 } | 391 } |
| 392 | 392 |
| 393 | 393 |
| 394 void printStackFrame(frame_num, Map frame) { | 394 void printStackFrame(frame_num, Map frame) { |
| 395 var fname = frame["functionName"]; | 395 var fname = frame["functionName"]; |
| 396 var libId = frame["libraryId"]; | 396 var libId = frame["location"]["libraryId"]; |
| 397 var url = frame["location"]["url"]; | 397 var url = frame["location"]["url"]; |
| 398 var line = frame["location"]["lineNumber"]; | 398 var toff = frame["location"]["tokenOffset"]; |
| 399 print("$frame_num $fname ($url:$line) (lib $libId)"); | 399 print("$frame_num $fname (url: $url token: $toff lib: $libId)"); |
| 400 List locals = frame["locals"]; | 400 List locals = frame["locals"]; |
| 401 for (int i = 0; i < locals.length; i++) { | 401 for (int i = 0; i < locals.length; i++) { |
| 402 printNamedObject(locals[i]); | 402 printNamedObject(locals[i]); |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 | 405 |
| 406 | 406 |
| 407 void printStackTrace(List frames) { | 407 void printStackTrace(List frames) { |
| 408 for (int i = 0; i < frames.length; i++) { | 408 for (int i = 0; i < frames.length; i++) { |
| 409 printStackFrame(i, frames[i]); | 409 printStackFrame(i, frames[i]); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 process.stdin.close(); | 603 process.stdin.close(); |
| 604 process.exitCode.then((int exitCode) { | 604 process.exitCode.then((int exitCode) { |
| 605 print('${arguments.join(" ")} exited with $exitCode'); | 605 print('${arguments.join(" ")} exited with $exitCode'); |
| 606 }); | 606 }); |
| 607 debuggerMain(); | 607 debuggerMain(); |
| 608 }); | 608 }); |
| 609 } else { | 609 } else { |
| 610 debuggerMain(); | 610 debuggerMain(); |
| 611 } | 611 } |
| 612 } | 612 } |
| OLD | NEW |