| Index: runtime/vm/debugger.cc
|
| diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
|
| index f84dc2e0db20743b28b4ea1770331414d26bbc2e..d182aa6c8fcf9533f499f2aa3ebe07c6c05583b1 100644
|
| --- a/runtime/vm/debugger.cc
|
| +++ b/runtime/vm/debugger.cc
|
| @@ -753,40 +753,40 @@ intptr_t CodeBreakpoint::LineNumber() {
|
|
|
| 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;
|
| - }
|
| - 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: {
|
| - 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;
|
| + 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: {
|
| + saved_bytes_.target_address_ =
|
| + CodePatcher::GetStaticCallTargetAt(pc_, code);
|
| + CodePatcher::PatchStaticCallAt(pc_, code,
|
| + StubCode::BreakpointRuntimeEntryPoint());
|
| + break;
|
| + }
|
| + case PcDescriptors::kReturn:
|
| + PatchFunctionReturn();
|
| + break;
|
| + default:
|
| + UNREACHABLE();
|
| }
|
| - case PcDescriptors::kReturn:
|
| - PatchFunctionReturn();
|
| - break;
|
| - default:
|
| - UNREACHABLE();
|
| }
|
| is_enabled_ = true;
|
| }
|
| @@ -794,28 +794,32 @@ 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,
|
| + 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: {
|
| + const Code& code =
|
| + Code::Handle(Function::Handle(function_).unoptimized_code());
|
| + CodePatcher::PatchStaticCallAt(pc_, code,
|
| saved_bytes_.target_address_);
|
| - break;
|
| - }
|
| - case PcDescriptors::kUnoptStaticCall:
|
| - case PcDescriptors::kClosureCall:
|
| - case PcDescriptors::kRuntimeCall: {
|
| - const Code& code =
|
| - Code::Handle(Function::Handle(function_).unoptimized_code());
|
| - CodePatcher::PatchStaticCallAt(pc_, code,
|
| - saved_bytes_.target_address_);
|
| - break;
|
| + break;
|
| + }
|
| + case PcDescriptors::kReturn:
|
| + RestoreFunctionReturn();
|
| + break;
|
| + default:
|
| + UNREACHABLE();
|
| }
|
| - case PcDescriptors::kReturn:
|
| - RestoreFunctionReturn();
|
| - break;
|
| - default:
|
| - UNREACHABLE();
|
| }
|
| is_enabled_ = false;
|
| }
|
|
|