| 248 | } |
| 249 | |
| 250 | bool KittyTraceMgr::getRegs(user_regs_struct *regs) const |
| 251 | { |
| 252 | if (!_attached || _pid <= 0 || !regs) |
| 253 | return false; |
| 254 | |
| 255 | errno = 0; |
| 256 | |
| 257 | #if defined(__LP64__) |
| 258 | iovec ioVec; |
| 259 | ioVec.iov_base = regs; |
| 260 | ioVec.iov_len = sizeof(*regs); |
| 261 | long ret = ptrace(KT_PTRACE_GETREG_REQ, _pid, NT_PRSTATUS, &ioVec); |
| 262 | #else |
| 263 | long ret = ptrace(KT_PTRACE_GETREG_REQ, _pid, nullptr, regs); |
| 264 | #endif |
| 265 | if (ret == -1L) |
| 266 | { |
| 267 | KITTY_LOGE("PTRACE_GETREGS failed for pid %d. \"%s\".", _pid, strerror(errno)); |
| 268 | return false; |
| 269 | } |
| 270 | |
| 271 | return true; |
| 272 | } |
| 273 | |
| 274 | bool KittyTraceMgr::setRegs(user_regs_struct *regs) const |
| 275 | { |
nothing calls this directly
no outgoing calls
no test coverage detected