OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 if (!cls.IsNull()) { | 267 if (!cls.IsNull()) { |
268 function = cls.LookupStaticFunction(function_name); | 268 function = cls.LookupStaticFunction(function_name); |
269 if (function.IsNull()) { | 269 if (function.IsNull()) { |
270 function = cls.LookupDynamicFunction(function_name); | 270 function = cls.LookupDynamicFunction(function_name); |
271 } | 271 } |
272 } | 272 } |
273 return function.raw(); | 273 return function.raw(); |
274 } | 274 } |
275 | 275 |
276 | 276 |
277 Breakpoint* Debugger::SetBreakpointAtEntry(const Function& target_function) { | 277 Breakpoint* Debugger::SetBreakpointAtEntry(const Function& target_function, |
| 278 Error* error) { |
278 ASSERT(!target_function.IsNull()); | 279 ASSERT(!target_function.IsNull()); |
279 if (!target_function.HasCode()) { | 280 if (!target_function.HasCode()) { |
280 Compiler::CompileFunction(target_function); | 281 *error = Compiler::CompileFunction(target_function); |
| 282 if (!error->IsNull()) { |
| 283 return NULL; |
| 284 } |
281 } | 285 } |
282 Code& code = Code::Handle(target_function.code()); | 286 Code& code = Code::Handle(target_function.code()); |
283 ASSERT(!code.IsNull()); | 287 ASSERT(!code.IsNull()); |
284 PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors()); | 288 PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors()); |
285 for (int i = 0; i < desc.Length(); i++) { | 289 for (int i = 0; i < desc.Length(); i++) { |
286 PcDescriptors::Kind kind = desc.DescriptorKind(i); | 290 PcDescriptors::Kind kind = desc.DescriptorKind(i); |
287 Breakpoint* bpt = NULL; | 291 Breakpoint* bpt = NULL; |
288 if (kind == PcDescriptors::kIcCall) { | 292 if (kind == PcDescriptors::kIcCall) { |
289 CodePatcher::PatchInstanceCallAt( | 293 CodePatcher::PatchInstanceCallAt( |
290 desc.PC(i), StubCode::BreakpointDynamicEntryPoint()); | 294 desc.PC(i), StubCode::BreakpointDynamicEntryPoint()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 402 |
399 | 403 |
400 void Debugger::AddBreakpoint(Breakpoint* bpt) { | 404 void Debugger::AddBreakpoint(Breakpoint* bpt) { |
401 ASSERT(bpt->next() == NULL); | 405 ASSERT(bpt->next() == NULL); |
402 bpt->set_next(this->breakpoints_); | 406 bpt->set_next(this->breakpoints_); |
403 this->breakpoints_ = bpt; | 407 this->breakpoints_ = bpt; |
404 } | 408 } |
405 | 409 |
406 | 410 |
407 } // namespace dart | 411 } // namespace dart |
OLD | NEW |