int num_inf = 0;
for (inferior *inf : all_non_exited_inferiors ())
- if (target_has_execution_1 (ptid_t (inf->pid)))
+ if (inf->has_execution ())
for (thread_info *tp ATTRIBUTE_UNUSED : inf->non_exited_threads ())
{
/* Found a live thread in this inferior, go to the next
bfd_cache_close_all ();
}
+/* See inferior.h. */
+
+void
+switch_to_inferior_no_thread (inferior *inf)
+{
+ set_current_inferior (inf);
+ switch_to_no_thread ();
+ set_current_program_space (inf->pspace);
+}
+
static void
inferior_command (const char *args, int from_tty)
{
}
else
{
- set_current_inferior (inf);
- switch_to_no_thread ();
- set_current_program_space (inf->pspace);
+ switch_to_inferior_no_thread (inf);
gdb::observers::user_selected_context_changed.notify
(USER_SELECTED_INFERIOR);
if (exec != NULL)
{
/* Switch over temporarily, while reading executable and
- symbols.q. */
- set_current_program_space (inf->pspace);
- set_current_inferior (inf);
- switch_to_no_thread ();
-
+ symbols. */
+ switch_to_inferior_no_thread (inf);
exec_file_attach (exec.get (), from_tty);
symbol_file_add_main (exec.get (), add_flags);
}