OLD | NEW |
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 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 | 1327 |
1328 static bool GetStack(Thread* thread, JSONStream* js) { | 1328 static bool GetStack(Thread* thread, JSONStream* js) { |
1329 Isolate* isolate = thread->isolate(); | 1329 Isolate* isolate = thread->isolate(); |
1330 if (isolate->debugger() == NULL) { | 1330 if (isolate->debugger() == NULL) { |
1331 js->PrintError(kFeatureDisabled, | 1331 js->PrintError(kFeatureDisabled, |
1332 "Cannot get stack when debugger disabled."); | 1332 "Cannot get stack when debugger disabled."); |
1333 return true; | 1333 return true; |
1334 } | 1334 } |
1335 ASSERT(isolate->compilation_allowed()); | 1335 ASSERT(isolate->compilation_allowed()); |
1336 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); | 1336 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); |
| 1337 DebuggerStackTrace* async_causal_stack = |
| 1338 isolate->debugger()->AsyncCausalStackTrace(); |
1337 // Do we want the complete script object and complete local variable objects? | 1339 // Do we want the complete script object and complete local variable objects? |
1338 // This is true for dump requests. | 1340 // This is true for dump requests. |
1339 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false); | 1341 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false); |
1340 JSONObject jsobj(js); | 1342 JSONObject jsobj(js); |
1341 jsobj.AddProperty("type", "Stack"); | 1343 jsobj.AddProperty("type", "Stack"); |
1342 { | 1344 { |
1343 JSONArray jsarr(&jsobj, "frames"); | 1345 JSONArray jsarr(&jsobj, "frames"); |
1344 | 1346 |
1345 intptr_t num_frames = stack->Length(); | 1347 intptr_t num_frames = stack->Length(); |
1346 for (intptr_t i = 0; i < num_frames; i++) { | 1348 for (intptr_t i = 0; i < num_frames; i++) { |
1347 ActivationFrame* frame = stack->FrameAt(i); | 1349 ActivationFrame* frame = stack->FrameAt(i); |
1348 JSONObject jsobj(&jsarr); | 1350 JSONObject jsobj(&jsarr); |
1349 frame->PrintToJSONObject(&jsobj, full); | 1351 frame->PrintToJSONObject(&jsobj, full); |
1350 jsobj.AddProperty("index", i); | 1352 jsobj.AddProperty("index", i); |
1351 } | 1353 } |
1352 } | 1354 } |
1353 | 1355 |
| 1356 if (async_causal_stack != NULL) { |
| 1357 JSONArray jsarr(&jsobj, "asyncCausalFrames"); |
| 1358 intptr_t num_frames = async_causal_stack->Length(); |
| 1359 for (intptr_t i = 0; i < num_frames; i++) { |
| 1360 ActivationFrame* frame = async_causal_stack->FrameAt(i); |
| 1361 JSONObject jsobj(&jsarr); |
| 1362 frame->PrintToJSONObject(&jsobj, full); |
| 1363 jsobj.AddProperty("index", i); |
| 1364 } |
| 1365 } |
| 1366 |
1354 { | 1367 { |
1355 MessageHandler::AcquiredQueues aq(isolate->message_handler()); | 1368 MessageHandler::AcquiredQueues aq(isolate->message_handler()); |
1356 jsobj.AddProperty("messages", aq.queue()); | 1369 jsobj.AddProperty("messages", aq.queue()); |
1357 } | 1370 } |
1358 | 1371 |
1359 return true; | 1372 return true; |
1360 } | 1373 } |
1361 | 1374 |
1362 | 1375 |
1363 static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) { | 1376 static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) { |
(...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4122 if (strcmp(method_name, method.name) == 0) { | 4135 if (strcmp(method_name, method.name) == 0) { |
4123 return &method; | 4136 return &method; |
4124 } | 4137 } |
4125 } | 4138 } |
4126 return NULL; | 4139 return NULL; |
4127 } | 4140 } |
4128 | 4141 |
4129 #endif // !PRODUCT | 4142 #endif // !PRODUCT |
4130 | 4143 |
4131 } // namespace dart | 4144 } // namespace dart |
OLD | NEW |