Commit e7c05c5e authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

ptrace: print PID in error messages

We want to know which process can not be handled.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent cb9b6de3
......@@ -527,7 +527,7 @@ int ptrace_set_breakpoint(pid_t pid, void *addr)
if (ptrace(PTRACE_POKEUSER, pid,
offsetof(struct user, u_debugreg[DR_FIRSTADDR]),
addr)) {
pr_err("Unable to setup a breakpoint\n");
pr_perror("Unable to setup a breakpoint into %d", pid);
return -1;
}
......@@ -535,13 +535,13 @@ int ptrace_set_breakpoint(pid_t pid, void *addr)
if (ptrace(PTRACE_POKEUSER, pid,
offsetof(struct user, u_debugreg[DR_CONTROL]),
X86_DR_LOCAL_ENABLE(DR_FIRSTADDR))) {
pr_err("Unable to enable the breakpoint\n");
pr_perror("Unable to enable the breakpoint for %d", pid);
return -1;
}
ret = ptrace(PTRACE_CONT, pid, NULL, NULL);
if (ret) {
pr_perror("Unable to restart the stopped tracee process");
pr_perror("Unable to restart the stopped tracee process %d", pid);
return -1;
}
......@@ -554,7 +554,7 @@ int ptrace_flush_breakpoints(pid_t pid)
if (ptrace(PTRACE_POKEUSER, pid,
offsetof(struct user, u_debugreg[DR_CONTROL]),
0)) {
pr_err("Unable to disable the breakpoint\n");
pr_perror("Unable to disable the breakpoint for %d", pid);
return -1;
}
......
......@@ -1123,8 +1123,11 @@ static inline int fork_with_pid(struct pstree_item *item)
}
if (item == root_item)
if (item == root_item) {
item->pid.real = ret;
pr_debug("PID: real %d virt %d\n",
item->pid.real, item->pid.virt);
}
if (opts.pidfile && root_item == item) {
int pid;
......@@ -1606,13 +1609,13 @@ static int attach_to_tasks(bool root_seized, enum trace_flags *flag)
* and SYSCALL below work.
*/
if (ptrace(PTRACE_INTERRUPT, pid, 0, 0)) {
pr_perror("Can't interrupt task");
pr_perror("Can't interrupt the %d task", pid);
return -1;
}
}
if (wait4(pid, &status, __WALL, NULL) != pid) {
pr_perror("waitpid() failed");
pr_perror("waitpid(%d) failed", pid);
return -1;
}
......
......@@ -1271,7 +1271,7 @@ int ptrace_stop_pie(pid_t pid, void *addr, enum trace_flags *tf)
*/
ret = ptrace(PTRACE_SYSCALL, pid, NULL, NULL);
if (ret) {
pr_perror("ptrace");
pr_perror("Unable to restart the %d process", pid);
return -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment