Lines Matching refs:pid

66     rslt = ptrace(PTRACE_PEEKDATA, ph->pid, aligned_addr, 0);
82 rslt = ptrace(PTRACE_PEEKDATA, ph->pid, aligned_addr, 0);
95 rslt = ptrace(PTRACE_PEEKDATA, ph->pid, aligned_addr, 0);
113 static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct user_regs_struct *user) {
114 // we have already attached to all thread 'pid's, just use ptrace call
120 #define ptrace_getregs(request, pid, addr, data) ptrace(request, pid, addr, data)
122 #define ptrace_getregs(request, pid, addr, data) ptrace(request, pid, data, addr)
134 if (ptrace_getregs(PTRACE_GETREGS_REQ, pid, user, NULL) < 0) {
135 print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid);
146 static bool ptrace_continue(pid_t pid, int signal) {
148 if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) {
149 print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
157 static bool ptrace_waitpid(pid_t pid) {
162 ret = waitpid(pid, &status, 0);
165 ret = waitpid(pid, &status, __WALL);
176 if (!ptrace_continue(pid, WSTOPSIG(status))) {
190 print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
204 // attach to a process/thread specified by "pid"
205 static bool ptrace_attach(pid_t pid) {
206 if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) < 0) {
207 print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
210 return ptrace_waitpid(pid);
267 sprintf(fname, "/proc/%d/maps", ph->pid);
270 print_debug("can't open /proc/%d/maps file\n", ph->pid);
298 // detach a given pid
299 static bool ptrace_detach(pid_t pid) {
300 if (pid && ptrace(PTRACE_DETACH, pid, NULL, NULL) < 0) {
301 print_debug("ptrace(PTRACE_DETACH, ..) failed for %d\n", pid);
329 struct ps_prochandle* Pgrab(pid_t pid) {
338 if (ptrace_attach(pid) != true) {
344 ph->pid = pid;
361 if (ph->pid != thr->lwp_id && ptrace_attach(thr->lwp_id) != true) {