pid_t pid = ptid_get_pid (inferior_ptid);
int sig = 0;
- if (from_tty)
- {
- char *exec_file = get_exec_file (0);
- if (exec_file == 0)
- exec_file = "";
- printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
- target_pid_to_str (pid_to_ptid (pid)));
- gdb_flush (gdb_stdout);
- }
+ target_announce_detach (from_tty);
if (args)
sig = atoi (args);
error (_("This system does not support detaching from a process"));
#endif
+ inf_ptrace_detach_success (ops);
+}
+
+/* See inf-ptrace.h. */
+
+void
+inf_ptrace_detach_success (struct target_ops *ops)
+{
+ pid_t pid = ptid_get_pid (inferior_ptid);
+
inferior_ptid = null_ptid;
detach_inferior (pid);
ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3)0, 0);
waitpid (pid, &status, 0);
- target_mourn_inferior ();
+ target_mourn_inferior (inferior_ptid);
}
/* Interrupt the inferior. */
/* Return which PID to pass to ptrace in order to observe/control the
tracee identified by PTID. */
-static pid_t
+pid_t
get_ptrace_pid (ptid_t ptid)
{
pid_t pid;