gdb: fix vfork with multiple threads
[deliverable/binutils-gdb.git] / gdb / linux-nat.c
index 10fa8f57d4a28b5df028c4128fe41f99335e9506..3432256c2c37fe954caac297555fdf839f93e4b5 100644 (file)
@@ -1700,8 +1700,22 @@ resume_clear_callback (struct lwp_info *lp)
 static int
 resume_set_callback (struct lwp_info *lp)
 {
+  inferior *inf = find_inferior_ptid (linux_target, lp->ptid);
+  gdb_assert (inf != nullptr);
+
+  ///* When we are waiting for a detached vfork child to exec or exit,
+  //   breakpoints are removed, so only let the  */
+
+  //if (inf->thread_waiting_for_vfork_done != nullptr
+  //    && inf->thread_waiting_for_vfork_done->ptid != lp->ptid)
+  //  return 0;
+
+  //if (inf->pending_detach)
+  //  return 0;
+
   lp->resumed = 1;
   lp->last_resume_kind = resume_continue;
+
   return 0;
 }
 
@@ -2095,20 +2109,10 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 
   if (event == PTRACE_EVENT_VFORK_DONE)
     {
-      if (current_inferior ()->waiting_for_vfork_done)
-       {
-         linux_nat_debug_printf
-           ("Got expected PTRACE_EVENT_VFORK_DONE from LWP %ld: stopping",
-            lp->ptid.lwp ());
-
-         ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
-         return 0;
-       }
-
       linux_nat_debug_printf
-       ("Got PTRACE_EVENT_VFORK_DONE from LWP %ld: ignoring", lp->ptid.lwp ());
-
-      return 1;
+       ("Got PTRACE_EVENT_VFORK_DONE from LWP %ld: stopping", lp->ptid.lwp ());
+      ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
+      return 0;
     }
 
   internal_error (__FILE__, __LINE__,
This page took 0.024347 seconds and 4 git commands to generate.