| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 Library& library = Library::Handle(isolate); | 198 Library& library = Library::Handle(isolate); |
| 199 Script& script = Script::Handle(isolate); | 199 Script& script = Script::Handle(isolate); |
| 200 intptr_t token_pos; | 200 intptr_t token_pos; |
| 201 bpt_location_->GetCodeLocation(&library, &script, &token_pos); | 201 bpt_location_->GetCodeLocation(&library, &script, &token_pos); |
| 202 jsobj.AddLocation(script, token_pos); | 202 jsobj.AddLocation(script, token_pos); |
| 203 } | 203 } |
| 204 | 204 |
| 205 | 205 |
| 206 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 206 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 207 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_)); | 207 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_)); |
| 208 visitor->VisitPointer(reinterpret_cast<RawObject**>(&saved_value_)); |
| 208 } | 209 } |
| 209 | 210 |
| 210 | 211 |
| 211 ActivationFrame::ActivationFrame( | 212 ActivationFrame::ActivationFrame( |
| 212 uword pc, | 213 uword pc, |
| 213 uword fp, | 214 uword fp, |
| 214 uword sp, | 215 uword sp, |
| 215 const Code& code, | 216 const Code& code, |
| 216 const Array& deopt_frame, | 217 const Array& deopt_frame, |
| 217 intptr_t deopt_frame_offset) | 218 intptr_t deopt_frame_offset) |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 uword pc, | 1091 uword pc, |
| 1091 RawPcDescriptors::Kind kind) | 1092 RawPcDescriptors::Kind kind) |
| 1092 : code_(code.raw()), | 1093 : code_(code.raw()), |
| 1093 token_pos_(token_pos), | 1094 token_pos_(token_pos), |
| 1094 pc_(pc), | 1095 pc_(pc), |
| 1095 line_number_(-1), | 1096 line_number_(-1), |
| 1096 is_enabled_(false), | 1097 is_enabled_(false), |
| 1097 bpt_location_(NULL), | 1098 bpt_location_(NULL), |
| 1098 next_(NULL), | 1099 next_(NULL), |
| 1099 breakpoint_kind_(kind), | 1100 breakpoint_kind_(kind), |
| 1100 saved_value_(0) { | 1101 saved_value_(Code::null()) { |
| 1101 ASSERT(!code.IsNull()); | 1102 ASSERT(!code.IsNull()); |
| 1102 ASSERT(token_pos_ > 0); | 1103 ASSERT(token_pos_ > 0); |
| 1103 ASSERT(pc_ != 0); | 1104 ASSERT(pc_ != 0); |
| 1104 ASSERT((breakpoint_kind_ & kSafepointKind) != 0); | 1105 ASSERT((breakpoint_kind_ & kSafepointKind) != 0); |
| 1105 } | 1106 } |
| 1106 | 1107 |
| 1107 | 1108 |
| 1108 CodeBreakpoint::~CodeBreakpoint() { | 1109 CodeBreakpoint::~CodeBreakpoint() { |
| 1109 // Make sure we don't leave patched code behind. | 1110 // Make sure we don't leave patched code behind. |
| 1110 ASSERT(!IsEnabled()); | 1111 ASSERT(!IsEnabled()); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 | 1374 |
| 1374 RawArray* Debugger::DeoptimizeToArray(Isolate* isolate, | 1375 RawArray* Debugger::DeoptimizeToArray(Isolate* isolate, |
| 1375 StackFrame* frame, | 1376 StackFrame* frame, |
| 1376 const Code& code) { | 1377 const Code& code) { |
| 1377 ASSERT(code.is_optimized()); | 1378 ASSERT(code.is_optimized()); |
| 1378 | 1379 |
| 1379 // Create the DeoptContext for this deoptimization. | 1380 // Create the DeoptContext for this deoptimization. |
| 1380 DeoptContext* deopt_context = | 1381 DeoptContext* deopt_context = |
| 1381 new DeoptContext(frame, code, | 1382 new DeoptContext(frame, code, |
| 1382 DeoptContext::kDestIsAllocated, | 1383 DeoptContext::kDestIsAllocated, |
| 1383 NULL, NULL); | 1384 NULL, |
| 1385 NULL, |
| 1386 true); |
| 1384 isolate->set_deopt_context(deopt_context); | 1387 isolate->set_deopt_context(deopt_context); |
| 1385 | 1388 |
| 1386 deopt_context->FillDestFrame(); | 1389 deopt_context->FillDestFrame(); |
| 1387 deopt_context->MaterializeDeferredObjects(); | 1390 deopt_context->MaterializeDeferredObjects(); |
| 1388 const Array& dest_frame = Array::Handle(isolate, | 1391 const Array& dest_frame = Array::Handle(isolate, |
| 1389 deopt_context->DestFrameAsArray()); | 1392 deopt_context->DestFrameAsArray()); |
| 1390 | 1393 |
| 1391 isolate->set_deopt_context(NULL); | 1394 isolate->set_deopt_context(NULL); |
| 1392 delete deopt_context; | 1395 delete deopt_context; |
| 1393 | 1396 |
| (...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2803 while (bpt != NULL) { | 2806 while (bpt != NULL) { |
| 2804 if (bpt->pc() == breakpoint_address) { | 2807 if (bpt->pc() == breakpoint_address) { |
| 2805 return bpt; | 2808 return bpt; |
| 2806 } | 2809 } |
| 2807 bpt = bpt->next(); | 2810 bpt = bpt->next(); |
| 2808 } | 2811 } |
| 2809 return NULL; | 2812 return NULL; |
| 2810 } | 2813 } |
| 2811 | 2814 |
| 2812 | 2815 |
| 2813 uword Debugger::GetPatchedStubAddress(uword breakpoint_address) { | 2816 RawCode* Debugger::GetPatchedStubAddress(uword breakpoint_address) { |
| 2814 CodeBreakpoint* bpt = GetCodeBreakpoint(breakpoint_address); | 2817 CodeBreakpoint* bpt = GetCodeBreakpoint(breakpoint_address); |
| 2815 if (bpt != NULL) { | 2818 if (bpt != NULL) { |
| 2816 return bpt->OrigStubAddress(); | 2819 return bpt->OrigStubAddress(); |
| 2817 } | 2820 } |
| 2818 UNREACHABLE(); | 2821 UNREACHABLE(); |
| 2819 return 0L; | 2822 return Code::null(); |
| 2820 } | 2823 } |
| 2821 | 2824 |
| 2822 | 2825 |
| 2823 // Remove and delete the source breakpoint bpt and its associated | 2826 // Remove and delete the source breakpoint bpt and its associated |
| 2824 // code breakpoints. | 2827 // code breakpoints. |
| 2825 void Debugger::RemoveBreakpoint(intptr_t bp_id) { | 2828 void Debugger::RemoveBreakpoint(intptr_t bp_id) { |
| 2826 BreakpointLocation* prev_loc = NULL; | 2829 BreakpointLocation* prev_loc = NULL; |
| 2827 BreakpointLocation* curr_loc = breakpoint_locations_; | 2830 BreakpointLocation* curr_loc = breakpoint_locations_; |
| 2828 while (curr_loc != NULL) { | 2831 while (curr_loc != NULL) { |
| 2829 Breakpoint* prev_bpt = NULL; | 2832 Breakpoint* prev_bpt = NULL; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2970 } | 2973 } |
| 2971 | 2974 |
| 2972 | 2975 |
| 2973 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2976 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 2974 ASSERT(bpt->next() == NULL); | 2977 ASSERT(bpt->next() == NULL); |
| 2975 bpt->set_next(code_breakpoints_); | 2978 bpt->set_next(code_breakpoints_); |
| 2976 code_breakpoints_ = bpt; | 2979 code_breakpoints_ = bpt; |
| 2977 } | 2980 } |
| 2978 | 2981 |
| 2979 } // namespace dart | 2982 } // namespace dart |
| OLD | NEW |