/* Base/prototype target for default child (native) targets.
- Copyright (C) 1988-2020 Free Software Foundation, Inc.
+ Copyright (C) 1988-2021 Free Software Foundation, Inc.
This file is part of GDB.
gdb_assert (dynamic_cast<inf_child_target *> (target) != NULL);
target_preopen (from_tty);
- push_target (target);
+ current_inferior ()->push_target (target);
inf_child_explicitly_opened = 1;
if (from_tty)
printf_filtered ("Done. Use the \"run\" command to start a process.\n");
void
inf_child_target::maybe_unpush_target ()
{
- if (!inf_child_explicitly_opened && !have_inferiors ())
- unpush_target (this);
+ if (!inf_child_explicitly_opened)
+ current_inferior ()->unpush_target (this);
}
void
return agent_loaded_p ();
}
+void
+inf_child_target::follow_exec (inferior *follow_inf, ptid_t ptid,
+ const char *execd_pathname)
+{
+ inferior *orig_inf = current_inferior ();
+
+ process_stratum_target::follow_exec (follow_inf, ptid, execd_pathname);
+
+ if (orig_inf != follow_inf)
+ {
+ /* If the target was implicitly push in the original inferior, unpush
+ it. */
+ scoped_restore_current_thread restore_thread;
+ switch_to_inferior_no_thread (orig_inf);
+ maybe_unpush_target ();
+ }
+}
+
/* See inf-child.h. */
void