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'.
This commit is contained in:
Pedro Alves 2018-07-13 10:28:46 +01:00
parent 9451a3b9a1
commit ef2ddb33bd
8 changed files with 48 additions and 46 deletions

View file

@ -1255,7 +1255,7 @@ handle_detach (char *own_buf)
fprintf (stderr, "Detaching from process %d\n", process->pid);
stop_tracing ();
if (detach_inferior (process->pid) != 0)
if (detach_inferior (process) != 0)
write_enn (own_buf);
else
{
@ -1281,7 +1281,7 @@ handle_detach (char *own_buf)
/* If we are attached, then we can exit. Otherwise, we
need to hang around doing nothing, until the child is
gone. */
join_inferior (process->pid);
join_inferior (process);
exit (0);
}
}
@ -3526,7 +3526,7 @@ detach_or_kill_for_exit (void)
int pid = process->pid;
if (process->attached)
detach_inferior (pid);
detach_inferior (process);
else
kill_inferior (pid);