+/* Switch to inferior NEW_INF, a new inferior, and unless
+ NO_CONNECTION is true, push the process_stratum_target of ORG_INF
+ to NEW_INF. */
+
+static void
+switch_to_inferior_and_push_target (inferior *new_inf,
+ bool no_connection, inferior *org_inf)
+{
+ process_stratum_target *proc_target = org_inf->process_target ();
+
+ /* Switch over temporarily, while reading executable and
+ symbols. */
+ switch_to_inferior_no_thread (new_inf);
+
+ /* Reuse the target for new inferior. */
+ if (!no_connection && proc_target != NULL)
+ {
+ push_target (proc_target);
+ if (proc_target->connection_string () != NULL)
+ printf_filtered (_("Added inferior %d on connection %d (%s %s)\n"),
+ new_inf->num,
+ proc_target->connection_number,
+ proc_target->shortname (),
+ proc_target->connection_string ());
+ else
+ printf_filtered (_("Added inferior %d on connection %d (%s)\n"),
+ new_inf->num,
+ proc_target->connection_number,
+ proc_target->shortname ());
+ }
+ else
+ printf_filtered (_("Added inferior %d\n"), new_inf->num);
+}
+
+/* add-inferior [-copies N] [-exec FILENAME] [-no-connection] */