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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 Isolate* isolate = thread->isolate(); | 1338 Isolate* isolate = thread->isolate(); |
1339 if (isolate->debugger() == NULL) { | 1339 if (isolate->debugger() == NULL) { |
1340 js->PrintError(kFeatureDisabled, | 1340 js->PrintError(kFeatureDisabled, |
1341 "Cannot get stack when debugger disabled."); | 1341 "Cannot get stack when debugger disabled."); |
1342 return true; | 1342 return true; |
1343 } | 1343 } |
1344 ASSERT(isolate->compilation_allowed()); | 1344 ASSERT(isolate->compilation_allowed()); |
1345 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); | 1345 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); |
1346 DebuggerStackTrace* async_causal_stack = | 1346 DebuggerStackTrace* async_causal_stack = |
1347 isolate->debugger()->AsyncCausalStackTrace(); | 1347 isolate->debugger()->AsyncCausalStackTrace(); |
| 1348 DebuggerStackTrace* awaiter_stack = isolate->debugger()->AwaiterStackTrace(); |
1348 // Do we want the complete script object and complete local variable objects? | 1349 // Do we want the complete script object and complete local variable objects? |
1349 // This is true for dump requests. | 1350 // This is true for dump requests. |
1350 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false); | 1351 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false); |
1351 JSONObject jsobj(js); | 1352 JSONObject jsobj(js); |
1352 jsobj.AddProperty("type", "Stack"); | 1353 jsobj.AddProperty("type", "Stack"); |
1353 { | 1354 { |
1354 JSONArray jsarr(&jsobj, "frames"); | 1355 JSONArray jsarr(&jsobj, "frames"); |
1355 | 1356 |
1356 intptr_t num_frames = stack->Length(); | 1357 intptr_t num_frames = stack->Length(); |
1357 for (intptr_t i = 0; i < num_frames; i++) { | 1358 for (intptr_t i = 0; i < num_frames; i++) { |
1358 ActivationFrame* frame = stack->FrameAt(i); | 1359 ActivationFrame* frame = stack->FrameAt(i); |
1359 JSONObject jsobj(&jsarr); | 1360 JSONObject jsobj(&jsarr); |
1360 frame->PrintToJSONObject(&jsobj, full); | 1361 frame->PrintToJSONObject(&jsobj, full); |
1361 jsobj.AddProperty("index", i); | 1362 jsobj.AddProperty("index", i); |
1362 } | 1363 } |
1363 } | 1364 } |
1364 | 1365 |
1365 if (async_causal_stack != NULL) { | 1366 if (async_causal_stack != NULL) { |
1366 JSONArray jsarr(&jsobj, "asyncCausalFrames"); | 1367 JSONArray jsarr(&jsobj, "asyncCausalFrames"); |
1367 intptr_t num_frames = async_causal_stack->Length(); | 1368 intptr_t num_frames = async_causal_stack->Length(); |
1368 for (intptr_t i = 0; i < num_frames; i++) { | 1369 for (intptr_t i = 0; i < num_frames; i++) { |
1369 ActivationFrame* frame = async_causal_stack->FrameAt(i); | 1370 ActivationFrame* frame = async_causal_stack->FrameAt(i); |
1370 JSONObject jsobj(&jsarr); | 1371 JSONObject jsobj(&jsarr); |
1371 frame->PrintToJSONObject(&jsobj, full); | 1372 frame->PrintToJSONObject(&jsobj, full); |
1372 jsobj.AddProperty("index", i); | 1373 jsobj.AddProperty("index", i); |
1373 } | 1374 } |
1374 } | 1375 } |
1375 | 1376 |
| 1377 if (awaiter_stack != NULL) { |
| 1378 JSONArray jsarr(&jsobj, "awaiterFrames"); |
| 1379 intptr_t num_frames = awaiter_stack->Length(); |
| 1380 for (intptr_t i = 0; i < num_frames; i++) { |
| 1381 ActivationFrame* frame = awaiter_stack->FrameAt(i); |
| 1382 JSONObject jsobj(&jsarr); |
| 1383 frame->PrintToJSONObject(&jsobj, full); |
| 1384 jsobj.AddProperty("index", i); |
| 1385 } |
| 1386 } |
| 1387 |
1376 { | 1388 { |
1377 MessageHandler::AcquiredQueues aq(isolate->message_handler()); | 1389 MessageHandler::AcquiredQueues aq(isolate->message_handler()); |
1378 jsobj.AddProperty("messages", aq.queue()); | 1390 jsobj.AddProperty("messages", aq.queue()); |
1379 } | 1391 } |
1380 | 1392 |
1381 return true; | 1393 return true; |
1382 } | 1394 } |
1383 | 1395 |
1384 | 1396 |
1385 static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) { | 1397 static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) { |
(...skipping 2782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4168 if (strcmp(method_name, method.name) == 0) { | 4180 if (strcmp(method_name, method.name) == 0) { |
4169 return &method; | 4181 return &method; |
4170 } | 4182 } |
4171 } | 4183 } |
4172 return NULL; | 4184 return NULL; |
4173 } | 4185 } |
4174 | 4186 |
4175 #endif // !PRODUCT | 4187 #endif // !PRODUCT |
4176 | 4188 |
4177 } // namespace dart | 4189 } // namespace dart |
OLD | NEW |