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

Side by Side Diff: runtime/vm/service.cc

Issue 2646443005: Track async causal stack traces (Closed)
Patch Set: rebase Created 3 years, 10 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
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/simulator_dbc.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 1333
1334 static bool GetStack(Thread* thread, JSONStream* js) { 1334 static bool GetStack(Thread* thread, JSONStream* js) {
1335 Isolate* isolate = thread->isolate(); 1335 Isolate* isolate = thread->isolate();
1336 if (isolate->debugger() == NULL) { 1336 if (isolate->debugger() == NULL) {
1337 js->PrintError(kFeatureDisabled, 1337 js->PrintError(kFeatureDisabled,
1338 "Cannot get stack when debugger disabled."); 1338 "Cannot get stack when debugger disabled.");
1339 return true; 1339 return true;
1340 } 1340 }
1341 ASSERT(isolate->compilation_allowed()); 1341 ASSERT(isolate->compilation_allowed());
1342 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); 1342 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
1343 DebuggerStackTrace* async_causal_stack =
1344 isolate->debugger()->AsyncCausalStackTrace();
1343 // Do we want the complete script object and complete local variable objects? 1345 // Do we want the complete script object and complete local variable objects?
1344 // This is true for dump requests. 1346 // This is true for dump requests.
1345 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false); 1347 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false);
1346 JSONObject jsobj(js); 1348 JSONObject jsobj(js);
1347 jsobj.AddProperty("type", "Stack"); 1349 jsobj.AddProperty("type", "Stack");
1348 { 1350 {
1349 JSONArray jsarr(&jsobj, "frames"); 1351 JSONArray jsarr(&jsobj, "frames");
1350 1352
1351 intptr_t num_frames = stack->Length(); 1353 intptr_t num_frames = stack->Length();
1352 for (intptr_t i = 0; i < num_frames; i++) { 1354 for (intptr_t i = 0; i < num_frames; i++) {
1353 ActivationFrame* frame = stack->FrameAt(i); 1355 ActivationFrame* frame = stack->FrameAt(i);
1354 JSONObject jsobj(&jsarr); 1356 JSONObject jsobj(&jsarr);
1355 frame->PrintToJSONObject(&jsobj, full); 1357 frame->PrintToJSONObject(&jsobj, full);
1356 jsobj.AddProperty("index", i); 1358 jsobj.AddProperty("index", i);
1357 } 1359 }
1358 } 1360 }
1359 1361
1362 if (async_causal_stack != NULL) {
1363 JSONArray jsarr(&jsobj, "asyncCausalFrames");
1364 intptr_t num_frames = async_causal_stack->Length();
1365 for (intptr_t i = 0; i < num_frames; i++) {
1366 ActivationFrame* frame = async_causal_stack->FrameAt(i);
1367 JSONObject jsobj(&jsarr);
1368 frame->PrintToJSONObject(&jsobj, full);
1369 jsobj.AddProperty("index", i);
1370 }
1371 }
1372
1360 { 1373 {
1361 MessageHandler::AcquiredQueues aq(isolate->message_handler()); 1374 MessageHandler::AcquiredQueues aq(isolate->message_handler());
1362 jsobj.AddProperty("messages", aq.queue()); 1375 jsobj.AddProperty("messages", aq.queue());
1363 } 1376 }
1364 1377
1365 return true; 1378 return true;
1366 } 1379 }
1367 1380
1368 1381
1369 static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) { 1382 static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) {
(...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after
4131 if (strcmp(method_name, method.name) == 0) { 4144 if (strcmp(method_name, method.name) == 0) {
4132 return &method; 4145 return &method;
4133 } 4146 }
4134 } 4147 }
4135 return NULL; 4148 return NULL;
4136 } 4149 }
4137 4150
4138 #endif // !PRODUCT 4151 #endif // !PRODUCT
4139 4152
4140 } // namespace dart 4153 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698