| 104 | } |
| 105 | |
| 106 | bool KittyTraceMgr::stop() |
| 107 | { |
| 108 | if (!_attached || _pid <= 0) |
| 109 | return false; |
| 110 | |
| 111 | errno = 0; |
| 112 | |
| 113 | if (_seized) |
| 114 | { |
| 115 | if (ptrace(PTRACE_INTERRUPT, _pid, nullptr, nullptr) == -1L) |
| 116 | { |
| 117 | KITTY_LOGE("PTRACE_INTERRUPT failed for pid %d. \"%s\".", _pid, strerror(errno)); |
| 118 | return false; |
| 119 | } |
| 120 | } |
| 121 | else |
| 122 | { |
| 123 | if (tgkill(_pid, _pid, SIGSTOP) == -1) |
| 124 | { |
| 125 | KITTY_LOGE("tgkill failed for pid %d. \"%s\".", _pid, strerror(errno)); |
| 126 | return false; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | int status; |
| 131 | if (waitpid(_pid, &status, 0) != _pid || !WIFSTOPPED(status)) |
| 132 | { |
| 133 | KITTY_LOGE("Error occurred while waiting for pid %d to stop. \"%s\".", _pid, strerror(errno)); |
| 134 | return false; |
| 135 | } |
| 136 | |
| 137 | return true; |
| 138 | } |
| 139 | |
| 140 | bool KittyTraceMgr::cont(int sig) |
| 141 | { |
nothing calls this directly
no outgoing calls
no test coverage detected