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

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

Issue 1152283005: Revert "Add the streamListen and streamCancel rpcs to the vm service." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/observatory/tests/service/test_helper.dart ('k') | runtime/vm/heap.cc » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/debugger.h" 5 #include "vm/debugger.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 deopt_frame_(Array::ZoneHandle(deopt_frame.raw())), 220 deopt_frame_(Array::ZoneHandle(deopt_frame.raw())),
221 deopt_frame_offset_(deopt_frame_offset), 221 deopt_frame_offset_(deopt_frame_offset),
222 vars_initialized_(false), 222 vars_initialized_(false),
223 var_descriptors_(LocalVarDescriptors::ZoneHandle()), 223 var_descriptors_(LocalVarDescriptors::ZoneHandle()),
224 desc_indices_(8), 224 desc_indices_(8),
225 pc_desc_(PcDescriptors::ZoneHandle()) { 225 pc_desc_(PcDescriptors::ZoneHandle()) {
226 } 226 }
227 227
228 228
229 bool Debugger::HasEventHandler() { 229 bool Debugger::HasEventHandler() {
230 return ((event_handler_ != NULL) || 230 return (event_handler_ != NULL) || Service::NeedsEvents();
231 Service::NeedsIsolateEvents() ||
232 Service::NeedsDebugEvents());
233 } 231 }
234 232
235 233
236 static bool ServiceNeedsDebuggerEvent(DebuggerEvent::EventType type) {
237 switch (type) {
238 case DebuggerEvent::kBreakpointResolved:
239 // kBreakpointResolved events are handled differently in the vm
240 // service, so suppress them here.
241 return false;
242
243 case DebuggerEvent::kBreakpointReached:
244 case DebuggerEvent::kExceptionThrown:
245 case DebuggerEvent::kIsolateInterrupted:
246 return Service::NeedsDebugEvents();
247
248 case DebuggerEvent::kIsolateCreated:
249 case DebuggerEvent::kIsolateShutdown:
250 return Service::NeedsIsolateEvents();
251
252 default:
253 UNREACHABLE();
254 return false;
255 }
256 }
257
258
259 void Debugger::InvokeEventHandler(DebuggerEvent* event) { 234 void Debugger::InvokeEventHandler(DebuggerEvent* event) {
260 ASSERT(HasEventHandler()); 235 ASSERT(HasEventHandler());
261 236
262 // Give the event to the Service first, as the debugger event handler 237 // Give the event to the Service first, as the debugger event handler
263 // may go into a message loop and the Service will not. 238 // may go into a message loop and the Service will not.
264 // 239 //
265 // kBreakpointResolved events are handled differently in the vm 240 // kBreakpointResolved events are handled differently in the vm
266 // service, so suppress them here. 241 // service, so suppress them here.
267 if (ServiceNeedsDebuggerEvent(event->type())) { 242 if (Service::NeedsEvents() &&
243 (event->type() != DebuggerEvent::kBreakpointResolved)) {
268 ServiceEvent service_event(event); 244 ServiceEvent service_event(event);
269 Service::HandleEvent(&service_event); 245 Service::HandleEvent(&service_event);
270 } 246 }
271 247
272 if (FLAG_steal_breakpoints && event->IsPauseEvent()) { 248 if (FLAG_steal_breakpoints && event->IsPauseEvent()) {
273 // We allow the embedder's default breakpoint handler to be overridden. 249 // We allow the embedder's default breakpoint handler to be overridden.
274 isolate_->PauseEventHandler(); 250 isolate_->PauseEventHandler();
275 } else if (event_handler_ != NULL) { 251 } else if (event_handler_ != NULL) {
276 (*event_handler_)(event); 252 (*event_handler_)(event);
277 } 253 }
278 254
279 if (ServiceNeedsDebuggerEvent(event->type()) && event->IsPauseEvent()) { 255 if (Service::NeedsEvents() && event->IsPauseEvent()) {
280 // If we were paused, notify the service that we have resumed. 256 // If we were paused, notify the service that we have resumed.
281 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume); 257 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume);
282 service_event.set_top_frame(event->top_frame()); 258 service_event.set_top_frame(event->top_frame());
283 Service::HandleEvent(&service_event); 259 Service::HandleEvent(&service_event);
284 } 260 }
285 } 261 }
286 262
287 263
288 void Debugger::SignalIsolateEvent(DebuggerEvent::EventType type) { 264 void Debugger::SignalIsolateEvent(DebuggerEvent::EventType type) {
289 if (HasEventHandler()) { 265 if (HasEventHandler()) {
(...skipping 22 matching lines...) Expand all
312 ASSERT(debugger != NULL); 288 ASSERT(debugger != NULL);
313 debugger->SignalIsolateEvent(DebuggerEvent::kIsolateInterrupted); 289 debugger->SignalIsolateEvent(DebuggerEvent::kIsolateInterrupted);
314 } 290 }
315 } 291 }
316 292
317 293
318 // The vm service handles breakpoint notifications in a different way 294 // The vm service handles breakpoint notifications in a different way
319 // than the regular debugger breakpoint notifications. 295 // than the regular debugger breakpoint notifications.
320 static void SendServiceBreakpointEvent(ServiceEvent::EventType type, 296 static void SendServiceBreakpointEvent(ServiceEvent::EventType type,
321 SourceBreakpoint* bpt) { 297 SourceBreakpoint* bpt) {
322 if (Service::NeedsDebugEvents()) { 298 if (Service::NeedsEvents()) {
323 ServiceEvent service_event(Isolate::Current(), type); 299 ServiceEvent service_event(Isolate::Current(), type);
324 service_event.set_breakpoint(bpt); 300 service_event.set_breakpoint(bpt);
325 Service::HandleEvent(&service_event); 301 Service::HandleEvent(&service_event);
326 } 302 }
327 } 303 }
328 304
329 305
330 const char* Debugger::QualifiedFunctionName(const Function& func) { 306 const char* Debugger::QualifiedFunctionName(const Function& func) {
331 const String& func_name = String::Handle(func.name()); 307 const String& func_name = String::Handle(func.name());
332 Class& func_class = Class::Handle(func.Owner()); 308 Class& func_class = Class::Handle(func.Owner());
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 } 2700 }
2725 2701
2726 2702
2727 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2703 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2728 ASSERT(bpt->next() == NULL); 2704 ASSERT(bpt->next() == NULL);
2729 bpt->set_next(code_breakpoints_); 2705 bpt->set_next(code_breakpoints_);
2730 code_breakpoints_ = bpt; 2706 code_breakpoints_ = bpt;
2731 } 2707 }
2732 2708
2733 } // namespace dart 2709 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/test_helper.dart ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698