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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 if (bpt_location_->IsResolved()) { | 213 if (bpt_location_->IsResolved()) { |
214 jsobj.AddLocation(bpt_location_); | 214 jsobj.AddLocation(bpt_location_); |
215 } else { | 215 } else { |
216 jsobj.AddUnresolvedLocation(bpt_location_); | 216 jsobj.AddUnresolvedLocation(bpt_location_); |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 | 220 |
221 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 221 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
222 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_)); | 222 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_)); |
223 visitor->VisitPointer(reinterpret_cast<RawObject**>(&saved_value_)); | |
224 } | 223 } |
225 | 224 |
226 | 225 |
227 ActivationFrame::ActivationFrame( | 226 ActivationFrame::ActivationFrame( |
228 uword pc, | 227 uword pc, |
229 uword fp, | 228 uword fp, |
230 uword sp, | 229 uword sp, |
231 const Code& code, | 230 const Code& code, |
232 const Array& deopt_frame, | 231 const Array& deopt_frame, |
233 intptr_t deopt_frame_offset) | 232 intptr_t deopt_frame_offset) |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 uword pc, | 1106 uword pc, |
1108 RawPcDescriptors::Kind kind) | 1107 RawPcDescriptors::Kind kind) |
1109 : code_(code.raw()), | 1108 : code_(code.raw()), |
1110 token_pos_(token_pos), | 1109 token_pos_(token_pos), |
1111 pc_(pc), | 1110 pc_(pc), |
1112 line_number_(-1), | 1111 line_number_(-1), |
1113 is_enabled_(false), | 1112 is_enabled_(false), |
1114 bpt_location_(NULL), | 1113 bpt_location_(NULL), |
1115 next_(NULL), | 1114 next_(NULL), |
1116 breakpoint_kind_(kind), | 1115 breakpoint_kind_(kind), |
1117 saved_value_(Code::null()) { | 1116 saved_value_(0) { |
1118 ASSERT(!code.IsNull()); | 1117 ASSERT(!code.IsNull()); |
1119 ASSERT(token_pos_ > 0); | 1118 ASSERT(token_pos_ > 0); |
1120 ASSERT(pc_ != 0); | 1119 ASSERT(pc_ != 0); |
1121 ASSERT((breakpoint_kind_ & kSafepointKind) != 0); | 1120 ASSERT((breakpoint_kind_ & kSafepointKind) != 0); |
1122 } | 1121 } |
1123 | 1122 |
1124 | 1123 |
1125 CodeBreakpoint::~CodeBreakpoint() { | 1124 CodeBreakpoint::~CodeBreakpoint() { |
1126 // Make sure we don't leave patched code behind. | 1125 // Make sure we don't leave patched code behind. |
1127 ASSERT(!IsEnabled()); | 1126 ASSERT(!IsEnabled()); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 | 1390 |
1392 RawArray* Debugger::DeoptimizeToArray(Isolate* isolate, | 1391 RawArray* Debugger::DeoptimizeToArray(Isolate* isolate, |
1393 StackFrame* frame, | 1392 StackFrame* frame, |
1394 const Code& code) { | 1393 const Code& code) { |
1395 ASSERT(code.is_optimized()); | 1394 ASSERT(code.is_optimized()); |
1396 | 1395 |
1397 // Create the DeoptContext for this deoptimization. | 1396 // Create the DeoptContext for this deoptimization. |
1398 DeoptContext* deopt_context = | 1397 DeoptContext* deopt_context = |
1399 new DeoptContext(frame, code, | 1398 new DeoptContext(frame, code, |
1400 DeoptContext::kDestIsAllocated, | 1399 DeoptContext::kDestIsAllocated, |
1401 NULL, | 1400 NULL, NULL); |
1402 NULL, | |
1403 true); | |
1404 isolate->set_deopt_context(deopt_context); | 1401 isolate->set_deopt_context(deopt_context); |
1405 | 1402 |
1406 deopt_context->FillDestFrame(); | 1403 deopt_context->FillDestFrame(); |
1407 deopt_context->MaterializeDeferredObjects(); | 1404 deopt_context->MaterializeDeferredObjects(); |
1408 const Array& dest_frame = Array::Handle(isolate, | 1405 const Array& dest_frame = Array::Handle(isolate, |
1409 deopt_context->DestFrameAsArray()); | 1406 deopt_context->DestFrameAsArray()); |
1410 | 1407 |
1411 isolate->set_deopt_context(NULL); | 1408 isolate->set_deopt_context(NULL); |
1412 delete deopt_context; | 1409 delete deopt_context; |
1413 | 1410 |
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3002 while (bpt != NULL) { | 2999 while (bpt != NULL) { |
3003 if (bpt->pc() == breakpoint_address) { | 3000 if (bpt->pc() == breakpoint_address) { |
3004 return bpt; | 3001 return bpt; |
3005 } | 3002 } |
3006 bpt = bpt->next(); | 3003 bpt = bpt->next(); |
3007 } | 3004 } |
3008 return NULL; | 3005 return NULL; |
3009 } | 3006 } |
3010 | 3007 |
3011 | 3008 |
3012 RawCode* Debugger::GetPatchedStubAddress(uword breakpoint_address) { | 3009 uword Debugger::GetPatchedStubAddress(uword breakpoint_address) { |
3013 CodeBreakpoint* bpt = GetCodeBreakpoint(breakpoint_address); | 3010 CodeBreakpoint* bpt = GetCodeBreakpoint(breakpoint_address); |
3014 if (bpt != NULL) { | 3011 if (bpt != NULL) { |
3015 return bpt->OrigStubAddress(); | 3012 return bpt->OrigStubAddress(); |
3016 } | 3013 } |
3017 UNREACHABLE(); | 3014 UNREACHABLE(); |
3018 return Code::null(); | 3015 return 0L; |
3019 } | 3016 } |
3020 | 3017 |
3021 | 3018 |
3022 // Remove and delete the source breakpoint bpt and its associated | 3019 // Remove and delete the source breakpoint bpt and its associated |
3023 // code breakpoints. | 3020 // code breakpoints. |
3024 void Debugger::RemoveBreakpoint(intptr_t bp_id) { | 3021 void Debugger::RemoveBreakpoint(intptr_t bp_id) { |
3025 BreakpointLocation* prev_loc = NULL; | 3022 BreakpointLocation* prev_loc = NULL; |
3026 BreakpointLocation* curr_loc = breakpoint_locations_; | 3023 BreakpointLocation* curr_loc = breakpoint_locations_; |
3027 while (curr_loc != NULL) { | 3024 while (curr_loc != NULL) { |
3028 Breakpoint* prev_bpt = NULL; | 3025 Breakpoint* prev_bpt = NULL; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3175 } | 3172 } |
3176 | 3173 |
3177 | 3174 |
3178 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3175 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3179 ASSERT(bpt->next() == NULL); | 3176 ASSERT(bpt->next() == NULL); |
3180 bpt->set_next(code_breakpoints_); | 3177 bpt->set_next(code_breakpoints_); |
3181 code_breakpoints_ = bpt; | 3178 code_breakpoints_ = bpt; |
3182 } | 3179 } |
3183 | 3180 |
3184 } // namespace dart | 3181 } // namespace dart |
OLD | NEW |