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_return_stack = |
| 1338 isolate->debugger()->AsyncReturnStack(); |
| 1339 |
1337 // Do we want the complete script object and complete local variable objects? | 1340 // Do we want the complete script object and complete local variable objects? |
1338 // This is true for dump requests. | 1341 // This is true for dump requests. |
1339 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false); | 1342 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false); |
1340 JSONObject jsobj(js); | 1343 JSONObject jsobj(js); |
1341 jsobj.AddProperty("type", "Stack"); | 1344 jsobj.AddProperty("type", "Stack"); |
1342 { | 1345 { |
1343 JSONArray jsarr(&jsobj, "frames"); | 1346 JSONArray jsarr(&jsobj, "frames"); |
1344 | 1347 |
1345 intptr_t num_frames = stack->Length(); | 1348 intptr_t num_frames = stack->Length(); |
1346 for (intptr_t i = 0; i < num_frames; i++) { | 1349 for (intptr_t i = 0; i < num_frames; i++) { |
1347 ActivationFrame* frame = stack->FrameAt(i); | 1350 ActivationFrame* frame = stack->FrameAt(i); |
1348 JSONObject jsobj(&jsarr); | 1351 JSONObject jsobj(&jsarr); |
1349 frame->PrintToJSONObject(&jsobj, full); | 1352 frame->PrintToJSONObject(&jsobj, full); |
1350 jsobj.AddProperty("index", i); | 1353 jsobj.AddProperty("index", i); |
1351 } | 1354 } |
1352 } | 1355 } |
1353 | 1356 |
| 1357 if (async_return_stack != NULL) { |
| 1358 JSONArray jsarr(&jsobj, "asyncFrames"); |
| 1359 |
| 1360 intptr_t num_frames = async_return_stack->Length(); |
| 1361 for (intptr_t i = 0; i < num_frames; i++) { |
| 1362 ActivationFrame* frame = async_return_stack->FrameAt(i); |
| 1363 JSONObject jsobj(&jsarr); |
| 1364 frame->PrintToJSONObject(&jsobj, full); |
| 1365 jsobj.AddProperty("index", i); |
| 1366 } |
| 1367 } |
| 1368 |
1354 { | 1369 { |
1355 MessageHandler::AcquiredQueues aq(isolate->message_handler()); | 1370 MessageHandler::AcquiredQueues aq(isolate->message_handler()); |
1356 jsobj.AddProperty("messages", aq.queue()); | 1371 jsobj.AddProperty("messages", aq.queue()); |
1357 } | 1372 } |
1358 | 1373 |
1359 return true; | 1374 return true; |
1360 } | 1375 } |
1361 | 1376 |
1362 | 1377 |
1363 static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) { | 1378 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) { | 4137 if (strcmp(method_name, method.name) == 0) { |
4123 return &method; | 4138 return &method; |
4124 } | 4139 } |
4125 } | 4140 } |
4126 return NULL; | 4141 return NULL; |
4127 } | 4142 } |
4128 | 4143 |
4129 #endif // !PRODUCT | 4144 #endif // !PRODUCT |
4130 | 4145 |
4131 } // namespace dart | 4146 } // namespace dart |
OLD | NEW |