gdb: fix vfork with multiple threads
[deliverable/binutils-gdb.git] / gdbserver / linux-low.cc
index dc51b8906c8dd251d3ea2218828739f114a1e207..a68290da73aeeda43443a9fbaed2fb9d50ac0dd7 100644 (file)
@@ -493,13 +493,11 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
 
          ptid = ptid_t (new_pid, new_pid, 0);
 
-         if (debug_threads)
-           {
-             debug_printf ("HEW: Got fork event from LWP %ld, "
+         debug_printf("HEW: Got fork event from LWP %ld, "
                            "new child is %d\n",
                            ptid_of (event_thr).lwp (),
                            ptid.pid ());
-           }
+
 
          /* Add the new process to the tables and clone the breakpoint
             lists of the parent.  We need to do this even if the new process
@@ -3598,12 +3596,15 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
       if (event_child->waitstatus.kind == TARGET_WAITKIND_FORKED
          || event_child->waitstatus.kind == TARGET_WAITKIND_VFORKED)
        {
+             debug_printf("wait returning vfork %s -> %s\n", event_child->thread->id.to_string().c_str(),
+                          event_child->thread->fork_child->id.to_string().c_str());
          gdb_assert (event_child->thread->fork_child != nullptr);
          gdb_assert (event_child->thread->fork_child->fork_parent != nullptr);
          event_child->thread->fork_child->fork_parent = nullptr;
          event_child->thread->fork_child = nullptr;
        }
 
+
       *ourstatus = event_child->waitstatus;
       /* Clear the event lwp's waitstatus since we handled it already.  */
       event_child->waitstatus.kind = TARGET_WAITKIND_IGNORE;
@@ -3641,17 +3642,8 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
         SIGSTOP is an implementation detail.  */
       ourstatus->value.sig = GDB_SIGNAL_0;
     }
-  else if (current_thread->last_resume_kind == resume_stop
-          && WSTOPSIG (w) != SIGSTOP)
-    {
-      /* A thread that has been requested to stop by GDB with vCont;t,
-        but, it stopped for other reasons.  */
-      ourstatus->value.sig = gdb_signal_from_host (WSTOPSIG (w));
-    }
   else if (ourstatus->kind == TARGET_WAITKIND_STOPPED)
-    {
-      ourstatus->value.sig = gdb_signal_from_host (WSTOPSIG (w));
-    }
+    ourstatus->value.sig = gdb_signal_from_host (WSTOPSIG (w));
 
   gdb_assert (step_over_bkpt == null_ptid);
 
@@ -3723,6 +3715,8 @@ linux_process_target::wait (ptid_t ptid,
       && event_ptid != null_ptid)
     async_file_mark ();
 
+  debug_printf(":;wait return %s, %s\n", event_ptid.to_string().c_str(), target_waitstatus_to_string(ourstatus).c_str());
+
   return event_ptid;
 }
 
This page took 0.025895 seconds and 4 git commands to generate.