Index: runtime/vm/debugger_arm.cc |
diff --git a/runtime/vm/debugger_arm.cc b/runtime/vm/debugger_arm.cc |
index fc924ca304949689d0951b588da5596e3c06a974..608d6d233c6444201d032b6e794c8681b25135d1 100644 |
--- a/runtime/vm/debugger_arm.cc |
+++ b/runtime/vm/debugger_arm.cc |
@@ -20,35 +20,25 @@ uword CodeBreakpoint::OrigStubAddress() const { |
void CodeBreakpoint::PatchCode() { |
ASSERT(!is_enabled_); |
- const Code& code = Code::Handle(code_); |
- const Instructions& instrs = Instructions::Handle(code.instructions()); |
- Isolate* isolate = Isolate::Current(); |
- { |
- WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
- switch (breakpoint_kind_) { |
- case RawPcDescriptors::kIcCall: |
- case RawPcDescriptors::kUnoptStaticCall: { |
- saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
- CodePatcher::PatchStaticCallAt( |
- pc_, code, isolate->stub_code()->ICCallBreakpointEntryPoint()); |
- break; |
- } |
- case RawPcDescriptors::kClosureCall: { |
- saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
- CodePatcher::PatchStaticCallAt( |
- pc_, code, isolate->stub_code()->ClosureCallBreakpointEntryPoint()); |
- break; |
- } |
- case RawPcDescriptors::kRuntimeCall: { |
- saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
- CodePatcher::PatchStaticCallAt( |
- pc_, code, isolate->stub_code()->RuntimeCallBreakpointEntryPoint()); |
- break; |
- } |
- default: |
- UNREACHABLE(); |
- } |
+ StubCode* stub_code = Isolate::Current()->stub_code(); |
+ uword stub_target = 0; |
+ switch (breakpoint_kind_) { |
+ case RawPcDescriptors::kIcCall: |
+ case RawPcDescriptors::kUnoptStaticCall: |
+ stub_target = stub_code->ICCallBreakpointEntryPoint(); |
+ break; |
+ case RawPcDescriptors::kClosureCall: |
+ stub_target = stub_code->ClosureCallBreakpointEntryPoint(); |
+ break; |
+ case RawPcDescriptors::kRuntimeCall: |
+ stub_target = stub_code->RuntimeCallBreakpointEntryPoint(); |
+ break; |
+ default: |
+ UNREACHABLE(); |
} |
+ const Code& code = Code::Handle(code_); |
+ saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
+ CodePatcher::PatchStaticCallAt(pc_, code, stub_target); |
is_enabled_ = true; |
} |
@@ -56,20 +46,16 @@ void CodeBreakpoint::PatchCode() { |
void CodeBreakpoint::RestoreCode() { |
ASSERT(is_enabled_); |
const Code& code = Code::Handle(code_); |
- const Instructions& instrs = Instructions::Handle(code.instructions()); |
- { |
- WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
- switch (breakpoint_kind_) { |
- case RawPcDescriptors::kIcCall: |
- case RawPcDescriptors::kUnoptStaticCall: |
- case RawPcDescriptors::kClosureCall: |
- case RawPcDescriptors::kRuntimeCall: { |
- CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
- break; |
- } |
- default: |
- UNREACHABLE(); |
+ switch (breakpoint_kind_) { |
+ case RawPcDescriptors::kIcCall: |
+ case RawPcDescriptors::kUnoptStaticCall: |
+ case RawPcDescriptors::kClosureCall: |
+ case RawPcDescriptors::kRuntimeCall: { |
+ CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
+ break; |
} |
+ default: |
+ UNREACHABLE(); |
} |
is_enabled_ = false; |
} |