Chromium Code Reviews| 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 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2613 // Construct the isolate list. | 2613 // Construct the isolate list. |
| 2614 { | 2614 { |
| 2615 JSONArray jsarr(&jsobj, "isolates"); | 2615 JSONArray jsarr(&jsobj, "isolates"); |
| 2616 ServiceIsolateVisitor visitor(&jsarr); | 2616 ServiceIsolateVisitor visitor(&jsarr); |
| 2617 Isolate::VisitIsolates(&visitor); | 2617 Isolate::VisitIsolates(&visitor); |
| 2618 } | 2618 } |
| 2619 return true; | 2619 return true; |
| 2620 } | 2620 } |
| 2621 | 2621 |
| 2622 | 2622 |
| 2623 static const MethodParameter* get_debugger_update_params[] = { | |
| 2624 ISOLATE_PARAMETER, | |
| 2625 NULL, | |
| 2626 }; | |
| 2627 | |
| 2628 | |
| 2629 static bool GetDebuggerUpdate(Isolate* isolate, JSONStream* js) { | |
| 2630 if (Service::NeedsDebugEvents()) { | |
| 2631 ServiceEvent event(isolate, ServiceEvent::kDebuggerUpdate); | |
| 2632 Service::HandleEvent(&event); | |
| 2633 } | |
| 2634 PrintSuccess(js); | |
| 2635 return true; | |
| 2636 } | |
| 2637 | |
| 2638 | |
| 2639 static const MethodParameter* set_exception_pause_info_params[] = { | |
| 2640 ISOLATE_PARAMETER, | |
| 2641 NULL, | |
| 2642 }; | |
| 2643 | |
| 2644 | |
| 2645 static bool SetExceptionPauseInfo(Isolate* isolate, JSONStream* js) { | |
| 2646 const char* exceptions = js->LookupParam("exceptions"); | |
| 2647 if (exceptions == NULL) { | |
| 2648 PrintMissingParamError(js, "exceptions"); | |
| 2649 return true; | |
| 2650 } | |
| 2651 | |
| 2652 Dart_ExceptionPauseInfo info = kNoPauseOnExceptions; | |
| 2653 if (strcmp(exceptions, "none") == 0) { | |
| 2654 info = kNoPauseOnExceptions; | |
| 2655 } else if (strcmp(exceptions, "all") == 0) { | |
| 2656 info = kPauseOnAllExceptions; | |
| 2657 } else if (strcmp(exceptions, "unhandled") == 0) { | |
| 2658 info = kPauseOnUnhandledExceptions; | |
| 2659 } else { | |
| 2660 JSONObject jsobj(js); | |
| 2661 jsobj.AddProperty("type", "Error"); | |
| 2662 jsobj.AddProperty("message", "illegal value for parameter 'exceptions'"); | |
| 2663 return true; | |
| 2664 } | |
| 2665 | |
| 2666 isolate->debugger()->SetExceptionPauseInfo(info); | |
| 2667 if (Service::NeedsDebugEvents()) { | |
| 2668 ServiceEvent event(isolate, ServiceEvent::kDebuggerUpdate); | |
| 2669 Service::HandleEvent(&event); | |
| 2670 } | |
| 2671 PrintSuccess(js); | |
| 2672 return true; | |
| 2673 } | |
| 2674 | |
| 2675 | |
| 2623 static const MethodParameter* get_flag_list_params[] = { | 2676 static const MethodParameter* get_flag_list_params[] = { |
| 2624 NO_ISOLATE_PARAMETER, | 2677 NO_ISOLATE_PARAMETER, |
| 2625 NULL, | 2678 NULL, |
| 2626 }; | 2679 }; |
| 2627 | 2680 |
| 2628 | 2681 |
| 2629 static bool GetFlagList(Isolate* isolate, JSONStream* js) { | 2682 static bool GetFlagList(Isolate* isolate, JSONStream* js) { |
| 2630 Flags::PrintJSON(js); | 2683 Flags::PrintJSON(js); |
| 2631 return true; | 2684 return true; |
| 2632 } | 2685 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2731 { "_getAllocationProfile", GetAllocationProfile, | 2784 { "_getAllocationProfile", GetAllocationProfile, |
| 2732 get_allocation_profile_params }, | 2785 get_allocation_profile_params }, |
| 2733 { "_getCallSiteData", GetCallSiteData, | 2786 { "_getCallSiteData", GetCallSiteData, |
| 2734 get_call_site_data_params }, | 2787 get_call_site_data_params }, |
| 2735 { "getClassList", GetClassList, | 2788 { "getClassList", GetClassList, |
| 2736 get_class_list_params }, | 2789 get_class_list_params }, |
| 2737 { "_getCoverage", GetCoverage, | 2790 { "_getCoverage", GetCoverage, |
| 2738 get_coverage_params }, | 2791 get_coverage_params }, |
| 2739 { "_getCpuProfile", GetCpuProfile, | 2792 { "_getCpuProfile", GetCpuProfile, |
| 2740 get_cpu_profile_params }, | 2793 get_cpu_profile_params }, |
| 2794 { "_getDebuggerUpdate", GetDebuggerUpdate, | |
|
Cutch
2015/06/12 13:10:47
What about including the debugger settings in stac
rmacnak
2015/06/15 17:53:51
Seems okay. A debugger will generally fetch the st
| |
| 2795 get_debugger_update_params }, | |
| 2741 { "getFlagList", GetFlagList , | 2796 { "getFlagList", GetFlagList , |
| 2742 get_flag_list_params }, | 2797 get_flag_list_params }, |
| 2743 { "_getHeapMap", GetHeapMap, | 2798 { "_getHeapMap", GetHeapMap, |
| 2744 get_heap_map_params }, | 2799 get_heap_map_params }, |
| 2745 { "_getInboundReferences", GetInboundReferences, | 2800 { "_getInboundReferences", GetInboundReferences, |
| 2746 get_inbound_references_params }, | 2801 get_inbound_references_params }, |
| 2747 { "_getInstances", GetInstances, | 2802 { "_getInstances", GetInstances, |
| 2748 get_instances_params }, | 2803 get_instances_params }, |
| 2749 { "getIsolate", GetIsolate, | 2804 { "getIsolate", GetIsolate, |
| 2750 get_isolate_params }, | 2805 get_isolate_params }, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 2775 { "_getVMMetricList", GetVMMetricList, | 2830 { "_getVMMetricList", GetVMMetricList, |
| 2776 get_vm_metric_list_params }, | 2831 get_vm_metric_list_params }, |
| 2777 { "pause", Pause, | 2832 { "pause", Pause, |
| 2778 pause_params }, | 2833 pause_params }, |
| 2779 { "removeBreakpoint", RemoveBreakpoint, | 2834 { "removeBreakpoint", RemoveBreakpoint, |
| 2780 remove_breakpoint_params }, | 2835 remove_breakpoint_params }, |
| 2781 { "resume", Resume, | 2836 { "resume", Resume, |
| 2782 resume_params }, | 2837 resume_params }, |
| 2783 { "_requestHeapSnapshot", RequestHeapSnapshot, | 2838 { "_requestHeapSnapshot", RequestHeapSnapshot, |
| 2784 request_heap_snapshot_params }, | 2839 request_heap_snapshot_params }, |
| 2840 { "_setExceptionPauseInfo", SetExceptionPauseInfo, | |
| 2841 set_exception_pause_info_params }, | |
| 2785 { "_setFlag", SetFlag, | 2842 { "_setFlag", SetFlag, |
| 2786 set_flags_params }, | 2843 set_flags_params }, |
| 2787 { "setLibraryDebuggable", SetLibraryDebuggable, | 2844 { "setLibraryDebuggable", SetLibraryDebuggable, |
| 2788 set_library_debuggable_params }, | 2845 set_library_debuggable_params }, |
| 2789 { "setName", SetName, | 2846 { "setName", SetName, |
| 2790 set_name_params }, | 2847 set_name_params }, |
| 2791 }; | 2848 }; |
| 2792 | 2849 |
| 2793 | 2850 |
| 2794 ServiceMethodDescriptor* FindMethod(const char* method_name) { | 2851 ServiceMethodDescriptor* FindMethod(const char* method_name) { |
| 2795 intptr_t num_methods = sizeof(service_methods_) / | 2852 intptr_t num_methods = sizeof(service_methods_) / |
| 2796 sizeof(service_methods_[0]); | 2853 sizeof(service_methods_[0]); |
| 2797 for (intptr_t i = 0; i < num_methods; i++) { | 2854 for (intptr_t i = 0; i < num_methods; i++) { |
| 2798 ServiceMethodDescriptor& method = service_methods_[i]; | 2855 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2799 if (strcmp(method_name, method.name) == 0) { | 2856 if (strcmp(method_name, method.name) == 0) { |
| 2800 return &method; | 2857 return &method; |
| 2801 } | 2858 } |
| 2802 } | 2859 } |
| 2803 return NULL; | 2860 return NULL; |
| 2804 } | 2861 } |
| 2805 | 2862 |
| 2806 | 2863 |
| 2807 } // namespace dart | 2864 } // namespace dart |
| OLD | NEW |