| 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 "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 JSONObject jsobj(js); | 726 JSONObject jsobj(js); |
| 727 jsobj.AddProperty("type", "Stack"); | 727 jsobj.AddProperty("type", "Stack"); |
| 728 { | 728 { |
| 729 JSONArray jsarr(&jsobj, "frames"); | 729 JSONArray jsarr(&jsobj, "frames"); |
| 730 | 730 |
| 731 intptr_t num_frames = stack->Length(); | 731 intptr_t num_frames = stack->Length(); |
| 732 for (intptr_t i = 0; i < num_frames; i++) { | 732 for (intptr_t i = 0; i < num_frames; i++) { |
| 733 ActivationFrame* frame = stack->FrameAt(i); | 733 ActivationFrame* frame = stack->FrameAt(i); |
| 734 JSONObject jsobj(&jsarr); | 734 JSONObject jsobj(&jsarr); |
| 735 frame->PrintToJSONObject(&jsobj, full); | 735 frame->PrintToJSONObject(&jsobj, full); |
| 736 // TODO(turnidge): Implement depth differently -- differentiate | 736 jsobj.AddProperty("index", i); |
| 737 // inlined frames. | |
| 738 jsobj.AddProperty("depth", i); | |
| 739 } | 737 } |
| 740 } | 738 } |
| 741 | 739 |
| 742 { | 740 { |
| 743 MessageHandler::AcquiredQueues aq; | 741 MessageHandler::AcquiredQueues aq; |
| 744 isolate->message_handler()->AcquireQueues(&aq); | 742 isolate->message_handler()->AcquireQueues(&aq); |
| 745 jsobj.AddProperty("messages", aq.queue()); | 743 jsobj.AddProperty("messages", aq.queue()); |
| 746 } | 744 } |
| 747 | 745 |
| 748 return true; | 746 return true; |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 js->PrintError(kInvalidParams, | 1547 js->PrintError(kInvalidParams, |
| 1550 "%s: invalid 'targetId' parameter: " | 1548 "%s: invalid 'targetId' parameter: " |
| 1551 "id '%s' does not correspond to a " | 1549 "id '%s' does not correspond to a " |
| 1552 "library, class, or instance", js->method(), target_id); | 1550 "library, class, or instance", js->method(), target_id); |
| 1553 return true; | 1551 return true; |
| 1554 } | 1552 } |
| 1555 | 1553 |
| 1556 | 1554 |
| 1557 static const MethodParameter* evaluate_in_frame_params[] = { | 1555 static const MethodParameter* evaluate_in_frame_params[] = { |
| 1558 ISOLATE_PARAMETER, | 1556 ISOLATE_PARAMETER, |
| 1559 new UIntParameter("frame", true), | 1557 new UIntParameter("frameIndex", true), |
| 1560 new MethodParameter("expression", true), | 1558 new MethodParameter("expression", true), |
| 1561 NULL, | 1559 NULL, |
| 1562 }; | 1560 }; |
| 1563 | 1561 |
| 1564 | 1562 |
| 1565 static bool EvaluateInFrame(Isolate* isolate, JSONStream* js) { | 1563 static bool EvaluateInFrame(Isolate* isolate, JSONStream* js) { |
| 1566 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); | 1564 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); |
| 1567 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frame")); | 1565 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frameIndex")); |
| 1568 if (framePos > stack->Length()) { | 1566 if (framePos > stack->Length()) { |
| 1569 PrintInvalidParamError(js, "frame"); | 1567 PrintInvalidParamError(js, "frameIndex"); |
| 1570 return true; | 1568 return true; |
| 1571 } | 1569 } |
| 1572 ActivationFrame* frame = stack->FrameAt(framePos); | 1570 ActivationFrame* frame = stack->FrameAt(framePos); |
| 1573 | 1571 |
| 1574 const char* expr = js->LookupParam("expression"); | 1572 const char* expr = js->LookupParam("expression"); |
| 1575 const String& expr_str = String::Handle(isolate, String::New(expr)); | 1573 const String& expr_str = String::Handle(isolate, String::New(expr)); |
| 1576 | 1574 |
| 1577 const Object& result = Object::Handle(frame->Evaluate(expr_str)); | 1575 const Object& result = Object::Handle(frame->Evaluate(expr_str)); |
| 1578 result.PrintJSON(js, true); | 1576 result.PrintJSON(js, true); |
| 1579 return true; | 1577 return true; |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2692 ServiceMethodDescriptor& method = service_methods_[i]; | 2690 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2693 if (strcmp(method_name, method.name) == 0) { | 2691 if (strcmp(method_name, method.name) == 0) { |
| 2694 return &method; | 2692 return &method; |
| 2695 } | 2693 } |
| 2696 } | 2694 } |
| 2697 return NULL; | 2695 return NULL; |
| 2698 } | 2696 } |
| 2699 | 2697 |
| 2700 | 2698 |
| 2701 } // namespace dart | 2699 } // namespace dart |
| OLD | NEW |