* signal.c (sys_sigreturn): Use perror_msg instead of perror.
* strace.c (tprintf, tprints, detach, startup_attach): Likewise.
* syscall.c (get_scno): Likewise.
* util.c (umoven, umovestr): Likewise.
m_siginfo_t si;
sigset_t sigm;
if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) {
- perror("sigreturn: PTRACE_GETREGS");
+ perror_msg("%s", "sigreturn: PTRACE_GETREGS");
return 0;
}
i1 = regs.u_regs[U_REG_O1];
if (umove(tcp, i1, &si) < 0) {
- perror("sigreturn: umove");
+ perror_msg("%s", "sigreturn: umove");
return 0;
}
long_to_sigset(si.si_mask, &sigm);
m_siginfo_t si;
sigset_t sigm;
if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) {
- perror("sigreturn: PTRACE_GETREGS");
+ perror_msg("%s", "sigreturn: PTRACE_GETREGS");
return 0;
}
sp = regs.regs[29];
long regs[PT_MAX+1];
sigset_t sigm;
if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long)regs) < 0) {
- perror("sigreturn: PTRACE_GETREGS");
+ perror_msg("%s", "sigreturn: PTRACE_GETREGS");
return 0;
}
if (umove(tcp, regs[PT_USP], &sc) < 0)
int n = strace_vfprintf(current_tcp->outf, fmt, args);
if (n < 0) {
if (current_tcp->outf != stderr)
- perror(outfname == NULL
- ? "<writing to pipe>" : outfname);
+ perror_msg("%s", outfname);
} else
current_tcp->curcol += n;
}
return;
}
if (current_tcp->outf != stderr)
- perror(!outfname ? "<writing to pipe>" : outfname);
+ perror_msg("%s", outfname);
}
}
}
else if (errno != ESRCH) {
/* Shouldn't happen. */
- perror("detach: ptrace(PTRACE_DETACH, ...)");
+ perror_msg("%s", "detach: ptrace(PTRACE_DETACH, ...)");
}
else if (my_tkill(tcp->pid, 0) < 0) {
if (errno != ESRCH)
- perror("detach: checking sanity");
+ perror_msg("%s", "detach: checking sanity");
}
else if (!sigstop_expected && my_tkill(tcp->pid, SIGSTOP) < 0) {
if (errno != ESRCH)
- perror("detach: stopping child");
+ perror_msg("%s", "detach: stopping child");
}
else
sigstop_expected = 1;
if (errno == ECHILD) /* Already gone. */
break;
if (errno != EINVAL) {
- perror("detach: waiting");
+ perror_msg("%s", "detach: waiting");
break;
}
#endif /* __WALL */
/* No __WALL here. */
if (waitpid(tcp->pid, &status, 0) < 0) {
if (errno != ECHILD) {
- perror("detach: waiting");
+ perror_msg("%s", "detach: waiting");
break;
}
#ifdef __WCLONE
/* If no processes, try clones. */
if (waitpid(tcp->pid, &status, __WCLONE) < 0) {
if (errno != ECHILD)
- perror("detach: waiting");
+ perror_msg("%s", "detach: waiting");
break;
}
#endif /* __WCLONE */
}
ntid -= nerr;
if (ntid == 0) {
- perror("attach: ptrace(PTRACE_ATTACH, ...)");
+ perror_msg("%s", "attach: ptrace(PTRACE_ATTACH, ...)");
droptcb(tcp);
continue;
}
} /* if (opendir worked) */
} /* if (-f) */
if (ptrace_attach_or_seize(tcp->pid) < 0) {
- perror("attach: ptrace(PTRACE_ATTACH, ...)");
+ perror_msg("%s", "attach: ptrace(PTRACE_ATTACH, ...)");
droptcb(tcp);
continue;
}
errno = 0;
opcode = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)(pc-sizeof(long)), 0);
if (errno) {
- perror("peektext(pc-oneword)");
+ perror_msg("%s", "peektext(pc-oneword)");
return -1;
}
if (r < 0) {
if (errno == ENOSYS)
process_vm_readv_not_supported = 1;
- else if (errno != EINVAL && errno != ESRCH) /* EINVAL is seen if process is gone */
- /* strange... */
- perror("process_vm_readv");
+ else if (errno != EINVAL && errno != ESRCH)
+ /* EINVAL or ESRCH could be seen if process is gone,
+ * all the rest is strange and should be reported. */
+ perror_msg("%s", "process_vm_readv");
goto vm_readv_didnt_work;
}
return r;
if (r < 0) {
if (errno == ENOSYS)
process_vm_readv_not_supported = 1;
- else if (errno != EINVAL && errno != ESRCH) /* EINVAL is seen if process is gone */
- /* strange... */
- perror("process_vm_readv");
+ else if (errno != EINVAL && errno != ESRCH)
+ /* EINVAL or ESRCH could be seen
+ * if process is gone, all the rest
+ * is strange and should be reported. */
+ perror_msg("%s", "process_vm_readv");
goto vm_readv_didnt_work;
}
if (memchr(local[0].iov_base, '\0', r))