| 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 "platform/address_sanitizer.h" | 9 #include "platform/address_sanitizer.h" |
| 10 | 10 |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // TODO(hausner): What to do if there is no descriptor entry | 680 // TODO(hausner): What to do if there is no descriptor entry |
| 681 // for the code position of the frame? For now say we are at context | 681 // for the code position of the frame? For now say we are at context |
| 682 // level 0. | 682 // level 0. |
| 683 TokenPos(); | 683 TokenPos(); |
| 684 if (token_pos_ == TokenPosition::kNoSource) { | 684 if (token_pos_ == TokenPosition::kNoSource) { |
| 685 // No PcDescriptor. | 685 // No PcDescriptor. |
| 686 return context_level_; | 686 return context_level_; |
| 687 } | 687 } |
| 688 ASSERT(!pc_desc_.IsNull()); | 688 ASSERT(!pc_desc_.IsNull()); |
| 689 TokenPosition innermost_begin_pos = TokenPosition::kMinSource; | 689 TokenPosition innermost_begin_pos = TokenPosition::kMinSource; |
| 690 TokenPosition activation_token_pos = TokenPos(); | 690 TokenPosition activation_token_pos = TokenPos().FromSynthetic(); |
| 691 ASSERT(activation_token_pos.IsReal()); | 691 ASSERT(activation_token_pos.IsReal()); |
| 692 GetVarDescriptors(); | 692 GetVarDescriptors(); |
| 693 intptr_t var_desc_len = var_descriptors_.Length(); | 693 intptr_t var_desc_len = var_descriptors_.Length(); |
| 694 for (intptr_t cur_idx = 0; cur_idx < var_desc_len; cur_idx++) { | 694 for (intptr_t cur_idx = 0; cur_idx < var_desc_len; cur_idx++) { |
| 695 RawLocalVarDescriptors::VarInfo var_info; | 695 RawLocalVarDescriptors::VarInfo var_info; |
| 696 var_descriptors_.GetInfo(cur_idx, &var_info); | 696 var_descriptors_.GetInfo(cur_idx, &var_info); |
| 697 const int8_t kind = var_info.kind(); | 697 const int8_t kind = var_info.kind(); |
| 698 if ((kind == RawLocalVarDescriptors::kContextLevel) && | 698 if ((kind == RawLocalVarDescriptors::kContextLevel) && |
| 699 (var_info.begin_pos <= activation_token_pos) && | 699 (var_info.begin_pos <= activation_token_pos) && |
| 700 (activation_token_pos < var_info.end_pos)) { | 700 (activation_token_pos < var_info.end_pos)) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 RawObject* ActivationFrame::GetAsyncCompleterAwaiter(const Object& completer) { | 751 RawObject* ActivationFrame::GetAsyncCompleterAwaiter(const Object& completer) { |
| 752 const Class& sync_completer_cls = Class::Handle(completer.clazz()); | 752 const Class& sync_completer_cls = Class::Handle(completer.clazz()); |
| 753 ASSERT(!sync_completer_cls.IsNull()); | 753 ASSERT(!sync_completer_cls.IsNull()); |
| 754 const Class& completer_cls = Class::Handle(sync_completer_cls.SuperClass()); | 754 const Class& completer_cls = Class::Handle(sync_completer_cls.SuperClass()); |
| 755 const Field& future_field = | 755 const Field& future_field = |
| 756 Field::Handle(completer_cls.LookupInstanceFieldAllowPrivate( | 756 Field::Handle(completer_cls.LookupInstanceFieldAllowPrivate( |
| 757 Symbols::CompleterFuture())); | 757 Symbols::CompleterFuture())); |
| 758 ASSERT(!future_field.IsNull()); | 758 ASSERT(!future_field.IsNull()); |
| 759 Instance& future = Instance::Handle(); | 759 Instance& future = Instance::Handle(); |
| 760 future ^= Instance::Cast(completer).GetField(future_field); | 760 future ^= Instance::Cast(completer).GetField(future_field); |
| 761 ASSERT(!future.IsNull()); | 761 if (future.IsNull()) { |
| 762 // The completer object may not be fully initialized yet. |
| 763 return Object::null(); |
| 764 } |
| 762 const Class& future_cls = Class::Handle(future.clazz()); | 765 const Class& future_cls = Class::Handle(future.clazz()); |
| 763 ASSERT(!future_cls.IsNull()); | 766 ASSERT(!future_cls.IsNull()); |
| 764 const Field& awaiter_field = Field::Handle( | 767 const Field& awaiter_field = Field::Handle( |
| 765 future_cls.LookupInstanceFieldAllowPrivate(Symbols::_Awaiter())); | 768 future_cls.LookupInstanceFieldAllowPrivate(Symbols::_Awaiter())); |
| 766 ASSERT(!awaiter_field.IsNull()); | 769 ASSERT(!awaiter_field.IsNull()); |
| 767 return future.GetField(awaiter_field); | 770 return future.GetField(awaiter_field); |
| 768 } | 771 } |
| 769 | 772 |
| 770 | 773 |
| 771 RawObject* ActivationFrame::GetAsyncStreamControllerStream() { | 774 RawObject* ActivationFrame::GetAsyncStreamControllerStream() { |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 | 1427 |
| 1425 | 1428 |
| 1426 void DebuggerStackTrace::AddActivation(ActivationFrame* frame) { | 1429 void DebuggerStackTrace::AddActivation(ActivationFrame* frame) { |
| 1427 if (IsFunctionVisible(frame->function())) { | 1430 if (IsFunctionVisible(frame->function())) { |
| 1428 trace_.Add(frame); | 1431 trace_.Add(frame); |
| 1429 } | 1432 } |
| 1430 } | 1433 } |
| 1431 | 1434 |
| 1432 | 1435 |
| 1433 void DebuggerStackTrace::AddMarker(ActivationFrame::Kind marker) { | 1436 void DebuggerStackTrace::AddMarker(ActivationFrame::Kind marker) { |
| 1434 ASSERT((marker >= ActivationFrame::kAsyncSuspensionMarker) && | 1437 ASSERT(marker == ActivationFrame::kAsyncSuspensionMarker); |
| 1435 (marker <= ActivationFrame::kAsyncSuspensionMarker)); | |
| 1436 trace_.Add(new ActivationFrame(marker)); | 1438 trace_.Add(new ActivationFrame(marker)); |
| 1437 } | 1439 } |
| 1438 | 1440 |
| 1439 | 1441 |
| 1440 void DebuggerStackTrace::AddAsyncCausalFrame(uword pc, const Code& code) { | 1442 void DebuggerStackTrace::AddAsyncCausalFrame(uword pc, const Code& code) { |
| 1441 trace_.Add(new ActivationFrame(pc, 0, 0, code, Array::Handle(), 0, | 1443 trace_.Add(new ActivationFrame(pc, 0, 0, code, Array::Handle(), 0, |
| 1442 ActivationFrame::kAsyncCausal)); | 1444 ActivationFrame::kAsyncCausal)); |
| 1443 } | 1445 } |
| 1444 | 1446 |
| 1445 | 1447 |
| (...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4269 | 4271 |
| 4270 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 4272 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 4271 ASSERT(bpt->next() == NULL); | 4273 ASSERT(bpt->next() == NULL); |
| 4272 bpt->set_next(code_breakpoints_); | 4274 bpt->set_next(code_breakpoints_); |
| 4273 code_breakpoints_ = bpt; | 4275 code_breakpoints_ = bpt; |
| 4274 } | 4276 } |
| 4275 | 4277 |
| 4276 #endif // !PRODUCT | 4278 #endif // !PRODUCT |
| 4277 | 4279 |
| 4278 } // namespace dart | 4280 } // namespace dart |
| OLD | NEW |