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

Side by Side Diff: runtime/vm/service_event.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
« no previous file with comments | « runtime/vm/service_event.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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_event.h" 5 #include "vm/service_event.h"
6 6
7 namespace dart { 7 namespace dart {
8 8
9 // Translate from the legacy DebugEvent to a ServiceEvent. 9 // Translate from the legacy DebugEvent to a ServiceEvent.
10 static ServiceEvent::EventType TranslateEventType( 10 static ServiceEvent::EventType TranslateEventType(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 case kBreakpointAdded: 77 case kBreakpointAdded:
78 return "BreakpointAdded"; 78 return "BreakpointAdded";
79 case kBreakpointResolved: 79 case kBreakpointResolved:
80 return "BreakpointResolved"; 80 return "BreakpointResolved";
81 case kBreakpointRemoved: 81 case kBreakpointRemoved:
82 return "BreakpointRemoved"; 82 return "BreakpointRemoved";
83 case kGC: 83 case kGC:
84 return "GC"; // TODO(koda): Change to GarbageCollected. 84 return "GC"; // TODO(koda): Change to GarbageCollected.
85 case kInspect: 85 case kInspect:
86 return "Inspect"; 86 return "Inspect";
87 case kDebuggerSettingsUpdate:
88 return "_DebuggerSettingsUpdate";
87 case kIllegal: 89 case kIllegal:
88 return "Illegal"; 90 return "Illegal";
89 default: 91 default:
90 UNREACHABLE(); 92 UNREACHABLE();
91 return "Unknown"; 93 return "Unknown";
92 } 94 }
93 } 95 }
94 96
95 97
96 const char* ServiceEvent::stream_id() const { 98 const char* ServiceEvent::stream_id() const {
97 switch (type()) { 99 switch (type()) {
98 case kIsolateStart: 100 case kIsolateStart:
99 case kIsolateExit: 101 case kIsolateExit:
100 case kIsolateUpdate: 102 case kIsolateUpdate:
101 return "Isolate"; 103 return "Isolate";
102 104
103 case kPauseStart: 105 case kPauseStart:
104 case kPauseExit: 106 case kPauseExit:
105 case kPauseBreakpoint: 107 case kPauseBreakpoint:
106 case kPauseInterrupted: 108 case kPauseInterrupted:
107 case kPauseException: 109 case kPauseException:
108 case kResume: 110 case kResume:
109 case kBreakpointAdded: 111 case kBreakpointAdded:
110 case kBreakpointResolved: 112 case kBreakpointResolved:
111 case kBreakpointRemoved: 113 case kBreakpointRemoved:
112 case kInspect: 114 case kInspect:
115 case kDebuggerSettingsUpdate:
113 return "Debug"; 116 return "Debug";
114 117
115 case kGC: 118 case kGC:
116 return "GC"; 119 return "GC";
117 120
118 default: 121 default:
119 UNREACHABLE(); 122 UNREACHABLE();
120 return NULL; 123 return NULL;
121 } 124 }
122 } 125 }
123 126
124 127
125 void ServiceEvent::PrintJSON(JSONStream* js) const { 128 void ServiceEvent::PrintJSON(JSONStream* js) const {
126 JSONObject jsobj(js); 129 JSONObject jsobj(js);
127 jsobj.AddProperty("type", "Event"); 130 jsobj.AddProperty("type", "Event");
128 jsobj.AddProperty("kind", EventTypeToCString(type())); 131 jsobj.AddProperty("kind", EventTypeToCString(type()));
129 jsobj.AddProperty("isolate", isolate()); 132 jsobj.AddProperty("isolate", isolate());
130 if (type() == kPauseBreakpoint) { 133 if (type() == kPauseBreakpoint) {
131 JSONArray jsarr(&jsobj, "pauseBreakpoints"); 134 JSONArray jsarr(&jsobj, "pauseBreakpoints");
132 // TODO(rmacnak): If we are paused at more than one breakpoint, 135 // TODO(rmacnak): If we are paused at more than one breakpoint,
133 // provide it here. 136 // provide it here.
134 if (breakpoint() != NULL) { 137 if (breakpoint() != NULL) {
135 jsarr.AddValue(breakpoint()); 138 jsarr.AddValue(breakpoint());
136 } 139 }
137 } else { 140 } else {
138 if (breakpoint() != NULL) { 141 if (breakpoint() != NULL) {
139 jsobj.AddProperty("breakpoint", breakpoint()); 142 jsobj.AddProperty("breakpoint", breakpoint());
140 } 143 }
141 } 144 }
145 if (type() == kDebuggerSettingsUpdate) {
146 JSONObject jssettings(&jsobj, "_debuggerSettings");
147 isolate()->debugger()->PrintSettingsToJSONObject(&jssettings);
148 }
142 if (top_frame() != NULL) { 149 if (top_frame() != NULL) {
143 JSONObject jsFrame(&jsobj, "topFrame"); 150 JSONObject jsFrame(&jsobj, "topFrame");
144 top_frame()->PrintToJSONObject(&jsFrame); 151 top_frame()->PrintToJSONObject(&jsFrame);
145 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. 152 intptr_t index = 0; // Avoid ambiguity in call to AddProperty.
146 jsFrame.AddProperty("index", index); 153 jsFrame.AddProperty("index", index);
147 } 154 }
148 if (exception() != NULL) { 155 if (exception() != NULL) {
149 jsobj.AddProperty("exception", *(exception())); 156 jsobj.AddProperty("exception", *(exception()));
150 } 157 }
151 if (inspectee() != NULL) { 158 if (inspectee() != NULL) {
152 jsobj.AddProperty("inspectee", *(inspectee())); 159 jsobj.AddProperty("inspectee", *(inspectee()));
153 } 160 }
154 if (gc_stats() != NULL) { 161 if (gc_stats() != NULL) {
155 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); 162 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_));
156 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); 163 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj);
157 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); 164 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj);
158 } 165 }
159 } 166 }
160 167
161 } // namespace dart 168 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service_event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698