Index: runtime/vm/debugger_arm.cc |
diff --git a/runtime/vm/debugger_arm.cc b/runtime/vm/debugger_arm.cc |
index 0f59fd9842185406e2c5f29ca5a347f1e34e8ffb..479ce06922a669920f624ae5585a7866cdb6354e 100644 |
--- a/runtime/vm/debugger_arm.cc |
+++ b/runtime/vm/debugger_arm.cc |
@@ -40,20 +40,24 @@ uword CodeBreakpoint::OrigStubAddress() const { |
void CodeBreakpoint::PatchCode() { |
ASSERT(!is_enabled_); |
- switch (breakpoint_kind_) { |
- case PcDescriptors::kIcCall: |
- case PcDescriptors::kUnoptStaticCall: |
- case PcDescriptors::kRuntimeCall: |
- case PcDescriptors::kClosureCall: |
- case PcDescriptors::kReturn: { |
- const Code& code = Code::Handle(code_); |
- saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
- CodePatcher::PatchStaticCallAt(pc_, code, |
- StubCode::BreakpointRuntimeEntryPoint()); |
- break; |
+ const Code& code = Code::Handle(code_); |
+ const Instructions& instrs = Instructions::Handle(code.instructions()); |
+ { |
+ WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
+ switch (breakpoint_kind_) { |
+ case PcDescriptors::kIcCall: |
+ case PcDescriptors::kUnoptStaticCall: |
+ case PcDescriptors::kRuntimeCall: |
+ case PcDescriptors::kClosureCall: |
+ case PcDescriptors::kReturn: { |
+ saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
+ CodePatcher::PatchStaticCallAt(pc_, code, |
+ StubCode::BreakpointRuntimeEntryPoint()); |
+ break; |
+ } |
+ default: |
+ UNREACHABLE(); |
} |
- default: |
- UNREACHABLE(); |
} |
is_enabled_ = true; |
} |
@@ -61,18 +65,20 @@ void CodeBreakpoint::PatchCode() { |
void CodeBreakpoint::RestoreCode() { |
ASSERT(is_enabled_); |
- switch (breakpoint_kind_) { |
- case PcDescriptors::kIcCall: |
- case PcDescriptors::kUnoptStaticCall: |
- case PcDescriptors::kClosureCall: |
- case PcDescriptors::kRuntimeCall: |
- case PcDescriptors::kReturn: { |
- const Code& code = Code::Handle(code_); |
- CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
- break; |
+ const Code& code = Code::Handle(code_); |
+ const Instructions& instrs = Instructions::Handle(code.instructions()); |
+ { |
+ WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
+ switch (breakpoint_kind_) { |
+ case PcDescriptors::kIcCall: |
+ case PcDescriptors::kUnoptStaticCall: |
+ case PcDescriptors::kClosureCall: |
+ case PcDescriptors::kRuntimeCall: |
+ case PcDescriptors::kReturn: { |
+ CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
+ break; |
+ } |
} |
- default: |
- UNREACHABLE(); |
} |
is_enabled_ = false; |
} |