Esempio n. 1
0
File: PTrace.cpp Progetto: sas/ds2
ErrorCode PTrace::writeRegisterSet(ProcessThreadId const &ptid, int regSetCode,
                                   void const *buffer, size_t length) {
  struct iovec iov = {const_cast<void *>(buffer), length};

  if (wrapPtrace(PTRACE_SETREGSET, ptid.validTid() ? ptid.tid : ptid.pid,
                 regSetCode, &iov) < 0)
    return Platform::TranslateError();

  return kSuccess;
}
Esempio n. 2
0
File: PTrace.cpp Progetto: sas/ds2
ErrorCode PTrace::readRegisterSet(ProcessThreadId const &ptid, int regSetCode,
                                  void *buffer, size_t length) {
  struct iovec iov = {buffer, length};

  if (wrapPtrace(PTRACE_GETREGSET, ptid.validTid() ? ptid.tid : ptid.pid,
                 regSetCode, &iov) < 0)
    return Platform::TranslateError();

  // On return, the kernel modifies iov.len to return the number of bytes read.
  // This should be exactly equal to the number of bytes requested.
  DS2ASSERT(iov.iov_len == length);

  return kSuccess;
}