DebugServer2
Loading...
Searching...
No Matches
HardwareBreakpointManager.h
1//
2// Copyright (c) 2014-present, Facebook, Inc.
3// All rights reserved.
4//
5// This source code is licensed under the University of Illinois/NCSA Open
6// Source License found in the LICENSE file in the root directory of this
7// source tree. An additional grant of patent rights can be found in the
8// PATENTS file in the same directory.
9//
10
11#pragma once
12
13#include "DebugServer2/Core/BreakpointManager.h"
14
15#include <unordered_set>
16
17namespace ds2 {
18
20public:
23
24public:
25 ErrorCode add(Address const &address, Lifetime lifetime, size_t size,
26 Mode mode) override;
27 ErrorCode remove(Address const &address) override;
28
29public:
30 int hit(Target::Thread *thread, Site &site) override;
31
32protected:
33 ErrorCode enableLocation(Site const &site,
34 Target::Thread *thread = nullptr) override;
35 virtual ErrorCode enableLocation(Site const &site, int idx,
36 Target::Thread *thread);
37 ErrorCode disableLocation(Site const &site,
38 Target::Thread *thread = nullptr) override;
39 virtual ErrorCode disableLocation(int idx, Target::Thread *thread);
40
41protected:
42 bool enabled(Target::Thread *thread = nullptr) const override;
43
44public:
45 virtual size_t maxWatchpoints();
46
47public:
48 void enable(Target::Thread *thread = nullptr) override;
49 void disable(Target::Thread *thread = nullptr) override;
50
51protected:
52 ErrorCode isValid(Address const &address, size_t size,
53 Mode mode) const override;
54 size_t chooseBreakpointSize(Address const &address) const override;
55
56protected:
57 virtual int getAvailableLocation();
58
59protected:
60 virtual void
61 enumerateThreads(Target::Thread *thread,
62 std::function<void(Target::Thread *t)> const &cb) const;
63
64protected:
65 ErrorCode readDebugRegisters(Target::Thread *thread,
66 std::vector<uint64_t> &regs) const;
67 ErrorCode writeDebugRegisters(Target::Thread *thread,
68 std::vector<uint64_t> &regs) const;
69
70protected:
71 std::vector<uint64_t> _locations;
72 std::unordered_set<ThreadId> _enabled;
73
74#if defined(ARCH_X86) || defined(ARCH_X86_64)
75protected:
76 virtual ErrorCode disableDebugCtrlReg(uint64_t &ctrlReg, int idx);
77 virtual ErrorCode enableDebugCtrlReg(uint64_t &ctrlReg, int idx, Mode mode,
78 int size);
79#endif
80
81public:
82 virtual bool fillStopInfo(Target::Thread *thread,
83 StopInfo &stopInfo) override;
84};
85} // namespace ds2
Definition Types.h:95
Definition BreakpointManager.h:20
Definition HardwareBreakpointManager.h:19
Definition ProcessBase.h:25
Definition BreakpointManager.h:36
Definition Types.h:131