| 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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 DebuggerEvent event(kBreakpointResolved); | 1177 DebuggerEvent event(kBreakpointResolved); |
| 1178 event.breakpoint = bpt; | 1178 event.breakpoint = bpt; |
| 1179 (*event_handler_)(&event); | 1179 (*event_handler_)(&event); |
| 1180 } | 1180 } |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 | 1183 |
| 1184 ActivationFrame* Debugger::CollectDartFrame(Isolate* isolate, | 1184 ActivationFrame* Debugger::CollectDartFrame(Isolate* isolate, |
| 1185 uword pc, | 1185 uword pc, |
| 1186 StackFrame* frame, | 1186 StackFrame* frame, |
| 1187 const Code& code, | 1187 const Code& code_param, |
| 1188 const Array& deopt_frame, | 1188 const Array& deopt_frame, |
| 1189 intptr_t deopt_frame_offset, | 1189 intptr_t deopt_frame_offset, |
| 1190 ActivationFrame* callee_activation, | 1190 ActivationFrame* callee_activation, |
| 1191 const Context& entry_ctx) { | 1191 const Context& entry_ctx) { |
| 1192 // TODO(turnidge): Remove the workaround below once... |
| 1193 // https://code.google.com/p/dart/issues/detail?id=18384 |
| 1194 // ...is fixed. |
| 1195 Code& code = Code::Handle(isolate); |
| 1196 code = code_param.raw(); |
| 1197 if (!code.ContainsInstructionAt(pc)) { |
| 1198 code = Code::LookupCode(pc); |
| 1199 ASSERT(!code.IsNull()); |
| 1200 ASSERT(code.ContainsInstructionAt(pc)); |
| 1201 } |
| 1202 |
| 1192 // We provide either a callee activation or an entry context. Not both. | 1203 // We provide either a callee activation or an entry context. Not both. |
| 1193 ASSERT(((callee_activation != NULL) && entry_ctx.IsNull()) || | 1204 ASSERT(((callee_activation != NULL) && entry_ctx.IsNull()) || |
| 1194 ((callee_activation == NULL) && !entry_ctx.IsNull())); | 1205 ((callee_activation == NULL) && !entry_ctx.IsNull())); |
| 1195 ActivationFrame* activation = | 1206 ActivationFrame* activation = |
| 1196 new ActivationFrame(pc, frame->fp(), frame->sp(), code, | 1207 new ActivationFrame(pc, frame->fp(), frame->sp(), code, |
| 1197 deopt_frame, deopt_frame_offset); | 1208 deopt_frame, deopt_frame_offset); |
| 1198 | 1209 |
| 1199 // Is there a closure call at the current PC? | 1210 // Is there a closure call at the current PC? |
| 1200 // | 1211 // |
| 1201 // We can't just check the callee_activation to see if it is a | 1212 // We can't just check the callee_activation to see if it is a |
| 1202 // closure function, because it may not be on the stack yet. | 1213 // closure function, because it may not be on the stack yet. |
| 1203 bool is_closure_call = false; | 1214 bool is_closure_call = false; |
| 1204 const PcDescriptors& pc_desc = | 1215 const PcDescriptors& pc_desc = |
| 1205 PcDescriptors::Handle(code.pc_descriptors()); | 1216 PcDescriptors::Handle(code.pc_descriptors()); |
| 1206 ASSERT(code.ContainsInstructionAt(pc)); | 1217 |
| 1207 for (int i = 0; i < pc_desc.Length(); i++) { | 1218 for (int i = 0; i < pc_desc.Length(); i++) { |
| 1208 if (pc_desc.PC(i) == pc && | 1219 if (pc_desc.PC(i) == pc && |
| 1209 pc_desc.DescriptorKind(i) == PcDescriptors::kClosureCall) { | 1220 pc_desc.DescriptorKind(i) == PcDescriptors::kClosureCall) { |
| 1210 is_closure_call = true; | 1221 is_closure_call = true; |
| 1211 break; | 1222 break; |
| 1212 } | 1223 } |
| 1213 } | 1224 } |
| 1214 | 1225 |
| 1215 // Recover the context for this frame. | 1226 // Recover the context for this frame. |
| 1216 if (is_closure_call) { | 1227 if (is_closure_call) { |
| (...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2503 } | 2514 } |
| 2504 | 2515 |
| 2505 | 2516 |
| 2506 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2517 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 2507 ASSERT(bpt->next() == NULL); | 2518 ASSERT(bpt->next() == NULL); |
| 2508 bpt->set_next(code_breakpoints_); | 2519 bpt->set_next(code_breakpoints_); |
| 2509 code_breakpoints_ = bpt; | 2520 code_breakpoints_ = bpt; |
| 2510 } | 2521 } |
| 2511 | 2522 |
| 2512 } // namespace dart | 2523 } // namespace dart |
| OLD | NEW |