OLD | NEW |
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 deopt_frame_(Array::ZoneHandle(deopt_frame.raw())), | 214 deopt_frame_(Array::ZoneHandle(deopt_frame.raw())), |
215 deopt_frame_offset_(deopt_frame_offset), | 215 deopt_frame_offset_(deopt_frame_offset), |
216 vars_initialized_(false), | 216 vars_initialized_(false), |
217 var_descriptors_(LocalVarDescriptors::ZoneHandle()), | 217 var_descriptors_(LocalVarDescriptors::ZoneHandle()), |
218 desc_indices_(8), | 218 desc_indices_(8), |
219 pc_desc_(PcDescriptors::ZoneHandle()) { | 219 pc_desc_(PcDescriptors::ZoneHandle()) { |
220 } | 220 } |
221 | 221 |
222 | 222 |
223 bool Debugger::HasEventHandler() { | 223 bool Debugger::HasEventHandler() { |
224 return (event_handler_ != NULL) || Service::NeedsDebuggerEvents(); | 224 return (event_handler_ != NULL) || Service::NeedsEvents(); |
225 } | 225 } |
226 | 226 |
227 | 227 |
228 void Debugger::InvokeEventHandler(DebuggerEvent* event) { | 228 void Debugger::InvokeEventHandler(DebuggerEvent* event) { |
229 ASSERT(HasEventHandler()); | 229 ASSERT(HasEventHandler()); |
230 | 230 |
231 // Give the event to the Service first, as the debugger event handler | 231 // Give the event to the Service first, as the debugger event handler |
232 // may go into a message loop and the Service will not. | 232 // may go into a message loop and the Service will not. |
233 // | 233 // |
234 // kBreakpointResolved events are handled differently in the vm | 234 // kBreakpointResolved events are handled differently in the vm |
235 // service, so suppress them here. | 235 // service, so suppress them here. |
236 if (Service::NeedsDebuggerEvents() && | 236 if (Service::NeedsEvents() && |
237 (event->type() != DebuggerEvent::kBreakpointResolved)) { | 237 (event->type() != DebuggerEvent::kBreakpointResolved)) { |
238 ServiceEvent service_event(event); | 238 ServiceEvent service_event(event); |
239 Service::HandleEvent(&service_event); | 239 Service::HandleEvent(&service_event); |
240 } | 240 } |
241 | 241 |
242 if (event_handler_ != NULL) { | 242 if (event_handler_ != NULL) { |
243 (*event_handler_)(event); | 243 (*event_handler_)(event); |
244 } | 244 } |
245 | 245 |
246 if (Service::NeedsDebuggerEvents() && event->IsPauseEvent()) { | 246 if (Service::NeedsEvents() && event->IsPauseEvent()) { |
247 // If we were paused, notify the service that we have resumed. | 247 // If we were paused, notify the service that we have resumed. |
248 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume); | 248 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume); |
249 service_event.set_top_frame(event->top_frame()); | 249 service_event.set_top_frame(event->top_frame()); |
250 Service::HandleEvent(&service_event); | 250 Service::HandleEvent(&service_event); |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 | 254 |
255 void Debugger::SignalIsolateEvent(DebuggerEvent::EventType type) { | 255 void Debugger::SignalIsolateEvent(DebuggerEvent::EventType type) { |
256 if (HasEventHandler()) { | 256 if (HasEventHandler()) { |
(...skipping 22 matching lines...) Expand all Loading... |
279 ASSERT(debugger != NULL); | 279 ASSERT(debugger != NULL); |
280 debugger->SignalIsolateEvent(DebuggerEvent::kIsolateInterrupted); | 280 debugger->SignalIsolateEvent(DebuggerEvent::kIsolateInterrupted); |
281 } | 281 } |
282 } | 282 } |
283 | 283 |
284 | 284 |
285 // The vm service handles breakpoint notifications in a different way | 285 // The vm service handles breakpoint notifications in a different way |
286 // than the regular debugger breakpoint notifications. | 286 // than the regular debugger breakpoint notifications. |
287 static void SendServiceBreakpointEvent(ServiceEvent::EventType type, | 287 static void SendServiceBreakpointEvent(ServiceEvent::EventType type, |
288 SourceBreakpoint* bpt) { | 288 SourceBreakpoint* bpt) { |
289 if (Service::NeedsDebuggerEvents() /*&& !bpt->IsOneShot()*/) { | 289 if (Service::NeedsEvents()) { |
290 ServiceEvent service_event(Isolate::Current(), type); | 290 ServiceEvent service_event(Isolate::Current(), type); |
291 service_event.set_breakpoint(bpt); | 291 service_event.set_breakpoint(bpt); |
292 Service::HandleEvent(&service_event); | 292 Service::HandleEvent(&service_event); |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 | 296 |
297 const char* Debugger::QualifiedFunctionName(const Function& func) { | 297 const char* Debugger::QualifiedFunctionName(const Function& func) { |
298 const String& func_name = String::Handle(func.name()); | 298 const String& func_name = String::Handle(func.name()); |
299 Class& func_class = Class::Handle(func.Owner()); | 299 Class& func_class = Class::Handle(func.Owner()); |
(...skipping 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2636 } | 2636 } |
2637 | 2637 |
2638 | 2638 |
2639 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2639 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
2640 ASSERT(bpt->next() == NULL); | 2640 ASSERT(bpt->next() == NULL); |
2641 bpt->set_next(code_breakpoints_); | 2641 bpt->set_next(code_breakpoints_); |
2642 code_breakpoints_ = bpt; | 2642 code_breakpoints_ = bpt; |
2643 } | 2643 } |
2644 | 2644 |
2645 } // namespace dart | 2645 } // namespace dart |
OLD | NEW |