DebugServer2
Loading...
Searching...
No Matches
Process.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/Host/Linux/PTrace.h"
14#include "DebugServer2/Target/POSIX/ELFProcess.h"
15
16namespace ds2 {
17namespace Target {
18namespace Linux {
19
20class Process : public POSIX::ELFProcess {
21protected:
22 Host::Linux::PTrace _ptrace;
23
24protected:
25 ErrorCode attach(int waitStatus) override;
26
27public:
28 ErrorCode interrupt() override;
29 ErrorCode terminate() override;
30 bool isAlive() const override;
31
32public:
33 ErrorCode getMemoryRegionInfo(Address const &address,
34 MemoryRegionInfo &info) override;
35
36protected:
37 ErrorCode executeCode(ByteVector const &codestr, uint64_t &result);
38
39public:
40 ErrorCode readMemory(Address const &address, void *data, size_t length,
41 size_t *count = nullptr) override;
42 ErrorCode writeMemory(Address const &address, void const *data, size_t length,
43 size_t *count = nullptr) override;
44
45public:
46 ErrorCode allocateMemory(size_t size, uint32_t protection,
47 uint64_t *address) override;
48 ErrorCode deallocateMemory(uint64_t address, size_t size) override;
49
50protected:
51 ErrorCode checkMemoryErrorCode(uint64_t address);
52
53public:
54 ErrorCode wait() override;
55
56public:
57 Host::Linux::PTrace &ptrace() const override;
58
59protected:
60 ErrorCode updateInfo() override;
61 ErrorCode updateAuxiliaryVector() override;
62
63protected:
64 friend class Thread;
65 ErrorCode readCPUState(ThreadId tid, Architecture::CPUState &state,
66 uint32_t flags = 0);
67 ErrorCode writeCPUState(ThreadId tid, Architecture::CPUState const &state,
68 uint32_t flags = 0);
69
70#if defined(ARCH_ARM)
71public:
72 int getMaxBreakpoints() const override;
73 int getMaxWatchpoints() const override;
74 int getMaxWatchpointSize() const override;
75#endif
76
77protected:
78 friend class POSIX::Process;
79};
80} // namespace Linux
81} // namespace Target
82} // namespace ds2
Definition Types.h:95
Definition PTrace.h:23
Definition Process.h:20
Definition Thread.h:21
Definition ELFProcess.h:20
Definition Process.h:23
Definition Types.h:361