* gnu-nat.c (gnu_attach): Add process to inferiors table.

(gnu_detach): Remove it.
	* go32-nat.c (go32_create_inferior): Add process to gdb's inferior
	table.
	* inf-ptrace.c (inf_ptrace_follow_fork): Delete and add inferiors
	to inferior table accordingly.
	(inf_ptrace_attach): Add new process to inferior table.
	(inf_ptrace_detach): Remove it.
	* inf-ttrace.c (inf_ttrace_follow_fork): Delete and add inferiors
	to inferior table accordingly.
	(inf_ttrace_attach): Add process to inferior table.
	(inf_ttrace_detach): Remove it.
	* linux-fork.c (init_fork_list): Delete any left over inferior.
	(linux_fork_mourn_inferior, detach_fork_command): Also delete
	processes from inferior list.
	* monitor.c (monitor_open): Add process to inferior list.
	(monitor_close): Remove it.
	* nto-procfs.c (procfs_attach): Add process to inferior list.
	Find threads after pushing the target.
	(procfs_detach): Remove process from inferior list.
	(procfs_create_inferior): Add process to inferior list.
	* procfs.c (procfs_detach): Remove process from inferior list.
	(do_attach): Add process to inferior list.
	* remote-sim.c (sim_create_inferior): Add process to inferior list.
	(gdbsim_close): Remove it.
	* target.c (generic_mourn_inferior): If inferior_ptid is not
	null_ptid, remove the corresponding inferior from inferior list.
	* win32-nat.c (do_initial_win32_stuff): Add process to inferior list.
	(win32_detach): Remove it.
	* linux-nat.c (linux_child_follow_fork): Delete and add inferiors
	to inferior list accordingly.
	* fork-child.c (fork_inferior): Add process to inferior list.
	* corelow.c (CORELOW_PID): Define.
	(core_close): Remove core from inferior list.
	(core_open): Add it.
This commit is contained in:
Pedro Alves
2008-09-22 15:16:51 +00:00
parent b77209e000
commit 7f9f62ba18
16 changed files with 126 additions and 10 deletions

View File

@@ -535,8 +535,11 @@ procfs_attach (char *args, int from_tty)
gdb_flush (gdb_stdout);
}
inferior_ptid = do_attach (pid_to_ptid (pid));
procfs_find_new_threads ();
add_inferior (pid);
push_target (&procfs_ops);
procfs_find_new_threads ();
}
static void
@@ -770,6 +773,7 @@ static void
procfs_detach (char *args, int from_tty)
{
int siggnal = 0;
int pid;
if (from_tty)
{
@@ -788,9 +792,12 @@ procfs_detach (char *args, int from_tty)
close (ctl_fd);
ctl_fd = -1;
init_thread_list ();
pid = ptid_get_pid (inferior_ptid);
inferior_ptid = null_ptid;
attach_flag = 0;
detach_inferior (pid);
init_thread_list ();
unpush_target (&procfs_ops); /* Pop out of handling an inferior. */
}
@@ -1077,7 +1084,9 @@ procfs_create_inferior (char *exec_file, char *allargs, char **env,
inferior_ptid = do_attach (pid_to_ptid (pid));
add_inferior (pid);
attach_flag = 0;
flags = _DEBUG_FLAG_KLC; /* Kill-on-Last-Close flag. */
errn = devctl (ctl_fd, DCMD_PROC_SET_FLAG, &flags, sizeof (flags), 0);
if (errn != EOK)