diff options
author | Pedro Alves <palves@redhat.com> | 2018-07-13 10:28:47 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2018-07-13 10:58:17 +0100 |
commit | a780ef4f27f8bc44082be81fdbee44bb11f1049c (patch) | |
tree | b71879dc14a53dc2bdb35604e7d52bc8b3fccaa8 /gdb/gdbserver/server.c | |
parent | ef2ddb33bd29a7c4f7027b9e37e55c74c15af825 (diff) | |
download | binutils-a780ef4f27f8bc44082be81fdbee44bb11f1049c.zip binutils-a780ef4f27f8bc44082be81fdbee44bb11f1049c.tar.gz binutils-a780ef4f27f8bc44082be81fdbee44bb11f1049c.tar.bz2 |
GDBserver: Pass process_info pointer to target_kill
We start from a process_info pointer, pass down process->pid, and
then the target_kill 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_kill): Change parameter to process_info
pointer instead of pid. Adjust.
* lynx-low.c (lynx_kill): Likewise.
* nto-low.c (nto_kill): Likewise.
* spu-low.c (spu_kill): Likewise.
* win32-low.c (win32_kill): Likewise.
* server.c (handle_v_kill, kill_inferior_callback)
(detach_or_kill_for_exit): Adjust.
* target.c (kill_inferior): Change parameter to process_info
pointer instead of pid. Adjust.
* target.h (struct target_ops) <kill>: Change parameter to
process_info pointer instead of pid. Adjust all implementations
and callers.
(kill_inferior): Likewise.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r-- | gdb/gdbserver/server.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index b35015b..a491ae0 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -3080,7 +3080,10 @@ handle_v_kill (char *own_buf) pid = strtol (p, NULL, 16); else pid = signal_pid; - if (pid != 0 && kill_inferior (pid) == 0) + + process_info *proc = find_process_pid (pid); + + if (proc != nullptr && kill_inferior (proc) == 0) { cs.last_status.kind = TARGET_WAITKIND_SIGNALLED; cs.last_status.value.sig = GDB_SIGNAL_KILL; @@ -3481,10 +3484,8 @@ gdbserver_show_disableable (FILE *stream) static void kill_inferior_callback (process_info *process) { - int pid = process->pid; - - kill_inferior (pid); - discard_queued_stop_replies (ptid_t (pid)); + kill_inferior (process); + discard_queued_stop_replies (ptid_t (process->pid)); } /* Call this when exiting gdbserver with possible inferiors that need @@ -3528,7 +3529,7 @@ detach_or_kill_for_exit (void) if (process->attached) detach_inferior (process); else - kill_inferior (pid); + kill_inferior (process); discard_queued_stop_replies (ptid_t (pid)); }); |