refine tracing logic

This commit is contained in:
5ec1cff
2023-11-13 21:54:50 +08:00
parent 47a17d2079
commit c59a7887ca

View File

@@ -347,15 +347,18 @@ void wait_for_trace(int pid, int* status, int flags) {
while (true) { while (true) {
auto result = waitpid(pid, status, flags); auto result = waitpid(pid, status, flags);
if (result == -1) { if (result == -1) {
if (errno == EINTR) continue; if (errno == EINTR) {
} else { continue;
PLOGE("wait %d failed", pid); } else {
exit(1); PLOGE("wait %d failed", pid);
exit(1);
}
} }
if (!WIFSTOPPED(*status)) { if (!WIFSTOPPED(*status)) {
LOGE("process %d not stopped for trace: %s, exit", pid, parse_status(*status).c_str()); LOGE("process %d not stopped for trace: %s, exit", pid, parse_status(*status).c_str());
exit(1); exit(1);
} }
return;
} }
} }