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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 | 1332 |
1333 | 1333 |
1334 static const MethodParameter* get_stack_params[] = { | 1334 static const MethodParameter* get_stack_params[] = { |
1335 RUNNABLE_ISOLATE_PARAMETER, | 1335 RUNNABLE_ISOLATE_PARAMETER, |
1336 new BoolParameter("_full", false), | 1336 new BoolParameter("_full", false), |
1337 NULL, | 1337 NULL, |
1338 }; | 1338 }; |
1339 | 1339 |
1340 | 1340 |
1341 static bool GetStack(Thread* thread, JSONStream* js) { | 1341 static bool GetStack(Thread* thread, JSONStream* js) { |
1342 if (!thread->isolate()->compilation_allowed()) { | 1342 Isolate* isolate = thread->isolate(); |
| 1343 if (isolate->debugger() == NULL) { |
1343 js->PrintError(kFeatureDisabled, | 1344 js->PrintError(kFeatureDisabled, |
1344 "Cannot get stack when running a precompiled program."); | 1345 "Cannot get stack when debugger disabled."); |
1345 return true; | 1346 return true; |
1346 } | 1347 } |
1347 Isolate* isolate = thread->isolate(); | 1348 ASSERT(isolate->compilation_allowed()); |
1348 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); | 1349 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); |
1349 // Do we want the complete script object and complete local variable objects? | 1350 // Do we want the complete script object and complete local variable objects? |
1350 // This is true for dump requests. | 1351 // This is true for dump requests. |
1351 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false); | 1352 const bool full = BoolParameter::Parse(js->LookupParam("_full"), false); |
1352 JSONObject jsobj(js); | 1353 JSONObject jsobj(js); |
1353 jsobj.AddProperty("type", "Stack"); | 1354 jsobj.AddProperty("type", "Stack"); |
1354 { | 1355 { |
1355 JSONArray jsarr(&jsobj, "frames"); | 1356 JSONArray jsarr(&jsobj, "frames"); |
1356 | 1357 |
1357 intptr_t num_frames = stack->Length(); | 1358 intptr_t num_frames = stack->Length(); |
(...skipping 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4130 if (strcmp(method_name, method.name) == 0) { | 4131 if (strcmp(method_name, method.name) == 0) { |
4131 return &method; | 4132 return &method; |
4132 } | 4133 } |
4133 } | 4134 } |
4134 return NULL; | 4135 return NULL; |
4135 } | 4136 } |
4136 | 4137 |
4137 #endif // !PRODUCT | 4138 #endif // !PRODUCT |
4138 | 4139 |
4139 } // namespace dart | 4140 } // namespace dart |
OLD | NEW |