Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: runtime/vm/service.cc

Issue 1174313002: Allow setting break-on-exceptions option over the service protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_exception_pause_info_params[] = {
2624 ISOLATE_PARAMETER,
2625 NULL,
2626 };
2627
2628
2629 static bool GetExceptionPauseInfo(Isolate* isolate, JSONStream* js) {
2630 JSONObject jsobj(js);
2631 jsobj.AddProperty("type", "ExceptionPauseInfo");
2632 switch (isolate->debugger()->GetExceptionPauseInfo()) {
2633 case kNoPauseOnExceptions:
2634 jsobj.AddProperty("exceptions", "none");
2635 break;
2636 case kPauseOnAllExceptions:
2637 jsobj.AddProperty("exceptions", "all");
2638 break;
2639 case kPauseOnUnhandledExceptions:
2640 jsobj.AddProperty("exceptions", "unhandled");
2641 break;
2642 default:
2643 UNREACHABLE();
2644 }
2645 return true;
2646 }
2647
2648
2649 static const MethodParameter* set_exception_pause_info_params[] = {
2650 ISOLATE_PARAMETER,
2651 NULL,
2652 };
2653
2654
2655 static bool SetExceptionPauseInfo(Isolate* isolate, JSONStream* js) {
2656 const char* exceptions = js->LookupParam("exceptions");
2657 if (exceptions == NULL) {
2658 PrintMissingParamError(js, "exceptions");
2659 return true;
2660 }
2661
2662 Dart_ExceptionPauseInfo info = kNoPauseOnExceptions;
2663 if (strcmp(exceptions, "none") == 0) {
2664 info = kNoPauseOnExceptions;
2665 } else if (strcmp(exceptions, "all") == 0) {
2666 info = kPauseOnAllExceptions;
2667 } else if (strcmp(exceptions, "unhandled") == 0) {
2668 info = kPauseOnUnhandledExceptions;
2669 } else {
2670 JSONObject jsobj(js);
2671 jsobj.AddProperty("type", "Error");
2672 jsobj.AddProperty("message", "illegal value for parameter 'exceptions'");
2673 return true;
2674 }
2675
2676 isolate->debugger()->SetExceptionPauseInfo(info);
Cutch 2015/06/11 21:20:12 This state change affects all debuggers. This shou
rmacnak 2015/06/12 00:09:38 Rejiggered as a DebuggerChanged event.
2677 PrintSuccess(js);
2678 return true;
2679 }
2680
2681
2623 static const MethodParameter* get_flag_list_params[] = { 2682 static const MethodParameter* get_flag_list_params[] = {
2624 NO_ISOLATE_PARAMETER, 2683 NO_ISOLATE_PARAMETER,
2625 NULL, 2684 NULL,
2626 }; 2685 };
2627 2686
2628 2687
2629 static bool GetFlagList(Isolate* isolate, JSONStream* js) { 2688 static bool GetFlagList(Isolate* isolate, JSONStream* js) {
2630 Flags::PrintJSON(js); 2689 Flags::PrintJSON(js);
2631 return true; 2690 return true;
2632 } 2691 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2731 { "_getAllocationProfile", GetAllocationProfile, 2790 { "_getAllocationProfile", GetAllocationProfile,
2732 get_allocation_profile_params }, 2791 get_allocation_profile_params },
2733 { "_getCallSiteData", GetCallSiteData, 2792 { "_getCallSiteData", GetCallSiteData,
2734 get_call_site_data_params }, 2793 get_call_site_data_params },
2735 { "getClassList", GetClassList, 2794 { "getClassList", GetClassList,
2736 get_class_list_params }, 2795 get_class_list_params },
2737 { "_getCoverage", GetCoverage, 2796 { "_getCoverage", GetCoverage,
2738 get_coverage_params }, 2797 get_coverage_params },
2739 { "_getCpuProfile", GetCpuProfile, 2798 { "_getCpuProfile", GetCpuProfile,
2740 get_cpu_profile_params }, 2799 get_cpu_profile_params },
2800 { "_getExceptionPauseInfo", GetExceptionPauseInfo,
2801 get_exception_pause_info_params },
2741 { "getFlagList", GetFlagList , 2802 { "getFlagList", GetFlagList ,
2742 get_flag_list_params }, 2803 get_flag_list_params },
2743 { "_getHeapMap", GetHeapMap, 2804 { "_getHeapMap", GetHeapMap,
2744 get_heap_map_params }, 2805 get_heap_map_params },
2745 { "_getInboundReferences", GetInboundReferences, 2806 { "_getInboundReferences", GetInboundReferences,
2746 get_inbound_references_params }, 2807 get_inbound_references_params },
2747 { "_getInstances", GetInstances, 2808 { "_getInstances", GetInstances,
2748 get_instances_params }, 2809 get_instances_params },
2749 { "getIsolate", GetIsolate, 2810 { "getIsolate", GetIsolate,
2750 get_isolate_params }, 2811 get_isolate_params },
(...skipping 24 matching lines...) Expand all
2775 { "_getVMMetricList", GetVMMetricList, 2836 { "_getVMMetricList", GetVMMetricList,
2776 get_vm_metric_list_params }, 2837 get_vm_metric_list_params },
2777 { "pause", Pause, 2838 { "pause", Pause,
2778 pause_params }, 2839 pause_params },
2779 { "removeBreakpoint", RemoveBreakpoint, 2840 { "removeBreakpoint", RemoveBreakpoint,
2780 remove_breakpoint_params }, 2841 remove_breakpoint_params },
2781 { "resume", Resume, 2842 { "resume", Resume,
2782 resume_params }, 2843 resume_params },
2783 { "_requestHeapSnapshot", RequestHeapSnapshot, 2844 { "_requestHeapSnapshot", RequestHeapSnapshot,
2784 request_heap_snapshot_params }, 2845 request_heap_snapshot_params },
2846 { "_setExceptionPauseInfo", SetExceptionPauseInfo,
2847 set_exception_pause_info_params },
2785 { "_setFlag", SetFlag, 2848 { "_setFlag", SetFlag,
2786 set_flags_params }, 2849 set_flags_params },
2787 { "setLibraryDebuggable", SetLibraryDebuggable, 2850 { "setLibraryDebuggable", SetLibraryDebuggable,
2788 set_library_debuggable_params }, 2851 set_library_debuggable_params },
2789 { "setName", SetName, 2852 { "setName", SetName,
2790 set_name_params }, 2853 set_name_params },
2791 }; 2854 };
2792 2855
2793 2856
2794 ServiceMethodDescriptor* FindMethod(const char* method_name) { 2857 ServiceMethodDescriptor* FindMethod(const char* method_name) {
2795 intptr_t num_methods = sizeof(service_methods_) / 2858 intptr_t num_methods = sizeof(service_methods_) /
2796 sizeof(service_methods_[0]); 2859 sizeof(service_methods_[0]);
2797 for (intptr_t i = 0; i < num_methods; i++) { 2860 for (intptr_t i = 0; i < num_methods; i++) {
2798 ServiceMethodDescriptor& method = service_methods_[i]; 2861 ServiceMethodDescriptor& method = service_methods_[i];
2799 if (strcmp(method_name, method.name) == 0) { 2862 if (strcmp(method_name, method.name) == 0) {
2800 return &method; 2863 return &method;
2801 } 2864 }
2802 } 2865 }
2803 return NULL; 2866 return NULL;
2804 } 2867 }
2805 2868
2806 2869
2807 } // namespace dart 2870 } // namespace dart
OLDNEW
« runtime/observatory/lib/src/service/object.dart ('K') | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698