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

Side by Side Diff: runtime/bin/dbg_message.cc

Issue 61153006: Add closure object type to debugger wire protocol (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | « no previous file | runtime/include/dart_debugger_api.h » ('j') | 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 #include "bin/dbg_connection.h" 5 #include "bin/dbg_connection.h"
6 #include "bin/dbg_message.h" 6 #include "bin/dbg_message.h"
7 #include "bin/dartutils.h" 7 #include "bin/dartutils.h"
8 #include "bin/thread.h" 8 #include "bin/thread.h"
9 #include "bin/utils.h" 9 #include "bin/utils.h"
10 10
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } else if (Dart_IsError(text)) { 220 } else if (Dart_IsError(text)) {
221 buf->Printf("#ERROR"); 221 buf->Printf("#ERROR");
222 } else { 222 } else {
223 FormatEncodedCharsTrunc(buf, text, max_chars); 223 FormatEncodedCharsTrunc(buf, text, max_chars);
224 } 224 }
225 } 225 }
226 } 226 }
227 227
228 228
229 static void FormatValue(dart::TextBuffer* buf, Dart_Handle object) { 229 static void FormatValue(dart::TextBuffer* buf, Dart_Handle object) {
230 bool print_text_field = true;
230 if (Dart_IsNumber(object)) { 231 if (Dart_IsNumber(object)) {
231 buf->Printf("\"kind\":\"number\","); 232 buf->Printf("\"kind\":\"number\"");
232 } else if (Dart_IsString(object)) { 233 } else if (Dart_IsString(object)) {
233 buf->Printf("\"kind\":\"string\","); 234 buf->Printf("\"kind\":\"string\"");
234 } else if (Dart_IsBoolean(object)) { 235 } else if (Dart_IsBoolean(object)) {
235 buf->Printf("\"kind\":\"boolean\","); 236 buf->Printf("\"kind\":\"boolean\"");
236 } else if (Dart_IsList(object)) { 237 } else if (Dart_IsList(object)) {
237 intptr_t len = 0; 238 intptr_t len = 0;
238 Dart_Handle res = Dart_ListLength(object, &len); 239 Dart_Handle res = Dart_ListLength(object, &len);
239 ASSERT_NOT_ERROR(res); 240 ASSERT_NOT_ERROR(res);
240 buf->Printf("\"kind\":\"list\",\"length\":%" Pd ",", len); 241 buf->Printf("\"kind\":\"list\",\"length\":%" Pd "", len);
242 } else if (Dart_IsClosure(object)) {
243 Dart_Handle name, signature;
244 Dart_CodeLocation location;
245 Dart_Handle res = Dart_GetClosureInfo(object, &name, &signature, &location);
246 ASSERT_NOT_ERROR(res);
247 buf->Printf("\"kind\":\"function\",\"name\":\"%s\"", GetStringChars(name));
248 buf->Printf(",\"signature\":\"%s\"", GetStringChars(signature));
249 if (!Dart_IsNull(location.script_url)) {
250 ASSERT(Dart_IsString(location.script_url));
251 buf->Printf(",\"location\": { \"url\":");
252 FormatEncodedString(buf, location.script_url);
253 buf->Printf(",\"libraryId\":%d,", location.library_id);
254 buf->Printf("\"tokenOffset\":%d}", location.token_pos);
255 }
256 print_text_field = false;
241 } else { 257 } else {
242 buf->Printf("\"kind\":\"object\","); 258 buf->Printf("\"kind\":\"object\"");
243 intptr_t class_id = 0; 259 intptr_t class_id = 0;
244 Dart_Handle res = Dart_GetObjClassId(object, &class_id); 260 Dart_Handle res = Dart_GetObjClassId(object, &class_id);
245 if (!Dart_IsError(res)) { 261 if (!Dart_IsError(res)) {
246 buf->Printf("\"classId\":%" Pd ",", class_id); 262 buf->Printf(",\"classId\":%" Pd ",", class_id);
247 } 263 }
248 } 264 }
249 buf->Printf("\"text\":\""); 265 if (print_text_field) {
250 const intptr_t max_chars = 250; 266 buf->Printf(",\"text\":\"");
251 FormatTextualValue(buf, object, max_chars, true); 267 const intptr_t max_chars = 250;
252 buf->Printf("\""); 268 FormatTextualValue(buf, object, max_chars, true);
269 buf->Printf("\"");
270 }
253 } 271 }
254 272
255 273
256 static void FormatValueObj(dart::TextBuffer* buf, Dart_Handle object) { 274 static void FormatValueObj(dart::TextBuffer* buf, Dart_Handle object) {
257 buf->Printf("{"); 275 buf->Printf("{");
258 FormatValue(buf, object); 276 FormatValue(buf, object);
259 buf->Printf("}"); 277 buf->Printf("}");
260 } 278 }
261 279
262 280
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 } else { 1324 } else {
1307 ASSERT(kind == kShutdown); 1325 ASSERT(kind == kShutdown);
1308 RemoveIsolateMsgQueue(isolate_id); 1326 RemoveIsolateMsgQueue(isolate_id);
1309 } 1327 }
1310 } 1328 }
1311 Dart_ExitScope(); 1329 Dart_ExitScope();
1312 } 1330 }
1313 1331
1314 } // namespace bin 1332 } // namespace bin
1315 } // namespace dart 1333 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/include/dart_debugger_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698