Fix detach with target remote (PR gdb/28080)
[deliverable/binutils-gdb.git] / gdb / inf-child.c
index 0e68a40d7c04a91fd7d35c674bbb0770fef65a6c..f690aa77913f33d2a53c3ab577b6f1b743980e01 100644 (file)
@@ -409,6 +409,24 @@ inf_child_target::can_use_agent ()
   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
This page took 0.032997 seconds and 4 git commands to generate.