DebugServer2
Loading...
Searching...
No Matches
DummySessionDelegateImpl.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/GDBRemote/SessionDelegate.h"
14
15#include <unordered_map>
16
17namespace ds2 {
18namespace GDBRemote {
19
21protected:
23
24protected: // General Information
25 size_t getGPRSize() const override;
26
27protected: // Common
28 ErrorCode onEnableExtendedMode(Session &session) override;
29 ErrorCode onSetBaudRate(Session &session, uint32_t speed) override;
30 ErrorCode onToggleDebugFlag(Session &session) override;
31
32 ErrorCode onSetMaxPacketSize(Session &session, size_t size) override;
33 ErrorCode onSetMaxPayloadSize(Session &session, size_t size) override;
34
35 ErrorCode onSetLogging(Session &session, std::string const &mode,
36 std::string const &filename,
37 StringCollection const &flags) override;
38 ErrorCode onSendInput(Session &session, ByteVector const &buf) override;
39
40 ErrorCode
41 onAllowOperations(Session &session,
42 std::map<std::string, bool> const &operations) override;
43 ErrorCode onQuerySupported(Session &session,
44 Feature::Collection const &remoteFeatures,
45 Feature::Collection &localFeatures) const override;
46
47 ErrorCode onExecuteCommand(Session &session,
48 std::string const &command) override;
49
50 ErrorCode onQueryServerVersion(Session &session,
51 ServerVersion &version) const override;
52 ErrorCode onQueryHostInfo(Session &session, HostInfo &info) const override;
53 ErrorCode onQueryFileLoadAddress(Session &session,
54 std::string const &file_path,
55 Address &address) override;
56
57protected: // Debugging Session
58 ErrorCode onEnableControlAgent(Session &session, bool enable) override;
59 ErrorCode onNonStopMode(Session &session, bool enable) override;
60 ErrorCode onEnableBTSTracing(Session &session, bool enable) override;
61
62 ErrorCode onPassSignals(Session &session,
63 std::vector<int> const &signals) override;
64 ErrorCode onProgramSignals(Session &session,
65 std::vector<int> const &signals) override;
66
67 ErrorCode onQuerySymbol(Session &session, std::string const &name,
68 std::string const &value,
69 std::string &next) const override;
70
71 ErrorCode onQueryRegisterInfo(Session &session, uint32_t regno,
72 RegisterInfo &info) const override;
73
74 ErrorCode onAttach(Session &session, ProcessId pid, AttachMode mode,
75 StopInfo &stop) override;
76 ErrorCode onAttach(Session &session, std::string const &name, AttachMode mode,
77 StopInfo &stop) override;
78 ErrorCode onRunAttach(Session &session, std::string const &filename,
79 StringCollection const &arguments,
80 StopInfo &stop) override;
81 ErrorCode onDetach(Session &session, ProcessId pid, bool stopped) override;
82 ErrorCode onQueryAttached(Session &session, ProcessId pid,
83 bool &attachedProcess) const override;
84 ErrorCode onQueryProcessInfo(Session &session,
85 ProcessInfo &info) const override;
86
87 ErrorCode onQueryHardwareWatchpointCount(Session &session,
88 size_t &count) const override;
89
90 ErrorCode onQuerySectionOffsets(Session &session, Address &text,
91 Address &data,
92 bool &isSegment) const override;
93 ErrorCode onQuerySharedLibrariesInfoAddress(Session &session,
94 Address &address) const override;
95 ErrorCode onQuerySharedLibraryInfo(Session &session, std::string const &path,
96 std::string const &triple,
97 SharedLibraryInfo &info) const override;
98 ErrorCode onQueryModuleInfo(Session &session, std::string &path,
99 std::string &triple,
100 ModuleInfo &info) const override;
101
102 ErrorCode onRestart(Session &session, ProcessId pid) override;
103 ErrorCode onInterrupt(Session &session) override;
104 ErrorCode onTerminate(Session &session, ProcessThreadId const &ptid,
105 StopInfo &stop) override;
106 ErrorCode onExitServer(Session &session) override;
107
108 ErrorCode onSynchronizeThreadState(Session &session, ProcessId pid) override;
109
110 //
111 // If lastTid is kAllThreadId, it's the first request; if it's kAnyThreadId
112 // the next of the previous request, in any other case the thread next to
113 // the one specified.
114 //
115 ErrorCode onQueryThreadList(Session &session, ProcessId pid, ThreadId lastTid,
116 ThreadId &tid) const override;
117
118 ErrorCode onQueryThreadStopInfo(Session &session, ProcessThreadId const &ptid,
119 StopInfo &stop) const override;
120
121 ErrorCode onQueryCurrentThread(Session &session,
122 ProcessThreadId &ptid) const override;
123 ErrorCode onThreadIsAlive(Session &session,
124 ProcessThreadId const &ptid) override;
125 ErrorCode onQueryThreadInfo(Session &session, ProcessThreadId const &ptid,
126 uint32_t mode, void *info) const override;
127
128 ErrorCode onQueryTLSAddress(Session &session, ProcessThreadId const &ptid,
129 Address const &offset, Address const &linkMap,
130 Address &address) const override;
131 ErrorCode onQueryTIBAddress(Session &session, ProcessThreadId const &ptid,
132 Address &address) const override;
133
134 ErrorCode onEnableAsynchronousProfiling(Session &session,
135 ProcessThreadId const &ptid,
136 bool enabled, uint32_t interval,
137 uint32_t scanType) override;
138 ErrorCode onQueryProfileData(Session &session, ProcessThreadId const &ptid,
139 uint32_t scanType, void *data) const override;
140
141 ErrorCode onResume(Session &session,
142 ThreadResumeAction::Collection const &actions,
143 StopInfo &stop) override;
144
145 ErrorCode
146 onReadGeneralRegisters(Session &session, ProcessThreadId const &ptid,
147 Architecture::GPRegisterValueVector &regs) override;
148 ErrorCode onWriteGeneralRegisters(Session &session,
149 ProcessThreadId const &ptid,
150 std::vector<uint64_t> const &regs) override;
151
152 ErrorCode onSaveRegisters(Session &session, ProcessThreadId const &ptid,
153 uint64_t &id) override;
154 ErrorCode onRestoreRegisters(Session &session, ProcessThreadId const &ptid,
155 uint64_t id) override;
156
157 ErrorCode onReadRegisterValue(Session &session, ProcessThreadId const &ptid,
158 uint32_t regno, std::string &value) override;
159 ErrorCode onWriteRegisterValue(Session &session, ProcessThreadId const &ptid,
160 uint32_t regno,
161 std::string const &value) override;
162
163 ErrorCode onReadMemory(Session &session, Address const &address,
164 size_t length, ByteVector &data) override;
165 ErrorCode onWriteMemory(Session &session, Address const &address,
166 ByteVector const &data, size_t &nwritten) override;
167
168 ErrorCode onAllocateMemory(Session &session, size_t size,
169 uint32_t permissions, Address &address) override;
170 ErrorCode onDeallocateMemory(Session &session,
171 Address const &address) override;
172 ErrorCode onQueryMemoryRegionInfo(Session &session, Address const &address,
173 MemoryRegionInfo &info) const override;
174
175 ErrorCode onComputeCRC(Session &session, Address const &address,
176 size_t length, uint32_t &crc) override;
177
178 ErrorCode onSearch(Session &session, Address const &address,
179 std::string const &pattern, Address &location) override;
180 ErrorCode onSearchBackward(Session &session, Address const &address,
181 uint32_t pattern, uint32_t mask,
182 Address &location) override;
183
184 ErrorCode onInsertBreakpoint(Session &session, BreakpointType type,
185 Address const &address, uint32_t kind,
186 StringCollection const &conditions,
187 StringCollection const &commands,
188 bool persistentCommands) override;
189 ErrorCode onRemoveBreakpoint(Session &session, BreakpointType type,
190 Address const &address, uint32_t kind) override;
191
192 ErrorCode onXferRead(Session &session, std::string const &object,
193 std::string const &annex, uint64_t offset,
194 uint64_t length, std::string &buffer,
195 bool &last) override;
196 ErrorCode onXferWrite(Session &session, std::string const &object,
197 std::string const &annex, uint64_t offset,
198 std::string const &buffer, size_t &nwritten) override;
199 ErrorCode fetchStopInfoForAllThreads(Session &session,
200 std::vector<StopInfo> &stops,
201 StopInfo &processStop) override;
202 ErrorCode createThreadsStopInfo(Session &session,
203 JSArray &threadsStopInfo) override;
204
205protected: // Platform Session
206 ErrorCode onDisableASLR(Session &session, bool disable) override;
207
208 ErrorCode onSetEnvironmentVariable(Session &session, std::string const &name,
209 std::string const &value) override;
210 ErrorCode onSetWorkingDirectory(Session &session,
211 std::string const &path) override;
212 ErrorCode onSetStdFile(Session &session, int fileno,
213 std::string const &path) override;
214
215 ErrorCode onSetArchitecture(Session &session,
216 std::string const &architecture) override;
217
218 ErrorCode onSetProgramArguments(Session &session,
219 StringCollection const &args) override;
220
221 ErrorCode onExecuteProgram(Session &session, std::string const &command,
222 uint32_t timeout,
223 std::string const &workingDirectory,
224 ProgramResult &result) override;
225
226 ErrorCode onFileCreateDirectory(Session &session, std::string const &path,
227 uint32_t mode) override;
228
229 ErrorCode onFileOpen(Session &session, std::string const &path,
230 OpenFlags flags, uint32_t mode, int &fd) override;
231 ErrorCode onFileClose(Session &session, int fd) override;
232 ErrorCode onFileRead(Session &session, int fd, uint64_t &count,
233 uint64_t offset, ByteVector &buffer) override;
234 ErrorCode onFileWrite(Session &session, int fd, uint64_t offset,
235 ByteVector const &buffer, uint64_t &nwritten) override;
236
237 ErrorCode onFileRemove(Session &session, std::string const &path) override;
238 ErrorCode onFileReadLink(Session &session, std::string const &path,
239 std::string &resolved) override;
240 ErrorCode onFileSetPermissions(Session &session, std::string const &path,
241 uint32_t mode) override;
242
243 ErrorCode onFileExists(Session &session, std::string const &path) override;
244 ErrorCode onFileComputeMD5(Session &session, std::string const &path,
245 uint8_t digest[16]) override;
246 ErrorCode onFileGetSize(Session &session, std::string const &path,
247 uint64_t &size) override;
248 ErrorCode onFileGetMode(Session &session, std::string const &path,
249 uint32_t &mode) const override;
250 ErrorCode onFileFstat(Session &session, int fd,
251 ByteVector &buffer) const override;
252
253 ErrorCode onQueryProcessList(Session &session, ProcessInfoMatch const &match,
254 bool first, ProcessInfo &info) const override;
255 ErrorCode onQueryProcessInfoPID(Session &session, ProcessId pid,
256 ProcessInfo &info) const override;
257
258 ErrorCode onLaunchDebugServer(Session &session, std::string const &host,
259 uint16_t &port, ProcessId &pid) override;
260
261 ErrorCode onQueryLaunchSuccess(Session &session,
262 ProcessId pid) const override;
263
264 ErrorCode onQueryUserName(Session &session, UserId const &uid,
265 std::string &name) const override;
266 ErrorCode onQueryGroupName(Session &session, GroupId const &gid,
267 std::string &name) const override;
268 ErrorCode onQueryWorkingDirectory(Session &session,
269 std::string &workingDir) const override;
270
271protected: // System Session
272 ErrorCode onReset(Session &session) override;
273 ErrorCode onFlashErase(Session &session, Address const &address,
274 size_t length) override;
275 ErrorCode onFlashWrite(Session &session, Address const &address,
276 ByteVector const &data) override;
277 ErrorCode onFlashDone(Session &session) override;
278};
279} // namespace GDBRemote
280} // namespace ds2
Definition Types.h:95
Definition DummySessionDelegateImpl.h:20
Definition SessionDelegate.h:20
Definition Session.h:22
Definition Types.h:171
Definition Types.h:34
Definition Types.h:179
Definition Types.h:185
Definition Types.h:23
Definition Types.h:204
Definition Types.h:123
Definition Types.h:192
Definition Types.h:38
Definition Types.h:397