diff options
author | Pedro Alves <palves@redhat.com> | 2018-07-13 10:28:46 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2018-07-13 10:28:46 +0100 |
commit | ef2ddb33bd29a7c4f7027b9e37e55c74c15af825 (patch) | |
tree | 2f9d11da4ff51a4197b8537f1457c6ff22732f15 /gdb/gdbserver/spu-low.c | |
parent | Automatic date update in version.in (diff) | |
download | binutils-gdb-ef2ddb33bd29a7c4f7027b9e37e55c74c15af825.tar.gz binutils-gdb-ef2ddb33bd29a7c4f7027b9e37e55c74c15af825.tar.bz2 binutils-gdb-ef2ddb33bd29a7c4f7027b9e37e55c74c15af825.zip |
GDBserver: Pass process_info pointer to target_detach and target_join
We start from a process_info pointer, pass down process->pid, and then
the target_detach and target_join implementations need to find the
process from the pid again. Pass the process_info pointer down
directly instead.
gdb/gdbserver/ChangeLog:
2018-07-13 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_detach, linux_join): Change parameter to
process_info pointer instead of pid. Adjust.
* lynx-low.c (lynx_detach, lynx_join): Likewise.
* nto-low.c (nto_detach): Likewise.
* spu-low.c (spu_detach, spu_join): Likewise.
* win32-low.c (win32_detach, win32_join): Likewise.
* server.c (handle_detach, detach_or_kill_for_exit): Adjust.
* target.h (struct target_ops) <detach, join>: Change parameter to
process_info pointer instead of pid. Adjust all implementations
and callers.
(detach_inferior, join_inferior): Rename 'pid' parameter to
'proc'.
Diffstat (limited to 'gdb/gdbserver/spu-low.c')
-rw-r--r-- | gdb/gdbserver/spu-low.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c index e9fc6e7beb4..c2a8734f680 100644 --- a/gdb/gdbserver/spu-low.c +++ b/gdb/gdbserver/spu-low.c @@ -348,13 +348,9 @@ spu_kill (int pid) /* Detach from inferior process. */ static int -spu_detach (int pid) +spu_detach (process_info *process) { - struct process_info *process = find_process_pid (pid); - if (process == NULL) - return -1; - - ptrace (PTRACE_DETACH, pid, 0, 0); + ptrace (PTRACE_DETACH, process->pid, 0, 0); clear_inferiors (); remove_process (process); @@ -368,12 +364,12 @@ spu_mourn (struct process_info *process) } static void -spu_join (int pid) +spu_join (process_info *proc) { int status, ret; do { - ret = waitpid (pid, &status, 0); + ret = waitpid (proc->pid, &status, 0); if (WIFEXITED (status) || WIFSIGNALED (status)) break; } while (ret != -1 || errno != ECHILD); |