| 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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 return result.raw(); | 1138 return result.raw(); |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 | 1141 |
| 1142 RawObject* Debugger::GetStaticField(const Class& cls, | 1142 RawObject* Debugger::GetStaticField(const Class& cls, |
| 1143 const String& field_name) { | 1143 const String& field_name) { |
| 1144 const Field& fld = Field::Handle(cls.LookupStaticField(field_name)); | 1144 const Field& fld = Field::Handle(cls.LookupStaticField(field_name)); |
| 1145 if (!fld.IsNull()) { | 1145 if (!fld.IsNull()) { |
| 1146 // Return the value in the field if it has been initialized already. | 1146 // Return the value in the field if it has been initialized already. |
| 1147 const Instance& value = Instance::Handle(fld.value()); | 1147 const Instance& value = Instance::Handle(fld.value()); |
| 1148 ASSERT(value.raw() != Object::transition_sentinel()); | 1148 ASSERT(value.raw() != Object::transition_sentinel().raw()); |
| 1149 if (value.raw() != Object::sentinel()) { | 1149 if (value.raw() != Object::sentinel().raw()) { |
| 1150 return value.raw(); | 1150 return value.raw(); |
| 1151 } | 1151 } |
| 1152 } | 1152 } |
| 1153 // There is no field or the field has not been initialized yet. | 1153 // There is no field or the field has not been initialized yet. |
| 1154 // We must have a getter. Run the getter. | 1154 // We must have a getter. Run the getter. |
| 1155 const Function& getter_func = | 1155 const Function& getter_func = |
| 1156 Function::Handle(cls.LookupGetterFunction(field_name)); | 1156 Function::Handle(cls.LookupGetterFunction(field_name)); |
| 1157 ASSERT(!getter_func.IsNull()); | 1157 ASSERT(!getter_func.IsNull()); |
| 1158 if (getter_func.IsNull()) { | 1158 if (getter_func.IsNull()) { |
| 1159 return Object::null(); | 1159 return Object::null(); |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 Object& result = Object::Handle(); | 1162 Object& result = Object::Handle(); |
| 1163 LongJump* base = isolate_->long_jump_base(); | 1163 LongJump* base = isolate_->long_jump_base(); |
| 1164 LongJump jump; | 1164 LongJump jump; |
| 1165 isolate_->set_long_jump_base(&jump); | 1165 isolate_->set_long_jump_base(&jump); |
| 1166 bool saved_ignore_flag = ignore_breakpoints_; | 1166 bool saved_ignore_flag = ignore_breakpoints_; |
| 1167 ignore_breakpoints_ = true; | 1167 ignore_breakpoints_ = true; |
| 1168 if (setjmp(*jump.Set()) == 0) { | 1168 if (setjmp(*jump.Set()) == 0) { |
| 1169 const Array& args = Array::Handle(Object::empty_array()); | 1169 result = DartEntry::InvokeStatic(getter_func, Object::empty_array()); |
| 1170 result = DartEntry::InvokeStatic(getter_func, args); | |
| 1171 } else { | 1170 } else { |
| 1172 result = isolate_->object_store()->sticky_error(); | 1171 result = isolate_->object_store()->sticky_error(); |
| 1173 } | 1172 } |
| 1174 ignore_breakpoints_ = saved_ignore_flag; | 1173 ignore_breakpoints_ = saved_ignore_flag; |
| 1175 isolate_->set_long_jump_base(base); | 1174 isolate_->set_long_jump_base(base); |
| 1176 return result.raw(); | 1175 return result.raw(); |
| 1177 } | 1176 } |
| 1178 | 1177 |
| 1179 | 1178 |
| 1180 RawArray* Debugger::GetInstanceFields(const Instance& obj) { | 1179 RawArray* Debugger::GetInstanceFields(const Instance& obj) { |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 } | 1629 } |
| 1631 | 1630 |
| 1632 | 1631 |
| 1633 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 1632 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 1634 ASSERT(bpt->next() == NULL); | 1633 ASSERT(bpt->next() == NULL); |
| 1635 bpt->set_next(code_breakpoints_); | 1634 bpt->set_next(code_breakpoints_); |
| 1636 code_breakpoints_ = bpt; | 1635 code_breakpoints_ = bpt; |
| 1637 } | 1636 } |
| 1638 | 1637 |
| 1639 } // namespace dart | 1638 } // namespace dart |
| OLD | NEW |