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