Chromium Code Reviews| Index: runtime/vm/debugger_dbc.cc |
| diff --git a/runtime/vm/debugger_ia32.cc b/runtime/vm/debugger_dbc.cc |
| similarity index 62% |
| copy from runtime/vm/debugger_ia32.cc |
| copy to runtime/vm/debugger_dbc.cc |
| index 9c4473ba32a2863208738b3f955e3d9c03bca13c..a42afae0e48a3624c5c070e67b86d4bdc0aaa718 100644 |
| --- a/runtime/vm/debugger_ia32.cc |
| +++ b/runtime/vm/debugger_dbc.cc |
| @@ -1,26 +1,23 @@ |
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| #include "vm/globals.h" |
| -#if defined(TARGET_ARCH_IA32) |
| - |
| -#include "vm/debugger.h" |
| +#if defined(TARGET_ARCH_DBC) |
| #include "vm/code_patcher.h" |
| #include "vm/cpu.h" |
| -#include "vm/disassembler.h" |
| -#include "vm/object.h" |
| -#include "vm/os.h" |
| -#include "vm/stack_frame.h" |
| +#include "vm/debugger.h" |
| +#include "vm/instructions.h" |
| #include "vm/stub_code.h" |
| +#include "vm/log.h" |
|
zra
2016/04/08 22:37:35
move above stub_code.h
Vyacheslav Egorov (Google)
2016/04/11 10:49:11
Done.
|
| namespace dart { |
| #ifndef PRODUCT |
| RawCode* CodeBreakpoint::OrigStubAddress() const { |
| - return saved_value_; |
| + return reinterpret_cast<RawCode*>(static_cast<uintptr_t>(saved_value_)); |
| } |
| @@ -28,25 +25,31 @@ void CodeBreakpoint::PatchCode() { |
| ASSERT(!is_enabled_); |
| const Code& code = Code::Handle(code_); |
| const Instructions& instrs = Instructions::Handle(code.instructions()); |
| - Code& stub_target = Code::Handle(); |
| { |
| WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
| + saved_value_ = reinterpret_cast<uint32_t*>(pc_)[-1]; |
|
zra
2016/04/08 22:37:35
A comment about what is going on here could be use
Vyacheslav Egorov (Google)
2016/04/11 10:49:10
Done.
|
| switch (breakpoint_kind_) { |
| case RawPcDescriptors::kIcCall: |
| case RawPcDescriptors::kUnoptStaticCall: { |
| - stub_target = StubCode::ICCallBreakpoint_entry()->code(); |
| + // DebugBreak has A operand matching the call it replaces. |
|
zra
2016/04/08 22:37:35
an operand
Vyacheslav Egorov (Google)
2016/04/11 10:49:10
Done.
|
| + // This ensures that Return instructions continue to work - as they |
| + // look at calls to figure out how many arguments to drop. |
| + reinterpret_cast<uint32_t*>(pc_)[-1] = |
|
zra
2016/04/08 22:37:35
Since this appears a few times, maybe calculate th
Vyacheslav Egorov (Google)
2016/04/11 10:49:10
Done.
|
| + Bytecode::Encode(Bytecode::kDebugBreak, |
| + Bytecode::DecodeArgc(saved_value_), |
| + 0, |
| + 0); |
| break; |
| } |
| + |
| case RawPcDescriptors::kRuntimeCall: { |
| - saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
| - stub_target = StubCode::RuntimeCallBreakpoint_entry()->code(); |
| + reinterpret_cast<uint32_t*>(pc_)[-1] = Bytecode::kDebugBreak; |
| break; |
| } |
| + |
| default: |
| UNREACHABLE(); |
| } |
| - saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
| - CodePatcher::PatchStaticCallAt(pc_, code, stub_target); |
| } |
| is_enabled_ = true; |
| } |
| @@ -62,7 +65,7 @@ void CodeBreakpoint::RestoreCode() { |
| case RawPcDescriptors::kIcCall: |
| case RawPcDescriptors::kUnoptStaticCall: |
| case RawPcDescriptors::kRuntimeCall: { |
| - CodePatcher::PatchStaticCallAt(pc_, code, Code::Handle(saved_value_)); |
| + reinterpret_cast<uint32_t*>(pc_)[-1] = saved_value_; |
|
zra
2016/04/08 22:37:35
Yah, maybe add something to CodeBreakpoint to calc
Vyacheslav Egorov (Google)
2016/04/11 10:49:11
Done.
|
| break; |
| } |
| default: |
| @@ -76,4 +79,4 @@ void CodeBreakpoint::RestoreCode() { |
| } // namespace dart |
| -#endif // defined TARGET_ARCH_IA32 |
| +#endif // defined TARGET_ARCH_DBC |