| 199 | } |
| 200 | |
| 201 | bool KittyTraceMgr::step(int steps) const |
| 202 | { |
| 203 | if (!_attached || _pid <= 0) |
| 204 | return false; |
| 205 | |
| 206 | int status = 0; |
| 207 | for (int i = 0; i < steps; ++i) |
| 208 | { |
| 209 | errno = 0; |
| 210 | if (ptrace(PTRACE_SINGLESTEP, _pid, nullptr, nullptr) == -1L) |
| 211 | { |
| 212 | KITTY_LOGE("PTRACE_SINGLESTEP failed for pid %d. \"%s\".", _pid, strerror(errno)); |
| 213 | return false; |
| 214 | } |
| 215 | |
| 216 | if ((i + 1) < steps) |
| 217 | { |
| 218 | waitpid(_pid, &status, 0); |
| 219 | if (!WIFSTOPPED(status)) |
| 220 | return false; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | return true; |
| 225 | } |
| 226 | |
| 227 | bool KittyTraceMgr::waitStep(int steps) const |
| 228 | { |
nothing calls this directly
no outgoing calls
no test coverage detected