Trivial tweaks to error messages
* strace.c (test_ptrace_setoptions_followfork): Use kill_save_errno
instead of kill.
(trace): Use perror_msg instead of perror.
* count.c (set_sortby): Use error_msg_and_die instead of fprintf.
* syscall.c (qualify): Likewise.
* util.c (ptrace_restart): Expand error message.
(umoven): Likewise.
(umovestr): Likewise.
(upeek): Use perror_msg instead of sprintf + perror.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/util.c b/util.c
index 640f246..a7cb19c 100644
--- a/util.c
+++ b/util.c
@@ -219,7 +219,7 @@
if (op == PTRACE_LISTEN)
msg = "LISTEN";
#endif
- perror_msg("ptrace(PTRACE_%s,1,%d)", msg, sig);
+ perror_msg("ptrace(PTRACE_%s,pid:%d,1,sig:%d)", msg, tcp->pid, sig);
return -1;
}
@@ -851,7 +851,7 @@
if (errno) {
/* But if not started, we had a bogus address. */
if (addr != 0 && errno != EIO && errno != ESRCH)
- perror("ptrace: umoven");
+ perror_msg("umoven: PTRACE_PEEKDATA pid:%d @0x%lx", pid, addr);
return -1;
}
started = 1;
@@ -868,7 +868,7 @@
return 0;
}
if (addr != 0 && errno != EIO && errno != ESRCH)
- perror("ptrace: umoven");
+ perror_msg("umoven: PTRACE_PEEKDATA pid:%d @0x%lx", pid, addr);
return -1;
}
started = 1;
@@ -966,7 +966,7 @@
u.val = ptrace(PTRACE_PEEKDATA, pid, (char *)addr, 0);
if (errno) {
if (addr != 0 && errno != EIO && errno != ESRCH)
- perror("umovestr");
+ perror_msg("umovestr: PTRACE_PEEKDATA pid:%d @0x%lx", pid, addr);
return -1;
}
started = 1;
@@ -986,7 +986,7 @@
return 0;
}
if (addr != 0 && errno != EIO && errno != ESRCH)
- perror("umovestr");
+ perror_msg("umovestr: PTRACE_PEEKDATA pid:%d @0x%lx", pid, addr);
return -1;
}
started = 1;
@@ -1014,9 +1014,7 @@
val = do_ptrace(PTRACE_PEEKUSER, tcp, (char *) off, 0);
if (val == -1 && errno) {
if (errno != ESRCH) {
- char buf[60];
- sprintf(buf, "upeek: ptrace(PTRACE_PEEKUSER,%d,%lu,0)", tcp->pid, off);
- perror(buf);
+ perror_msg("upeek: PTRACE_PEEKUSER pid:%d @0x%lx)", tcp->pid, off);
}
return -1;
}