Lines Matching defs:pid

56    arguments are given or only --pid and --vgdb-prefix, then usage 1 is
217 int pid = *(int *)v_pid;
277 /* if the pid does not exist anymore, we better stop */
278 if (kill(pid, 0) != 0)
281 "check for pid %d existence failed\n", pid);
285 "pid %d did not handle a command in %d seconds\n",
286 pid, cmd_time_out);
292 if (invoker_invoke_gdbserver(pid)) {
340 "Probably vgdb pid %d already speaks with Valgrind pid %d\n",
349 /* We indicate our pid to Valgrind gdbserver */
425 static char *from_gdb_to_pid; /* fifo name to write gdb command to pid */
428 to_pid is the file descriptor to write to the process pid. */
449 static char *to_gdb_from_pid; /* fifo name to read pid replies */
452 from_pid is the file descriptor to read data from the process pid. */
459 nrread = read_buf(from_pid, buf, "from pid");
462 DEBUG(1, "read 0 bytes from pid => assume exit\n");
464 DEBUG(1, "error reading bytes from pid\n");
512 void prepare_fifos_and_shared_mem(int pid)
531 pid, user, host);
533 pid, user, host);
535 pid, user, host);
763 /* We first close the connection to pid. The pid will then
764 terminates its gdbserver work. We keep the from pid
817 void gdb_relay (int pid)
819 int from_pid = -1; /* fd to read from pid */
820 int to_pid = -1; /* fd to write to pid */
823 fprintf (stderr, "relaying data between gdb and process %d\n", pid);
828 invoke_gdbserver_in_valgrind, (void *) &pid);
829 to_pid = open_fifo(from_gdb_to_pid, O_WRONLY, "write to pid");
830 acquire_lock (shared_mem_fd, pid);
833 "read mode from pid");
850 /* watch data written by pid, watch POLLERR on both pid fd */
932 void standalone_send_commands(int pid,
936 int from_pid = -1; /* fd to read from pid */
937 int to_pid = -1; /* fd to write to pid */
951 invoke_gdbserver_in_valgrind, (void *) &pid);
953 to_pid = open_fifo(from_gdb_to_pid, O_WRONLY, "write to pid");
954 acquire_lock (shared_mem_fd, pid);
956 /* first send a C-c \003 to pid, so that it wakes up the process
957 After that, we can open the fifo from the pid in read mode
963 "read cmd result from pid");
966 fprintf (stderr, "sending command %s to pid %d\n", commands[nc], pid);
986 "writing hex command to pid", /* notify */ True);
1046 with given pid */
1048 void report_pid (int pid, Bool on_stdout)
1055 sprintf(cmdline_file, "/proc/%d/cmdline", pid);
1075 fprintf((on_stdout ? stdout : stderr), "use --pid=%d for %s\n", pid, cmdline);
1091 " OPTIONS are [--pid=<number>] [--vgdb-prefix=<prefix>]\n"
1096 " --pid arg must be given if multiple Valgrind gdbservers are found.\n"
1123 a valgrind pid appearing.
1128 Returns the pid to work with
1129 or exits in case of error (e.g. no pid found corresponding to arg_pid */
1135 int pid = -1;
1138 fprintf (stderr, "vgdb error: invalid pid %d given\n", arg_pid);
1142 If we have been given a pid, we will check that the matching FIFO is
1144 If no pid has been given, then if we find only one FIFO,
1145 we will use this to build the pid to use.
1153 const char *suffix = "-from-vgdb-to-"; /* followed by pid */
1170 DEBUG(1, "searching pid in directory %s format %s\n",
1173 /* try to find FIFOs with valid pid.
1174 On exit of the loop, pid is set to:
1175 the last pid found if show_list (or -1 if no process was listed)
1178 otherwise it is set to the (only) pid found that can be debugged
1217 pid = newpid;
1220 pid = newpid;
1226 "no --pid= arg given"
1228 report_pid (pid, /*on_stdout*/ False);
1230 pid = -2;
1233 pid = newpid;
1245 if (pid != -1)
1255 } else if (pid == -1) {
1257 fprintf (stderr, "vgdb error: no FIFO found and no pid given\n");
1259 fprintf (stderr, "vgdb error: no FIFO found matching pid %d\n",
1263 else if (pid == -2) {
1268 return pid;
1342 } else if (is_opt(argv[i], "--pid=")) {
1345 fprintf (stderr, "invalid --pid argument %s\n", argv[i]);
1348 fprintf (stderr, "multiple --pid arguments given\n");
1434 "Can't use both --pid and -l options\n");
1459 int pid;
1485 pid = search_arg_pid (arg_pid, check_trials, show_list);
1487 prepare_fifos_and_shared_mem(pid);
1497 "vgdb pid %d\n",
1506 standalone_send_commands(pid, last_command, commands);
1508 gdb_relay(pid);