}
}
+/* Given a ptid, return a "process ptid" in which only the pid member
+ is present. This is used in calls to target_pid_to_str() to ensure
+ that only process ptids are printed by this file. */
+
+static inline ptid_t
+proc_ptid (ptid_t ptid)
+{
+ ptid_t process_ptid (ptid.pid ());
+ return process_ptid;
+}
+
/* Kill 'em all, let God sort 'em out... */
void
last = find_last_fork (inf);
fork_load_infrun_state (last);
gdb_printf (_("[Switching to %s]\n"),
- target_pid_to_str (inferior_ptid).c_str ());
+ target_pid_to_str (proc_ptid (inferior_ptid)).c_str ());
/* If there's only one fork, switch back to non-fork mode. */
if (one_fork_p (inf))
{
if (ptrace (PTRACE_DETACH, inferior_ptid.pid (), 0, 0))
error (_("Unable to detach %s"),
- target_pid_to_str (inferior_ptid).c_str ());
+ target_pid_to_str (proc_ptid (inferior_ptid)).c_str ());
}
delete_fork (inferior_ptid, inf);
if (from_tty)
gdb_printf (_("[Switching to %s]\n"),
- target_pid_to_str (inferior_ptid).c_str ());
+ target_pid_to_str (proc_ptid (inferior_ptid)).c_str ());
/* If there's only one fork, switch back to non-fork mode. */
if (one_fork_p (inf))
catch (const gdb_exception &ex)
{
warning (_("Couldn't restore checkpoint state in %s: %s"),
- target_pid_to_str (m_oldfp->ptid).c_str (),
+ target_pid_to_str (proc_ptid (m_oldfp->ptid)).c_str (),
ex.what ());
}
}
error (_("Cannot delete active checkpoint"));
if (ptrace (PTRACE_KILL, ptid.pid (), 0, 0))
- error (_("Unable to kill pid %s"), target_pid_to_str (ptid).c_str ());
+ error (_("Unable to kill pid %s"),
+ target_pid_to_str (proc_ptid (ptid)).c_str ());
if (from_tty)
- gdb_printf (_("Killed %s\n"), target_pid_to_str (ptid).c_str ());
+ gdb_printf (_("Killed %s\n"),
+ target_pid_to_str (proc_ptid (ptid)).c_str ());
delete_fork (ptid, inf);
{
if (inferior_call_waitpid (pptid, ptid.pid ()))
warning (_("Unable to wait pid %s"),
- target_pid_to_str (ptid).c_str ());
+ target_pid_to_str (proc_ptid (ptid)).c_str ());
}
}
Please switch to another checkpoint before detaching the current one"));
if (ptrace (PTRACE_DETACH, ptid.pid (), 0, 0))
- error (_("Unable to detach %s"), target_pid_to_str (ptid).c_str ());
+ error (_("Unable to detach %s"),
+ target_pid_to_str (proc_ptid (ptid)).c_str ());
if (from_tty)
- gdb_printf (_("Detached %s\n"), target_pid_to_str (ptid).c_str ());
+ gdb_printf (_("Detached %s\n"),
+ target_pid_to_str (proc_ptid (ptid)).c_str ());
delete_fork (ptid, current_inferior ());
}
+ (print_inf ? 1 : 0));
targid_width
= std::max (targid_width,
- target_pid_to_str (fi.ptid).size ());
+ target_pid_to_str (proc_ptid (fi.ptid)).size ());
}
}
/* Print target id. */
gdb_printf ("%-*s", (int) targid_width,
- target_pid_to_str (fi.ptid).c_str ());
+ target_pid_to_str (proc_ptid (fi.ptid)).c_str ());
if (t->state == THREAD_RUNNING && is_current)
gdb_printf (_(" (running)"));
insert_breakpoints ();
if (!inferior_changed)
gdb_printf (_("Switching to %s\n"),
- target_pid_to_str (inferior_ptid).c_str ());
+ target_pid_to_str (proc_ptid (inferior_ptid)).c_str ());
}
notify_user_selected_context_changed