mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
ptrace: print PID in error messages
We want to know which process can not be handled. Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
cb9b6de396
commit
e7c05c5eba
3 changed files with 11 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue