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

Side by Side Diff: tools/ddbg.dart

Issue 10537065: Debugger break on TypeError, AssertionError (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
« runtime/vm/exceptions.cc ('K') | « runtime/vm/exceptions.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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 if (args.length == 2) { 89 if (args.length == 2) {
90 url = stackTrace[0]["location"]["url"]; 90 url = stackTrace[0]["location"]["url"];
91 line = Math.parseInt(args[1]); 91 line = Math.parseInt(args[1]);
92 } else { 92 } else {
93 url = args[1]; 93 url = args[1];
94 line = Math.parseInt(args[2]); 94 line = Math.parseInt(args[2]);
95 } 95 }
96 var cmd = { "id": seqNum, 96 var cmd = { "id": seqNum,
97 "command": "setBreakpoint", 97 "command": "setBreakpoint",
98 "params": { "url": url, "line": line }}; 98 "params": { "url": url, "line": line }};
99 sendCmd(cmd).then((result) => handleSetBpResponse(result)); 99 sendCmd(cmd).then((result) => handleSetBpResponse(result));
siva 2012/06/08 17:17:27 No command to be able to say "stop on type errors"
hausner 2012/06/08 17:42:35 It is a todo. I need to implement the API and wire
100 } else if (command == "rbp" && args.length == 2) { 100 } else if (command == "rbp" && args.length == 2) {
101 var cmd = { "id": seqNum, 101 var cmd = { "id": seqNum,
102 "command": "removeBreakpoint", 102 "command": "removeBreakpoint",
103 "params": { "breakpointId": Math.parseInt(args[1]) }}; 103 "params": { "breakpointId": Math.parseInt(args[1]) }};
104 sendCmd(cmd).then((result) => handleGenericResponse(result)); 104 sendCmd(cmd).then((result) => handleGenericResponse(result));
105 } else if (command == "ls" && args.length == 2) { 105 } else if (command == "ls" && args.length == 2) {
106 var cmd = { "id": seqNum, 106 var cmd = { "id": seqNum,
107 "command": "getScriptURLs", 107 "command": "getScriptURLs",
108 "params": { "libraryId": Math.parseInt(args[1]) }}; 108 "params": { "libraryId": Math.parseInt(args[1]) }};
109 sendCmd(cmd).then((result) => handleGetScriptsResponse(result)); 109 sendCmd(cmd).then((result) => handleGetScriptsResponse(result));
(...skipping 17 matching lines...) Expand all
127 } else if (command == "q") { 127 } else if (command == "q") {
128 quitShell(); 128 quitShell();
129 } else if (command == "h") { 129 } else if (command == "h") {
130 printHelp(); 130 printHelp();
131 } else { 131 } else {
132 print("command '$command' not understood, try h for help"); 132 print("command '$command' not understood, try h for help");
133 } 133 }
134 } 134 }
135 135
136 136
137 String remoteValue(value) {
138 var kind = value["kind"];
139 var text = value["text"];
140 var id = value["objectId"];
141 if (kind == "string") {
142 return "'$text'";
143 } else if (kind == "object") {
144 return "(obj id: $id) = $text";
145 } else {
146 return "$text";
147 }
148 }
149
150
137 printNamedObject(obj) { 151 printNamedObject(obj) {
138 var name = obj["name"]; 152 var name = obj["name"];
139 var value = obj["value"]; 153 var value = obj["value"];
140 var kind = value["kind"]; 154 print(" $name = ${remoteValue(value)}");
141 var text = value["text"];
142 var id = value["objectId"];
143 if (kind == "string") {
144 print(" $name = '$text'");
145 } else if (kind == "object") {
146 print(" $name (id:$id) = $text");
147 } else {
148 print(" $name = $text");
149 }
150 } 155 }
151 156
152 157
153 handleGetObjPropsResponse(response) { 158 handleGetObjPropsResponse(response) {
154 Map props = response["result"]; 159 Map props = response["result"];
155 int class_id = props["classId"]; 160 int class_id = props["classId"];
156 if (class_id == -1) { 161 if (class_id == -1) {
157 print(" null"); 162 print(" null");
158 return; 163 return;
159 } 164 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 274
270 void printStackTrace(List frames) { 275 void printStackTrace(List frames) {
271 for (int i = 0; i < frames.length; i++) { 276 for (int i = 0; i < frames.length; i++) {
272 printStackFrame(i, frames[i]); 277 printStackFrame(i, frames[i]);
273 } 278 }
274 } 279 }
275 280
276 281
277 void handlePausedEvent(msg) { 282 void handlePausedEvent(msg) {
278 assert(msg["params"] != null); 283 assert(msg["params"] != null);
284 var reason = msg["params"]["reason"];
279 stackTrace = msg["params"]["callFrames"]; 285 stackTrace = msg["params"]["callFrames"];
280 assert(stackTrace != null); 286 assert(stackTrace != null);
281 assert(stackTrace.length >= 1); 287 assert(stackTrace.length >= 1);
282 curFrame = stackTrace[0]; 288 curFrame = stackTrace[0];
283 print("VM paused, stack trace:"); 289 if (reason == "breakpoint") {
290 print("VM paused on breakpoint");
291 } else {
292 assert(reason == "exception");
293 var excObj = msg["params"]["exception"];
294 print("VM paused on exception");
295 print(remoteValue(excObj));
296 }
297 print("Stack trace:");
284 printStackTrace(stackTrace); 298 printStackTrace(stackTrace);
285 } 299 }
286 300
287 301
288 void processVmMessage(String json) { 302 void processVmMessage(String json) {
289 var msg = JSON.parse(json); 303 var msg = JSON.parse(json);
290 if (msg == null) { 304 if (msg == null) {
291 return; 305 return;
292 } 306 }
293 var event = msg["event"]; 307 var event = msg["event"];
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 }; 377 };
364 vmInStream.onError = (err) { 378 vmInStream.onError = (err) {
365 print("Error in debug connection: $err"); 379 print("Error in debug connection: $err");
366 quitShell(); 380 quitShell();
367 }; 381 };
368 vmInStream.onClosed = () { 382 vmInStream.onClosed = () {
369 print("VM debugger connection closed"); 383 print("VM debugger connection closed");
370 quitShell(); 384 quitShell();
371 }; 385 };
372 } 386 }
OLDNEW
« runtime/vm/exceptions.cc ('K') | « runtime/vm/exceptions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698