• Home
  • Raw
  • Download

Lines Matching refs:pid

457 Bool waitstopped (int pid, int signal_expected, char *msg)  in waitstopped()  argument
467 p = waitpid(pid, &status, __WALL); in waitstopped()
468 DEBUG(1, "after waitpid pid %d p %d status 0x%x %s\n", pid, p, in waitstopped()
470 if (p != pid) { in waitstopped()
472 msg, pid, p, status, status_image (status)); in waitstopped()
489 res = ptrace (PTRACE_CONT, pid, NULL, signal_received); in waitstopped()
503 Bool stop (int pid, char *msg) in stop() argument
507 DEBUG(1, "%s SIGSTOP pid %d\n", msg, pid); in stop()
508 res = kill (pid, SIGSTOP); in stop()
510 ERROR(errno, "%s SIGSTOP pid %d %ld\n", msg, pid, res); in stop()
514 return waitstopped (pid, SIGSTOP, msg); in stop()
522 Bool attach (int pid, char *msg) in attach() argument
532 DEBUG(1, "%s PTRACE_ATTACH pid %d\n", msg, pid); in attach()
533 res = ptrace (PTRACE_ATTACH, pid, NULL, NULL); in attach()
536 ERROR(errno, "%s PTRACE_ATTACH pid %d %ld\n", msg, pid, res); in attach()
545 return waitstopped(pid, SIGSTOP, msg); in attach()
552 Bool acquire_and_suspend_threads(int pid) in acquire_and_suspend_threads() argument
581 rw = ptrace_read_memory(pid, vgt+off_status, in acquire_and_suspend_threads()
589 rw = ptrace_read_memory(pid, vgt+off_lwpid, in acquire_and_suspend_threads()
617 if (vgdb_threads[i].lwpid == pid) { in acquire_and_suspend_threads()
639 void detach_from_all_threads(int pid) in detach_from_all_threads() argument
654 if (vgdb_threads[i].lwpid == pid) { in detach_from_all_threads()
672 if (!pid_found && pid) { in detach_from_all_threads()
675 DEBUG(1, "no thread live => PTRACE_DETACH pid %d\n", pid); in detach_from_all_threads()
676 res = ptrace (PTRACE_DETACH, pid, NULL, NULL); in detach_from_all_threads()
678 ERROR(errno, "PTRACE_DETACH pid %d res %ld\n", pid, res); in detach_from_all_threads()
702 Bool getregs (int pid, void *regs, long regs_bsz) in getregs() argument
710 res = ptrace (PTRACE_GETREGS, pid, NULL, regs); in getregs()
753 *(long *)(pregs+offset) = ptrace(PTRACE_PEEKUSER, pid, offset, NULL); in getregs()
771 Bool setregs (int pid, void *regs, long regs_bsz) in setregs() argument
783 res = ptrace (PTRACE_SETREGS, pid, NULL, regs); in setregs()
805 res = ptrace(PTRACE_POKEUSER, pid, offset, *(long*)(pregs+offset)); in setregs()
821 void restore_and_detach(int pid) in restore_and_detach() argument
841 detach_from_all_threads(pid); in restore_and_detach()
850 Bool invoke_gdbserver (int pid) in invoke_gdbserver() argument
873 DEBUG(1, "attach to 'main' pid %d\n", pid); in invoke_gdbserver()
874 if (!attach(pid, "attach main pid")) { in invoke_gdbserver()
877 ERROR(0, "error attach main pid %d\n", pid); in invoke_gdbserver()
885 if (!acquire_and_suspend_threads(pid)) { in invoke_gdbserver()
886 detach_from_all_threads(pid); in invoke_gdbserver()
888 if (kill(pid, 0) != 0) in invoke_gdbserver()
890 pid); in invoke_gdbserver()
894 if (!getregs(pid, &user_mod.regs, sizeof(user_mod.regs))) { in invoke_gdbserver()
895 detach_from_all_threads(pid); in invoke_gdbserver()
938 rw = ptrace_write_memory(pid, sp, in invoke_gdbserver()
943 detach_from_all_threads(pid); in invoke_gdbserver()
951 rw = ptrace_write_memory(pid, sp, in invoke_gdbserver()
956 detach_from_all_threads(pid); in invoke_gdbserver()
1013 rw = ptrace_write_memory(pid, sp, in invoke_gdbserver()
1018 detach_from_all_threads(pid); in invoke_gdbserver()
1036 rw = ptrace_read_memory(pid, shared64->invoke_gdbserver, in invoke_gdbserver()
1041 detach_from_all_threads(pid); in invoke_gdbserver()
1044 rw = ptrace_read_memory(pid, shared64->invoke_gdbserver+8, in invoke_gdbserver()
1049 detach_from_all_threads(pid); in invoke_gdbserver()
1081 if (!setregs(pid, &user_mod.regs, sizeof(user_mod.regs))) { in invoke_gdbserver()
1082 detach_from_all_threads(pid); in invoke_gdbserver()
1088 pid_of_save_regs = pid; in invoke_gdbserver()
1100 res = ptrace (PTRACE_CONT, pid, NULL, NULL); in invoke_gdbserver()
1103 restore_and_detach(pid); in invoke_gdbserver()
1108 stopped = waitstopped (pid, SIGSTOP, in invoke_gdbserver()
1113 restore_and_detach(pid); in invoke_gdbserver()
1149 int pid = *(int *)v_pid; in invoke_gdbserver_in_valgrind() local
1210 if (kill(pid, 0) != 0) in invoke_gdbserver_in_valgrind()
1213 "check for pid %d existence failed\n", pid); in invoke_gdbserver_in_valgrind()
1218 pid, cmd_time_out); in invoke_gdbserver_in_valgrind()
1225 if (invoke_gdbserver(pid)) { in invoke_gdbserver_in_valgrind()
1447 void prepare_fifos_and_shared_mem(int pid) in prepare_fifos_and_shared_mem() argument
1466 pid, user, host); in prepare_fifos_and_shared_mem()
1468 pid, user, host); in prepare_fifos_and_shared_mem()
1470 pid, user, host); in prepare_fifos_and_shared_mem()
1750 void gdb_relay (int pid) in gdb_relay() argument
1756 fprintf (stderr, "relaying data between gdb and process %d\n", pid); in gdb_relay()
1761 invoke_gdbserver_in_valgrind, (void *) &pid); in gdb_relay()
1763 acquire_lock (shared_mem_fd, pid); in gdb_relay()
1865 void standalone_send_commands(int pid, in standalone_send_commands() argument
1884 invoke_gdbserver_in_valgrind, (void *) &pid); in standalone_send_commands()
1887 acquire_lock (shared_mem_fd, pid); in standalone_send_commands()
1899 fprintf (stderr, "sending command %s to pid %d\n", commands[nc], pid); in standalone_send_commands()
1980 void report_pid (int pid, Bool on_stdout) in report_pid() argument
1987 sprintf(cmdline_file, "/proc/%d/cmdline", pid); in report_pid()
2001 fprintf((on_stdout ? stdout : stderr), "use --pid=%d for %s\n", pid, cmdline); in report_pid()
2095 int pid = -1; in search_arg_pid() local
2176 pid = newpid; in search_arg_pid()
2179 pid = newpid; in search_arg_pid()
2187 report_pid (pid, /*on_stdout*/ False); in search_arg_pid()
2189 pid = -2; in search_arg_pid()
2192 pid = newpid; in search_arg_pid()
2204 if (pid != -1) in search_arg_pid()
2214 } else if (pid == -1) { in search_arg_pid()
2222 else if (pid == -2) { in search_arg_pid()
2227 return pid; in search_arg_pid()
2418 int pid; in main() local
2444 pid = search_arg_pid (arg_pid, check_trials, show_list); in main()
2446 prepare_fifos_and_shared_mem(pid); in main()
2465 standalone_send_commands(pid, last_command, commands); in main()
2467 gdb_relay(pid); in main()