gdb: on exec, delegate pushing / unpushing target and adding thread to target_ops...
[deliverable/binutils-gdb.git] / gdb / process-stratum-target.c
index 719167803fff47f8b9cbf31c49ea5451f6a1db9f..c851090a7f2ea23913cb9e9d15360015f73a2a4c 100644 (file)
@@ -84,6 +84,26 @@ process_stratum_target::has_execution (inferior *inf)
   return inf->pid != 0;
 }
 
+void
+process_stratum_target::follow_exec (inferior *follow_inf, ptid_t ptid,
+                                    const char *execd_pathname)
+{
+  inferior *orig_inf = current_inferior ();
+
+  if (orig_inf != follow_inf)
+    {
+      /* Execution continues in a new inferior, push the original inferior's
+         process target on the new inferior's target stack.  The process target
+        may decide to unpush itself from the original inferior's target stack
+        after that, at its discretion.  */
+      follow_inf->push_target (orig_inf->process_target ());
+      thread_info *t = add_thread (follow_inf->process_target (), ptid);
+
+      /* Leave the new inferior / thread as the current inferior / thread.  */
+      switch_to_thread (t);
+    }
+}
+
 /* See process-stratum-target.h.  */
 
 std::set<process_stratum_target *>
This page took 0.024194 seconds and 4 git commands to generate.