/* If this program space is rendered useless, remove it. */
if (program_space_empty_p (inf->pspace))
- delete_program_space (inf->pspace);
+ delete inf->pspace;
delete inf;
}
gdb::observers::inferior_appeared.notify (inf);
}
-void
-discard_all_inferiors (void)
-{
- for (inferior *inf : all_non_exited_inferiors ())
- exit_inferior_silent (inf);
-}
-
struct inferior *
find_inferior_id (int num)
{
return NULL;
}
-struct inferior *
-iterate_over_inferiors (int (*callback) (struct inferior *, void *),
- void *data)
-{
- for (inferior *inf : all_inferiors_safe ())
- if ((*callback) (inf, data))
- return inf;
-
- return NULL;
-}
-
int
have_inferiors (void)
{
uiout->table_header (17, ui_left, "exec", "Executable");
uiout->table_body ();
+
+ /* Restore the current thread after the loop because we switch the
+ inferior in the loop. */
+ scoped_restore_current_pspace_and_thread restore_pspace_thread;
+ inferior *current_inf = current_inferior ();
for (inferior *inf : all_inferiors ())
{
if (!number_is_in_list (requested_inferiors, inf->num))
ui_out_emit_tuple tuple_emitter (uiout, NULL);
- if (inf == current_inferior ())
+ if (inf == current_inf)
uiout->field_string ("current", "*");
else
uiout->field_skip ("current");
uiout->field_signed ("number", inf->num);
+ /* Because target_pid_to_str uses current_top_target,
+ switch the inferior. */
+ switch_to_inferior_no_thread (inf);
+
uiout->field_string ("target-id", inferior_pid_to_str (inf->pid));
std::string conn = uiout_field_connection (inf->process_target ());