Index: runtime/vm/debugger.cc |
=================================================================== |
--- runtime/vm/debugger.cc (revision 31654) |
+++ runtime/vm/debugger.cc (working copy) |
@@ -760,38 +760,38 @@ |
void CodeBreakpoint::PatchCode() { |
ASSERT(!is_enabled_); |
- switch (breakpoint_kind_) { |
- case PcDescriptors::kIcCall: { |
- const Code& code = |
- Code::Handle(Function::Handle(function_).unoptimized_code()); |
- saved_bytes_.target_address_ = |
- CodePatcher::GetInstanceCallAt(pc_, code, NULL); |
- CodePatcher::PatchInstanceCallAt(pc_, code, |
- StubCode::BreakpointDynamicEntryPoint()); |
- break; |
+ const Code& code = |
+ Code::Handle(Function::Handle(function_).unoptimized_code()); |
+ const Instructions& instrs = Instructions::Handle(code.instructions()); |
+ { |
+ WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
+ switch (breakpoint_kind_) { |
+ case PcDescriptors::kIcCall: { |
+ saved_bytes_.target_address_ = |
+ CodePatcher::GetInstanceCallAt(pc_, code, NULL); |
+ CodePatcher::PatchInstanceCallAt( |
+ pc_, code, StubCode::BreakpointDynamicEntryPoint()); |
+ break; |
+ } |
+ case PcDescriptors::kUnoptStaticCall: { |
+ saved_bytes_.target_address_ = |
+ CodePatcher::GetStaticCallTargetAt(pc_, code); |
+ CodePatcher::PatchStaticCallAt(pc_, code, |
+ StubCode::BreakpointStaticEntryPoint()); |
+ break; |
+ } |
+ case PcDescriptors::kRuntimeCall: |
+ case PcDescriptors::kClosureCall: |
+ case PcDescriptors::kReturn: { |
+ saved_bytes_.target_address_ = |
+ CodePatcher::GetStaticCallTargetAt(pc_, code); |
+ CodePatcher::PatchStaticCallAt(pc_, code, |
+ StubCode::BreakpointRuntimeEntryPoint()); |
+ break; |
+ } |
+ default: |
+ UNREACHABLE(); |
} |
- case PcDescriptors::kUnoptStaticCall: { |
- const Code& code = |
- Code::Handle(Function::Handle(function_).unoptimized_code()); |
- saved_bytes_.target_address_ = |
- CodePatcher::GetStaticCallTargetAt(pc_, code); |
- CodePatcher::PatchStaticCallAt(pc_, code, |
- StubCode::BreakpointStaticEntryPoint()); |
- break; |
- } |
- case PcDescriptors::kRuntimeCall: |
- case PcDescriptors::kClosureCall: |
- case PcDescriptors::kReturn: { |
- const Code& code = |
- Code::Handle(Function::Handle(function_).unoptimized_code()); |
- saved_bytes_.target_address_ = |
- CodePatcher::GetStaticCallTargetAt(pc_, code); |
- CodePatcher::PatchStaticCallAt(pc_, code, |
- StubCode::BreakpointRuntimeEntryPoint()); |
- break; |
- } |
- default: |
- UNREACHABLE(); |
} |
is_enabled_ = true; |
} |
@@ -799,26 +799,28 @@ |
void CodeBreakpoint::RestoreCode() { |
ASSERT(is_enabled_); |
- switch (breakpoint_kind_) { |
- case PcDescriptors::kIcCall: { |
- const Code& code = |
- Code::Handle(Function::Handle(function_).unoptimized_code()); |
- CodePatcher::PatchInstanceCallAt(pc_, code, |
+ const Code& code = |
+ Code::Handle(Function::Handle(function_).unoptimized_code()); |
+ const Instructions& instrs = Instructions::Handle(code.instructions()); |
+ { |
+ WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
+ switch (breakpoint_kind_) { |
+ case PcDescriptors::kIcCall: { |
+ CodePatcher::PatchInstanceCallAt(pc_, code, |
+ saved_bytes_.target_address_); |
+ break; |
+ } |
+ case PcDescriptors::kUnoptStaticCall: |
+ case PcDescriptors::kClosureCall: |
+ case PcDescriptors::kRuntimeCall: |
+ case PcDescriptors::kReturn: { |
+ CodePatcher::PatchStaticCallAt(pc_, code, |
saved_bytes_.target_address_); |
- break; |
+ break; |
+ } |
+ default: |
+ UNREACHABLE(); |
} |
- case PcDescriptors::kUnoptStaticCall: |
- case PcDescriptors::kClosureCall: |
- case PcDescriptors::kRuntimeCall: |
- case PcDescriptors::kReturn: { |
- const Code& code = |
- Code::Handle(Function::Handle(function_).unoptimized_code()); |
- CodePatcher::PatchStaticCallAt(pc_, code, |
- saved_bytes_.target_address_); |
- break; |
- } |
- default: |
- UNREACHABLE(); |
} |
is_enabled_ = false; |
} |