Flutter Engine
The Flutter Engine
debugger_arm.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_ARM)
7
8#include "vm/code_patcher.h"
9#include "vm/cpu.h"
10#include "vm/debugger.h"
11#include "vm/instructions.h"
12#include "vm/stub_code.h"
13
14namespace dart {
15
16#ifndef PRODUCT
17
18CodePtr CodeBreakpoint::OrigStubAddress() const {
19 return saved_value_;
20}
21
22void CodeBreakpoint::PatchCode() {
23 ASSERT(!IsEnabled());
24 Code& stub_target = Code::Handle();
25 switch (breakpoint_kind_) {
26 case UntaggedPcDescriptors::kIcCall:
27 stub_target = StubCode::ICCallBreakpoint().ptr();
28 break;
29 case UntaggedPcDescriptors::kUnoptStaticCall:
30 stub_target = StubCode::UnoptStaticCallBreakpoint().ptr();
31 break;
32 case UntaggedPcDescriptors::kRuntimeCall:
33 stub_target = StubCode::RuntimeCallBreakpoint().ptr();
34 break;
35 default:
37 }
38 const Code& code = Code::Handle(code_);
39 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
40 CodePatcher::PatchStaticCallAt(pc_, code, stub_target);
41}
42
43void CodeBreakpoint::RestoreCode() {
45 const Code& code = Code::Handle(code_);
46 switch (breakpoint_kind_) {
47 case UntaggedPcDescriptors::kIcCall:
48 case UntaggedPcDescriptors::kUnoptStaticCall:
49 case UntaggedPcDescriptors::kRuntimeCall: {
51 break;
52 }
53 default:
55 }
56}
57
58#endif // !PRODUCT
59
60} // namespace dart
61
62#endif // defined TARGET_ARCH_ARM
#define UNREACHABLE()
Definition: assert.h:248
bool IsEnabled() const
Definition: debugger.h:235
CodePtr OrigStubAddress() const
static CodePtr GetStaticCallTargetAt(uword return_address, const Code &code)
static void PatchStaticCallAt(uword return_address, const Code &code, const Code &new_target)
static Object & Handle()
Definition: object.h:407
#define ASSERT(E)
Definition: dart_vm.cc:33