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

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

Issue 242453011: Add class id to debugger stack trace (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 static void FormatCallFrames(dart::TextBuffer* msg, Dart_StackTrace trace) { 466 static void FormatCallFrames(dart::TextBuffer* msg, Dart_StackTrace trace) {
467 intptr_t trace_len = 0; 467 intptr_t trace_len = 0;
468 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); 468 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len);
469 ASSERT_NOT_ERROR(res); 469 ASSERT_NOT_ERROR(res);
470 msg->Printf("\"callFrames\" : [ "); 470 msg->Printf("\"callFrames\" : [ ");
471 for (int i = 0; i < trace_len; i++) { 471 for (int i = 0; i < trace_len; i++) {
472 Dart_ActivationFrame frame; 472 Dart_ActivationFrame frame;
473 res = Dart_GetActivationFrame(trace, i, &frame); 473 res = Dart_GetActivationFrame(trace, i, &frame);
474 ASSERT_NOT_ERROR(res); 474 ASSERT_NOT_ERROR(res);
475 Dart_Handle func_name; 475 Dart_Handle func_name;
476 Dart_Handle func;
476 Dart_CodeLocation location; 477 Dart_CodeLocation location;
477 res = Dart_ActivationFrameGetLocation(frame, &func_name, NULL, &location); 478 res = Dart_ActivationFrameGetLocation(frame, &func_name, &func, &location);
478 ASSERT_NOT_ERROR(res); 479 ASSERT_NOT_ERROR(res);
479 ASSERT(Dart_IsString(func_name)); 480 ASSERT(Dart_IsString(func_name));
480 msg->Printf("%s{\"functionName\":", (i > 0) ? "," : ""); 481 msg->Printf("%s{\"functionName\":", (i > 0) ? "," : "");
481 FormatEncodedString(msg, func_name); 482 FormatEncodedString(msg, func_name);
482 if (!Dart_IsNull(location.script_url)) { 483 if (!Dart_IsNull(location.script_url)) {
483 ASSERT(Dart_IsString(location.script_url)); 484 ASSERT(Dart_IsString(location.script_url));
484 msg->Printf(",\"location\": { \"url\":"); 485 msg->Printf(",\"location\": { \"url\":");
485 FormatEncodedString(msg, location.script_url); 486 FormatEncodedString(msg, location.script_url);
486 msg->Printf(",\"libraryId\":%d,", location.library_id); 487 msg->Printf(",\"libraryId\":%d,", location.library_id);
487 msg->Printf("\"tokenOffset\":%d}", location.token_pos); 488 msg->Printf("\"tokenOffset\":%d}", location.token_pos);
488 } 489 }
490 ASSERT_NOT_ERROR(func);
491 Dart_Handle origin = Dart_GetFunctionOrigin(func);
492 ASSERT_NOT_ERROR(origin);
493 if (Dart_IsInteger(origin)) {
494 int64_t class_id = GetIntValue(origin);
495 msg->Printf(",\"classId\":%" Pd64 "", class_id);
496 }
489 Dart_Handle locals = Dart_GetLocalVariables(frame); 497 Dart_Handle locals = Dart_GetLocalVariables(frame);
490 ASSERT_NOT_ERROR(locals); 498 ASSERT_NOT_ERROR(locals);
491 msg->Printf(",\"locals\":"); 499 msg->Printf(",\"locals\":");
492 FormatNamedValueList(msg, locals); 500 FormatNamedValueList(msg, locals);
493 msg->Printf("}"); 501 msg->Printf("}");
494 } 502 }
495 msg->Printf("]"); 503 msg->Printf("]");
496 } 504 }
497 505
498 506
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 } else { 1387 } else {
1380 ASSERT(kind == kShutdown); 1388 ASSERT(kind == kShutdown);
1381 RemoveIsolateMsgQueue(isolate_id); 1389 RemoveIsolateMsgQueue(isolate_id);
1382 } 1390 }
1383 } 1391 }
1384 Dart_ExitScope(); 1392 Dart_ExitScope();
1385 } 1393 }
1386 1394
1387 } // namespace bin 1395 } // namespace bin
1388 } // namespace dart 1396 } // 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