DebugServer2
Loading...
Searching...
No Matches
Mach.h
1//
2// Copyright (c) 2015 Corentin Derbois <cderbois@gmail.com>
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/Architecture/CPUState.h"
14
15#include <mach/mach.h>
16#include <mach/mach_vm.h>
17#include <mach/thread_info.h>
18#include <sys/types.h>
19
20namespace ds2 {
21namespace Host {
22namespace Darwin {
23
24class Mach {
25public:
26 virtual ~Mach() = default;
27
28public:
29 ErrorCode readMemory(ProcessThreadId const &ptid, Address const &address,
30 void *buffer, size_t length, size_t *nread = nullptr);
31 ErrorCode writeMemory(ProcessThreadId const &ptid, Address const &address,
32 void const *buffer, size_t length,
33 size_t *nwritten = nullptr);
34
35public:
36 ErrorCode readCPUState(ProcessThreadId const &ptid, ProcessInfo const &info,
37 Architecture::CPUState &state);
38 ErrorCode writeCPUState(ProcessThreadId const &ptid, ProcessInfo const &info,
39 Architecture::CPUState const &state);
40
41public:
42 ErrorCode suspend(ProcessThreadId const &ptid);
43
44public:
45 ErrorCode step(ProcessThreadId const &ptid, ProcessInfo const &pinfo,
46 int signal = 0, Address const &address = Address());
47 ErrorCode resume(ProcessThreadId const &ptid, ProcessInfo const &pinfo,
48 int signal = 0, Address const &address = Address());
49
50public:
51 ErrorCode getProcessDylbInfo(ProcessId pid, Address &address);
52 ErrorCode getProcessMemoryRegion(ProcessId pid, Address const &address,
53 MemoryRegionInfo &info);
54
55public:
56 ErrorCode getThreadInfo(ProcessThreadId const &tid, thread_basic_info_t info);
57 ErrorCode getThreadIdentifierInfo(ProcessThreadId const &tid,
58 thread_identifier_info_data_t *threadID);
59
60private:
61 task_t getMachTask(ProcessId pid);
62 thread_t getMachThread(ProcessThreadId const &tid);
63};
64} // namespace Darwin
65} // namespace Host
66} // namespace ds2
Definition Types.h:95
Definition Mach.h:24
Definition Types.h:361
Definition Types.h:263
Definition Types.h:57