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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 // Call the embedder's event handler, if it exists. | 286 // Call the embedder's event handler, if it exists. |
287 if (event_handler_ != NULL) { | 287 if (event_handler_ != NULL) { |
288 TransitionVMToNative transition(Thread::Current()); | 288 TransitionVMToNative transition(Thread::Current()); |
289 (*event_handler_)(event); | 289 (*event_handler_)(event); |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 | 293 |
294 RawError* Debugger::PauseInterrupted() { | 294 RawError* Debugger::PauseInterrupted() { |
| 295 return PauseRequest(ServiceEvent::kPauseInterrupted); |
| 296 } |
| 297 |
| 298 |
| 299 RawError* Debugger::PausePostRequest() { |
| 300 return PauseRequest(ServiceEvent::kPausePostRequest); |
| 301 } |
| 302 |
| 303 |
| 304 RawError* Debugger::PauseRequest(ServiceEvent::EventKind kind) { |
295 if (ignore_breakpoints_ || IsPaused()) { | 305 if (ignore_breakpoints_ || IsPaused()) { |
296 // We don't let the isolate get interrupted if we are already | 306 // We don't let the isolate get interrupted if we are already |
297 // paused or ignoring breakpoints. | 307 // paused or ignoring breakpoints. |
298 return Error::null(); | 308 return Error::null(); |
299 } | 309 } |
300 ServiceEvent event(isolate_, ServiceEvent::kPauseInterrupted); | 310 ServiceEvent event(isolate_, kind); |
301 DebuggerStackTrace* trace = CollectStackTrace(); | 311 DebuggerStackTrace* trace = CollectStackTrace(); |
302 if (trace->Length() > 0) { | 312 if (trace->Length() > 0) { |
303 event.set_top_frame(trace->FrameAt(0)); | 313 event.set_top_frame(trace->FrameAt(0)); |
304 } | 314 } |
305 ASSERT(stack_trace_ == NULL); | 315 ASSERT(stack_trace_ == NULL); |
306 stack_trace_ = trace; | 316 stack_trace_ = trace; |
307 resume_action_ = kContinue; | 317 resume_action_ = kContinue; |
308 Pause(&event); | 318 Pause(&event); |
309 HandleSteppingRequest(trace); | 319 HandleSteppingRequest(trace); |
310 stack_trace_ = NULL; | 320 stack_trace_ = NULL; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 } else { | 577 } else { |
568 column_number_ = -1; | 578 column_number_ = -1; |
569 } | 579 } |
570 } | 580 } |
571 return column_number_; | 581 return column_number_; |
572 } | 582 } |
573 | 583 |
574 | 584 |
575 void ActivationFrame::GetVarDescriptors() { | 585 void ActivationFrame::GetVarDescriptors() { |
576 if (var_descriptors_.IsNull()) { | 586 if (var_descriptors_.IsNull()) { |
577 if (code().is_optimized()) { | 587 Code& unoptimized_code = Code::Handle(function().unoptimized_code()); |
| 588 if (unoptimized_code.IsNull()) { |
578 Thread* thread = Thread::Current(); | 589 Thread* thread = Thread::Current(); |
579 Zone* zone = thread->zone(); | 590 Zone* zone = thread->zone(); |
580 const Error& error = Error::Handle(zone, | 591 const Error& error = Error::Handle(zone, |
581 Compiler::EnsureUnoptimizedCode(thread, function())); | 592 Compiler::EnsureUnoptimizedCode(thread, function())); |
582 if (!error.IsNull()) { | 593 if (!error.IsNull()) { |
583 Exceptions::PropagateError(error); | 594 Exceptions::PropagateError(error); |
584 } | 595 } |
| 596 unoptimized_code ^= function().unoptimized_code(); |
585 } | 597 } |
586 var_descriptors_ = | 598 ASSERT(!unoptimized_code.IsNull()); |
587 Code::Handle(function().unoptimized_code()).GetLocalVarDescriptors(); | 599 var_descriptors_ = unoptimized_code.GetLocalVarDescriptors(); |
588 ASSERT(!var_descriptors_.IsNull()); | 600 ASSERT(!var_descriptors_.IsNull()); |
589 } | 601 } |
590 } | 602 } |
591 | 603 |
592 | 604 |
593 bool ActivationFrame::IsDebuggable() const { | 605 bool ActivationFrame::IsDebuggable() const { |
594 return Debugger::IsDebuggable(function()); | 606 return Debugger::IsDebuggable(function()); |
595 } | 607 } |
596 | 608 |
597 | 609 |
(...skipping 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3325 | 3337 |
3326 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3338 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3327 ASSERT(bpt->next() == NULL); | 3339 ASSERT(bpt->next() == NULL); |
3328 bpt->set_next(code_breakpoints_); | 3340 bpt->set_next(code_breakpoints_); |
3329 code_breakpoints_ = bpt; | 3341 code_breakpoints_ = bpt; |
3330 } | 3342 } |
3331 | 3343 |
3332 #endif // !PRODUCT | 3344 #endif // !PRODUCT |
3333 | 3345 |
3334 } // namespace dart | 3346 } // namespace dart |
OLD | NEW |