return proc;
}
+void
+linux_process_target::remove_linux_process (process_info *proc)
+{
+ if (proc->priv->mem_fd >= 0)
+ close (proc->priv->mem_fd);
+
+ this->low_delete_process (proc->priv->arch_private);
+
+ xfree (proc->priv);
+ proc->priv = nullptr;
+
+ remove_process (proc);
+}
+
arch_process_info *
linux_process_target::low_new_process ()
{
err = attach_lwp (ptid);
if (err != 0)
{
- remove_process (proc);
+ this->remove_linux_process (proc);
std::string reason = linux_ptrace_attach_fail_reason_string (ptid, err);
error ("Cannot attach to process %ld: %s", pid, reason.c_str ());
void
linux_process_target::mourn (process_info *process)
{
- struct process_info_private *priv;
-
#ifdef USE_THREAD_DB
thread_db_mourn (process);
#endif
delete_lwp (get_thread_lwp (thread));
});
- /* Freeing all private data. */
- priv = process->priv;
- close (priv->mem_fd);
- low_delete_process (priv->arch_private);
- free (priv);
- process->priv = NULL;
-
- remove_process (process);
+ this->remove_linux_process (process);
}
void
yet. */
process_info *add_linux_process_no_mem_file (int pid, int attached);
+ /* Free resources associated to PROC and remove it. */
+ void remove_linux_process (process_info *proc);
+
/* Add a new thread. */
lwp_info *add_lwp (ptid_t ptid);