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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 uword pc, | 1101 uword pc, |
1101 RawPcDescriptors::Kind kind) | 1102 RawPcDescriptors::Kind kind) |
1102 : code_(code.raw()), | 1103 : code_(code.raw()), |
1103 token_pos_(token_pos), | 1104 token_pos_(token_pos), |
1104 pc_(pc), | 1105 pc_(pc), |
1105 line_number_(-1), | 1106 line_number_(-1), |
1106 is_enabled_(false), | 1107 is_enabled_(false), |
1107 bpt_location_(NULL), | 1108 bpt_location_(NULL), |
1108 next_(NULL), | 1109 next_(NULL), |
1109 breakpoint_kind_(kind), | 1110 breakpoint_kind_(kind), |
1110 saved_value_(0) { | 1111 saved_value_(Code::null()) { |
1111 ASSERT(!code.IsNull()); | 1112 ASSERT(!code.IsNull()); |
1112 ASSERT(token_pos_ > 0); | 1113 ASSERT(token_pos_ > 0); |
1113 ASSERT(pc_ != 0); | 1114 ASSERT(pc_ != 0); |
1114 ASSERT((breakpoint_kind_ & kSafepointKind) != 0); | 1115 ASSERT((breakpoint_kind_ & kSafepointKind) != 0); |
1115 } | 1116 } |
1116 | 1117 |
1117 | 1118 |
1118 CodeBreakpoint::~CodeBreakpoint() { | 1119 CodeBreakpoint::~CodeBreakpoint() { |
1119 // Make sure we don't leave patched code behind. | 1120 // Make sure we don't leave patched code behind. |
1120 ASSERT(!IsEnabled()); | 1121 ASSERT(!IsEnabled()); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 | 1385 |
1385 RawArray* Debugger::DeoptimizeToArray(Isolate* isolate, | 1386 RawArray* Debugger::DeoptimizeToArray(Isolate* isolate, |
1386 StackFrame* frame, | 1387 StackFrame* frame, |
1387 const Code& code) { | 1388 const Code& code) { |
1388 ASSERT(code.is_optimized()); | 1389 ASSERT(code.is_optimized()); |
1389 | 1390 |
1390 // Create the DeoptContext for this deoptimization. | 1391 // Create the DeoptContext for this deoptimization. |
1391 DeoptContext* deopt_context = | 1392 DeoptContext* deopt_context = |
1392 new DeoptContext(frame, code, | 1393 new DeoptContext(frame, code, |
1393 DeoptContext::kDestIsAllocated, | 1394 DeoptContext::kDestIsAllocated, |
1394 NULL, NULL); | 1395 NULL, |
| 1396 NULL, |
| 1397 true); |
1395 isolate->set_deopt_context(deopt_context); | 1398 isolate->set_deopt_context(deopt_context); |
1396 | 1399 |
1397 deopt_context->FillDestFrame(); | 1400 deopt_context->FillDestFrame(); |
1398 deopt_context->MaterializeDeferredObjects(); | 1401 deopt_context->MaterializeDeferredObjects(); |
1399 const Array& dest_frame = Array::Handle(isolate, | 1402 const Array& dest_frame = Array::Handle(isolate, |
1400 deopt_context->DestFrameAsArray()); | 1403 deopt_context->DestFrameAsArray()); |
1401 | 1404 |
1402 isolate->set_deopt_context(NULL); | 1405 isolate->set_deopt_context(NULL); |
1403 delete deopt_context; | 1406 delete deopt_context; |
1404 | 1407 |
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 while (bpt != NULL) { | 2860 while (bpt != NULL) { |
2858 if (bpt->pc() == breakpoint_address) { | 2861 if (bpt->pc() == breakpoint_address) { |
2859 return bpt; | 2862 return bpt; |
2860 } | 2863 } |
2861 bpt = bpt->next(); | 2864 bpt = bpt->next(); |
2862 } | 2865 } |
2863 return NULL; | 2866 return NULL; |
2864 } | 2867 } |
2865 | 2868 |
2866 | 2869 |
2867 uword Debugger::GetPatchedStubAddress(uword breakpoint_address) { | 2870 RawCode* Debugger::GetPatchedStubAddress(uword breakpoint_address) { |
2868 CodeBreakpoint* bpt = GetCodeBreakpoint(breakpoint_address); | 2871 CodeBreakpoint* bpt = GetCodeBreakpoint(breakpoint_address); |
2869 if (bpt != NULL) { | 2872 if (bpt != NULL) { |
2870 return bpt->OrigStubAddress(); | 2873 return bpt->OrigStubAddress(); |
2871 } | 2874 } |
2872 UNREACHABLE(); | 2875 UNREACHABLE(); |
2873 return 0L; | 2876 return Code::null(); |
2874 } | 2877 } |
2875 | 2878 |
2876 | 2879 |
2877 // Remove and delete the source breakpoint bpt and its associated | 2880 // Remove and delete the source breakpoint bpt and its associated |
2878 // code breakpoints. | 2881 // code breakpoints. |
2879 void Debugger::RemoveBreakpoint(intptr_t bp_id) { | 2882 void Debugger::RemoveBreakpoint(intptr_t bp_id) { |
2880 BreakpointLocation* prev_loc = NULL; | 2883 BreakpointLocation* prev_loc = NULL; |
2881 BreakpointLocation* curr_loc = breakpoint_locations_; | 2884 BreakpointLocation* curr_loc = breakpoint_locations_; |
2882 while (curr_loc != NULL) { | 2885 while (curr_loc != NULL) { |
2883 Breakpoint* prev_bpt = NULL; | 2886 Breakpoint* prev_bpt = NULL; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3024 } | 3027 } |
3025 | 3028 |
3026 | 3029 |
3027 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3030 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3028 ASSERT(bpt->next() == NULL); | 3031 ASSERT(bpt->next() == NULL); |
3029 bpt->set_next(code_breakpoints_); | 3032 bpt->set_next(code_breakpoints_); |
3030 code_breakpoints_ = bpt; | 3033 code_breakpoints_ = bpt; |
3031 } | 3034 } |
3032 | 3035 |
3033 } // namespace dart | 3036 } // namespace dart |
OLD | NEW |