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

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

Issue 1143783003: Add the streamListen and streamCancel rpcs to the vm service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: before commit 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 | Annotate | Revision Log
« 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) || Service::NeedsEvents(); 230 return ((event_handler_ != NULL) ||
231 Service::NeedsIsolateEvents() ||
232 Service::NeedsDebugEvents());
231 } 233 }
232 234
233 235
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
234 void Debugger::InvokeEventHandler(DebuggerEvent* event) { 259 void Debugger::InvokeEventHandler(DebuggerEvent* event) {
235 ASSERT(HasEventHandler()); 260 ASSERT(HasEventHandler());
236 261
237 // Give the event to the Service first, as the debugger event handler 262 // Give the event to the Service first, as the debugger event handler
238 // may go into a message loop and the Service will not. 263 // may go into a message loop and the Service will not.
239 // 264 //
240 // kBreakpointResolved events are handled differently in the vm 265 // kBreakpointResolved events are handled differently in the vm
241 // service, so suppress them here. 266 // service, so suppress them here.
242 if (Service::NeedsEvents() && 267 if (ServiceNeedsDebuggerEvent(event->type())) {
243 (event->type() != DebuggerEvent::kBreakpointResolved)) {
244 ServiceEvent service_event(event); 268 ServiceEvent service_event(event);
245 Service::HandleEvent(&service_event); 269 Service::HandleEvent(&service_event);
246 } 270 }
247 271
248 if (FLAG_steal_breakpoints && event->IsPauseEvent()) { 272 if (FLAG_steal_breakpoints && event->IsPauseEvent()) {
249 // We allow the embedder's default breakpoint handler to be overridden. 273 // We allow the embedder's default breakpoint handler to be overridden.
250 isolate_->PauseEventHandler(); 274 isolate_->PauseEventHandler();
251 } else if (event_handler_ != NULL) { 275 } else if (event_handler_ != NULL) {
252 (*event_handler_)(event); 276 (*event_handler_)(event);
253 } 277 }
254 278
255 if (Service::NeedsEvents() && event->IsPauseEvent()) { 279 if (ServiceNeedsDebuggerEvent(event->type()) && event->IsPauseEvent()) {
256 // If we were paused, notify the service that we have resumed. 280 // If we were paused, notify the service that we have resumed.
257 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume); 281 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume);
258 service_event.set_top_frame(event->top_frame()); 282 service_event.set_top_frame(event->top_frame());
259 Service::HandleEvent(&service_event); 283 Service::HandleEvent(&service_event);
260 } 284 }
261 } 285 }
262 286
263 287
264 void Debugger::SignalIsolateEvent(DebuggerEvent::EventType type) { 288 void Debugger::SignalIsolateEvent(DebuggerEvent::EventType type) {
265 if (HasEventHandler()) { 289 if (HasEventHandler()) {
(...skipping 22 matching lines...) Expand all
288 ASSERT(debugger != NULL); 312 ASSERT(debugger != NULL);
289 debugger->SignalIsolateEvent(DebuggerEvent::kIsolateInterrupted); 313 debugger->SignalIsolateEvent(DebuggerEvent::kIsolateInterrupted);
290 } 314 }
291 } 315 }
292 316
293 317
294 // The vm service handles breakpoint notifications in a different way 318 // The vm service handles breakpoint notifications in a different way
295 // than the regular debugger breakpoint notifications. 319 // than the regular debugger breakpoint notifications.
296 static void SendServiceBreakpointEvent(ServiceEvent::EventType type, 320 static void SendServiceBreakpointEvent(ServiceEvent::EventType type,
297 SourceBreakpoint* bpt) { 321 SourceBreakpoint* bpt) {
298 if (Service::NeedsEvents()) { 322 if (Service::NeedsDebugEvents()) {
299 ServiceEvent service_event(Isolate::Current(), type); 323 ServiceEvent service_event(Isolate::Current(), type);
300 service_event.set_breakpoint(bpt); 324 service_event.set_breakpoint(bpt);
301 Service::HandleEvent(&service_event); 325 Service::HandleEvent(&service_event);
302 } 326 }
303 } 327 }
304 328
305 329
306 const char* Debugger::QualifiedFunctionName(const Function& func) { 330 const char* Debugger::QualifiedFunctionName(const Function& func) {
307 const String& func_name = String::Handle(func.name()); 331 const String& func_name = String::Handle(func.name());
308 Class& func_class = Class::Handle(func.Owner()); 332 Class& func_class = Class::Handle(func.Owner());
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 } 2724 }
2701 2725
2702 2726
2703 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2727 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2704 ASSERT(bpt->next() == NULL); 2728 ASSERT(bpt->next() == NULL);
2705 bpt->set_next(code_breakpoints_); 2729 bpt->set_next(code_breakpoints_);
2706 code_breakpoints_ = bpt; 2730 code_breakpoints_ = bpt;
2707 } 2731 }
2708 2732
2709 } // namespace dart 2733 } // 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