| 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 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 return true; | 1480 return true; |
| 1481 } | 1481 } |
| 1482 js->PrintError(kInvalidParams, | 1482 js->PrintError(kInvalidParams, |
| 1483 "%s: invalid 'targetId' parameter: " | 1483 "%s: invalid 'targetId' parameter: " |
| 1484 "id '%s' does not correspond to a " | 1484 "id '%s' does not correspond to a " |
| 1485 "library, class, or instance", js->method(), target_id); | 1485 "library, class, or instance", js->method(), target_id); |
| 1486 return true; | 1486 return true; |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 | 1489 |
| 1490 static const MethodParameter* eval_params[] = { | 1490 static const MethodParameter* evaluate_params[] = { |
| 1491 ISOLATE_PARAMETER, | 1491 ISOLATE_PARAMETER, |
| 1492 NULL, | 1492 NULL, |
| 1493 }; | 1493 }; |
| 1494 | 1494 |
| 1495 | 1495 |
| 1496 static bool Eval(Isolate* isolate, JSONStream* js) { | 1496 static bool Evaluate(Isolate* isolate, JSONStream* js) { |
| 1497 const char* target_id = js->LookupParam("targetId"); | 1497 const char* target_id = js->LookupParam("targetId"); |
| 1498 if (target_id == NULL) { | 1498 if (target_id == NULL) { |
| 1499 PrintMissingParamError(js, "targetId"); | 1499 PrintMissingParamError(js, "targetId"); |
| 1500 return true; | 1500 return true; |
| 1501 } | 1501 } |
| 1502 const char* expr = js->LookupParam("expression"); | 1502 const char* expr = js->LookupParam("expression"); |
| 1503 if (expr == NULL) { | 1503 if (expr == NULL) { |
| 1504 PrintMissingParamError(js, "expression"); | 1504 PrintMissingParamError(js, "expression"); |
| 1505 return true; | 1505 return true; |
| 1506 } | 1506 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 return true; | 1547 return true; |
| 1548 } | 1548 } |
| 1549 js->PrintError(kInvalidParams, | 1549 js->PrintError(kInvalidParams, |
| 1550 "%s: invalid 'targetId' parameter: " | 1550 "%s: invalid 'targetId' parameter: " |
| 1551 "id '%s' does not correspond to a " | 1551 "id '%s' does not correspond to a " |
| 1552 "library, class, or instance", js->method(), target_id); | 1552 "library, class, or instance", js->method(), target_id); |
| 1553 return true; | 1553 return true; |
| 1554 } | 1554 } |
| 1555 | 1555 |
| 1556 | 1556 |
| 1557 static const MethodParameter* eval_frame_params[] = { | 1557 static const MethodParameter* evaluate_in_frame_params[] = { |
| 1558 ISOLATE_PARAMETER, | 1558 ISOLATE_PARAMETER, |
| 1559 new UIntParameter("frame", true), | 1559 new UIntParameter("frame", true), |
| 1560 new MethodParameter("expression", true), | 1560 new MethodParameter("expression", true), |
| 1561 NULL, | 1561 NULL, |
| 1562 }; | 1562 }; |
| 1563 | 1563 |
| 1564 | 1564 |
| 1565 static bool EvalFrame(Isolate* isolate, JSONStream* js) { | 1565 static bool EvaluateInFrame(Isolate* isolate, JSONStream* js) { |
| 1566 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); | 1566 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); |
| 1567 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frame")); | 1567 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frame")); |
| 1568 if (framePos > stack->Length()) { | 1568 if (framePos > stack->Length()) { |
| 1569 PrintInvalidParamError(js, "frame"); | 1569 PrintInvalidParamError(js, "frame"); |
| 1570 return true; | 1570 return true; |
| 1571 } | 1571 } |
| 1572 ActivationFrame* frame = stack->FrameAt(framePos); | 1572 ActivationFrame* frame = stack->FrameAt(framePos); |
| 1573 | 1573 |
| 1574 const char* expr = js->LookupParam("expression"); | 1574 const char* expr = js->LookupParam("expression"); |
| 1575 const String& expr_str = String::Handle(isolate, String::New(expr)); | 1575 const String& expr_str = String::Handle(isolate, String::New(expr)); |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2569 { "_respondWithMalformedObject", RespondWithMalformedObject, | 2569 { "_respondWithMalformedObject", RespondWithMalformedObject, |
| 2570 NULL }, | 2570 NULL }, |
| 2571 { "_triggerEchoEvent", TriggerEchoEvent, | 2571 { "_triggerEchoEvent", TriggerEchoEvent, |
| 2572 NULL }, | 2572 NULL }, |
| 2573 { "addBreakpoint", AddBreakpoint, | 2573 { "addBreakpoint", AddBreakpoint, |
| 2574 add_breakpoint_params }, | 2574 add_breakpoint_params }, |
| 2575 { "addBreakpointAtEntry", AddBreakpointAtEntry, | 2575 { "addBreakpointAtEntry", AddBreakpointAtEntry, |
| 2576 add_breakpoint_at_entry_params }, | 2576 add_breakpoint_at_entry_params }, |
| 2577 { "clearCpuProfile", ClearCpuProfile, | 2577 { "clearCpuProfile", ClearCpuProfile, |
| 2578 clear_cpu_profile_params }, | 2578 clear_cpu_profile_params }, |
| 2579 { "eval", Eval, | 2579 { "evaluate", Evaluate, |
| 2580 eval_params }, | 2580 evaluate_params }, |
| 2581 { "evalFrame", EvalFrame, | 2581 { "evaluateInFrame", EvaluateInFrame, |
| 2582 eval_frame_params }, | 2582 evaluate_in_frame_params }, |
| 2583 { "_getAllocationProfile", GetAllocationProfile, | 2583 { "_getAllocationProfile", GetAllocationProfile, |
| 2584 get_allocation_profile_params }, | 2584 get_allocation_profile_params }, |
| 2585 { "_getCallSiteData", GetCallSiteData, | 2585 { "_getCallSiteData", GetCallSiteData, |
| 2586 get_call_site_data_params }, | 2586 get_call_site_data_params }, |
| 2587 { "getClassList", GetClassList, | 2587 { "getClassList", GetClassList, |
| 2588 get_class_list_params }, | 2588 get_class_list_params }, |
| 2589 { "getCoverage", GetCoverage, | 2589 { "getCoverage", GetCoverage, |
| 2590 get_coverage_params }, | 2590 get_coverage_params }, |
| 2591 { "getCpuProfile", GetCpuProfile, | 2591 { "getCpuProfile", GetCpuProfile, |
| 2592 get_cpu_profile_params }, | 2592 get_cpu_profile_params }, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2646 ServiceMethodDescriptor& method = service_methods_[i]; | 2646 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2647 if (strcmp(method_name, method.name) == 0) { | 2647 if (strcmp(method_name, method.name) == 0) { |
| 2648 return &method; | 2648 return &method; |
| 2649 } | 2649 } |
| 2650 } | 2650 } |
| 2651 return NULL; | 2651 return NULL; |
| 2652 } | 2652 } |
| 2653 | 2653 |
| 2654 | 2654 |
| 2655 } // namespace dart | 2655 } // namespace dart |
| OLD | NEW |