/* See inferior.h. */
void
-inferior::clear_thread_list (bool silent)
+inferior::clear_thread_list ()
{
thread_list.clear_and_dispose ([=] (thread_info *thr)
{
- threads_debug_printf ("deleting thread %s, silent = %d",
- thr->ptid.to_string ().c_str (), silent);
- set_thread_exited (thr, silent);
+ threads_debug_printf ("deleting thread %s",
+ thr->ptid.to_string ().c_str ());
+ set_thread_exited (thr, {}, true /* silent */);
if (thr->deletable ())
delete thr;
});
ptid_thread_map.clear ();
}
+/* Notify interpreters and observers that inferior INF was removed. */
+
+static void
+notify_inferior_removed (inferior *inf)
+{
+ interps_notify_inferior_removed (inf);
+ gdb::observers::inferior_removed.notify (inf);
+}
+
void
delete_inferior (struct inferior *inf)
{
- inf->clear_thread_list (true);
+ inf->clear_thread_list ();
auto it = inferior_list.iterator_to (*inf);
inferior_list.erase (it);
- gdb::observers::inferior_removed.notify (inf);
+ notify_inferior_removed (inf);
/* Pop all targets now, this ensures that inferior::unpush is called
correctly. As pop_all_targets ends up making a temporary switch to
gdb::observers::inferior_exit.notify (inf);
}
-/* If SILENT then be quiet -- don't announce a inferior exit, or the
- exit of its threads. */
+/* See inferior.h. */
-static void
-exit_inferior_1 (struct inferior *inf, int silent)
+void
+exit_inferior (struct inferior *inf)
{
- inf->clear_thread_list (silent);
+ inf->clear_thread_list ();
notify_inferior_disappeared (inf);
reinit_frame_cache ();
}
-void
-exit_inferior (inferior *inf)
-{
- exit_inferior_1 (inf, 0);
-}
-
-void
-exit_inferior_silent (inferior *inf)
-{
- exit_inferior_1 (inf, 1);
-}
-
/* See inferior.h. */
void
detach_inferior (inferior *inf)
{
- /* Save the pid, since exit_inferior_1 will reset it. */
+ /* Save the pid, since exit_inferior will reset it. */
int pid = inf->pid;
- exit_inferior_1 (inf, 0);
+ exit_inferior (inf);
if (print_inferior_events)
gdb_printf (_("[Inferior %d (%s) detached]\n"),