Index: runtime/vm/debugger_arm.cc |
diff --git a/runtime/vm/debugger_arm.cc b/runtime/vm/debugger_arm.cc |
index 753f781d7534db1536b127c8834c3457d9d68812..711cf3c92fe41e63cf336dbd96660b37c0f72d33 100644 |
--- a/runtime/vm/debugger_arm.cc |
+++ b/runtime/vm/debugger_arm.cc |
@@ -40,35 +40,35 @@ uword CodeBreakpoint::OrigStubAddress() const { |
void CodeBreakpoint::PatchCode() { |
ASSERT(!is_enabled_); |
- switch (breakpoint_kind_) { |
- case PcDescriptors::kIcCall: { |
- const Code& code = |
- Code::Handle(Function::Handle(function_).unoptimized_code()); |
- saved_value_ = 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_value_ = CodePatcher::GetInstanceCallAt(pc_, code, NULL); |
+ CodePatcher::PatchInstanceCallAt( |
+ pc_, code, StubCode::BreakpointDynamicEntryPoint()); |
+ break; |
+ } |
+ case PcDescriptors::kUnoptStaticCall: { |
+ saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
+ CodePatcher::PatchStaticCallAt(pc_, code, |
+ StubCode::BreakpointStaticEntryPoint()); |
+ break; |
+ } |
+ case PcDescriptors::kRuntimeCall: |
+ case PcDescriptors::kClosureCall: |
+ case PcDescriptors::kReturn: { |
+ saved_value_ = 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_value_ = 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_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
- CodePatcher::PatchStaticCallAt(pc_, code, |
- StubCode::BreakpointRuntimeEntryPoint()); |
- break; |
- } |
- default: |
- UNREACHABLE(); |
} |
is_enabled_ = true; |
} |
@@ -76,24 +76,26 @@ void CodeBreakpoint::PatchCode() { |
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, saved_value_); |
- break; |
- } |
- 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_value_); |
- 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: { |
+ CodePatcher::PatchInstanceCallAt(pc_, code, saved_value_); |
+ break; |
+ } |
+ case PcDescriptors::kUnoptStaticCall: |
+ case PcDescriptors::kClosureCall: |
+ case PcDescriptors::kRuntimeCall: |
+ case PcDescriptors::kReturn: { |
+ CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
+ break; |
+ } |
+ default: |
+ UNREACHABLE(); |
} |
- default: |
- UNREACHABLE(); |
} |
is_enabled_ = false; |
} |