Flutter Engine
The Flutter Engine
debugger_x64.cc
Go to the documentation of this file.
1// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#include "vm/globals.h"
6#if defined(TARGET_ARCH_X64)
7
8#include "vm/debugger.h"
9
10#include "vm/code_patcher.h"
11#include "vm/cpu.h"
12#include "vm/instructions.h"
13#include "vm/stub_code.h"
14
15namespace dart {
16
17#ifndef PRODUCT
18
19CodePtr CodeBreakpoint::OrigStubAddress() const {
20 return saved_value_;
21}
22
23void CodeBreakpoint::PatchCode() {
24 ASSERT(!IsEnabled());
25 Code& stub_target = Code::Handle();
26 switch (breakpoint_kind_) {
27 case UntaggedPcDescriptors::kIcCall:
28 stub_target = StubCode::ICCallBreakpoint().ptr();
29 break;
30 case UntaggedPcDescriptors::kUnoptStaticCall:
31 stub_target = StubCode::UnoptStaticCallBreakpoint().ptr();
32 break;
33 case UntaggedPcDescriptors::kRuntimeCall:
34 stub_target = StubCode::RuntimeCallBreakpoint().ptr();
35 break;
36 default:
38 }
39 const Code& code = Code::Handle(code_);
40 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
42}
43
44void CodeBreakpoint::RestoreCode() {
46 const Code& code = Code::Handle(code_);
47 switch (breakpoint_kind_) {
48 case UntaggedPcDescriptors::kIcCall:
49 case UntaggedPcDescriptors::kUnoptStaticCall:
50 case UntaggedPcDescriptors::kRuntimeCall: {
52 Code::Handle(saved_value_));
53 break;
54 }
55 default:
57 }
58}
59
60#endif // !PRODUCT
61
62} // namespace dart
63
64#endif // defined TARGET_ARCH_X64
#define UNREACHABLE()
Definition: assert.h:248
bool IsEnabled() const
Definition: debugger.h:235
CodePtr OrigStubAddress() const
static void PatchPoolPointerCallAt(uword return_address, const Code &code, const Code &new_target)
static CodePtr GetStaticCallTargetAt(uword return_address, const Code &code)
static Object & Handle()
Definition: object.h:407
#define ASSERT(E)
Definition: dart_vm.cc:33