33 virtual ErrorCode wait(
ProcessThreadId const &ptid,
int *status =
nullptr);
36 virtual ErrorCode traceMe(
bool disableASLR);
37 virtual ErrorCode traceThat(ProcessId pid) = 0;
40 virtual ErrorCode attach(ProcessId pid);
41 virtual ErrorCode detach(ProcessId pid);
48 Address const &address, std::string &str,
49 size_t length,
size_t *nread =
nullptr) = 0;
51 Address const &address,
void *buffer,
52 size_t length,
size_t *nread =
nullptr) = 0;
54 Address const &address,
void const *buffer,
55 size_t length,
size_t *nwritten =
nullptr) = 0;
60 Architecture::CPUState &state) = 0;
63 Architecture::CPUState
const &state) = 0;
69 ErrorCode doStepResume(
bool stepping,
ProcessThreadId const &ptid,
int signal,
80 virtual ErrorCode getSigInfo(
ProcessThreadId const &ptid, siginfo_t &si) = 0;
85 size_t length, uint64_t &result);
88#if defined(ARCH_ARM) || defined(ARCH_ARM64)
100 uint32_t addr, uint32_t ctrl,
103 uint32_t addr, uint32_t ctrl,
109 template <
typename CommandType,
typename AddrType,
typename DataType>
110 long wrapPtrace(CommandType request, pid_t pid, AddrType addr, DataType data,
114#if defined(HAVE_ENUM_PTRACE_REQUEST)
115 typedef enum __ptrace_request PTraceRequestType;
117 typedef int PTraceRequestType;
119 typedef void *PTraceAddrType;
120 typedef void *PTraceDataType;
121#elif defined(OS_FREEBSD) || defined(OS_DARWIN)
122 typedef int PTraceRequestType;
123 typedef caddr_t PTraceAddrType;
124 typedef int PTraceDataType;
127 decltype(ptrace((PTraceRequestType)0, 0, 0, 0)) ret = 0;
134 DS2LOG(Warning,
"ptrace command %s on pid %d returned %s, retrying",
135 Stringify::PTraceCommand(request), pid, Stringify::Errno(errno));
143 ret = ::ptrace(
static_cast<PTraceRequestType
>(request), pid,
144 (PTraceAddrType)(uintptr_t)addr,
145 (PTraceDataType)(uintptr_t)data);
146 }
while (ret < 0 && (errno == EAGAIN || errno == EBUSY) && retries > 0);
149 DS2LOG(Debug,
"ran ptrace command %s on pid %d, returned %s",
150 Stringify::PTraceCommand(request), pid, Stringify::Errno(errno));