keiths / rpms / gdb

Forked from rpms/gdb 5 months ago
Clone
2280d55
Index: gdb-6.8.50.20090811/gdb/linux-nat.c
2280d55
===================================================================
2280d55
--- gdb-6.8.50.20090811.orig/gdb/linux-nat.c	2009-08-12 07:21:20.000000000 +0200
2280d55
+++ gdb-6.8.50.20090811/gdb/linux-nat.c	2009-08-12 08:11:25.000000000 +0200
2280d55
@@ -1656,16 +1656,18 @@ resume_set_callback (struct lwp_info *lp
2280d55
 
2280d55
 static void
2280d55
 linux_nat_resume (struct target_ops *ops,
2280d55
-		  ptid_t ptid, int step, enum target_signal signo)
2280d55
+		  ptid_t ptid, int step_int, enum target_signal signo)
2280d55
 {
2280d55
   sigset_t prev_mask;
2280d55
   struct lwp_info *lp;
2280d55
   int resume_many;
2280d55
+  enum resume_step step = step_int;
2280d55
 
2280d55
   if (debug_linux_nat)
2280d55
     fprintf_unfiltered (gdb_stdlog,
2280d55
 			"LLR: Preparing to %s %s, %s, inferior_ptid %s\n",
2280d55
-			step ? "step" : "resume",
2280d55
+			(step == RESUME_STEP_NEEDED
2280d55
+			 ? "needed" : (step ? "step" : "resume")),
2280d55
 			target_pid_to_str (ptid),
2280d55
 			signo ? strsignal (signo) : "0",
2280d55
 			target_pid_to_str (inferior_ptid));
2280d55
@@ -2625,10 +2627,34 @@ linux_nat_filter_event (int lwpid, int s
2280d55
 
2280d55
       if (num_lwps (GET_PID (lp->ptid)) > 1)
2280d55
        {
2280d55
+	enum resume_step step = lp->step;
2280d55
+	pid_t pid = GET_PID (lp->ptid);
2280d55
+
2280d55
 	 /* If there is at least one more LWP, then the exit signal
2280d55
 	    was not the end of the debugged application and should be
2280d55
 	    ignored.  */
2280d55
 	 exit_lwp (lp);
2280d55
+
2280d55
+	if (step == RESUME_STEP_USER)
2280d55
+	  {
2280d55
+	    /* Now stop the closest LWP's ...  */
2280d55
+	    lp = find_lwp_pid (pid_to_ptid (pid));
2280d55
+	    if (!lp)
2280d55
+	      lp = lwp_list;
2280d55
+	    gdb_assert (lp != NULL);
2280d55
+	    errno = 0;
2280d55
+	    ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
2280d55
+		    (void *) (unsigned long) SIGSTOP);
2280d55
+	    if (debug_linux_nat)
2280d55
+	      fprintf_unfiltered (gdb_stdlog,
2280d55
+				  "PTRACE_CONT %s, 0, 0 (%s)\n",
2280d55
+				  target_pid_to_str (lp->ptid),
2280d55
+				  errno ? safe_strerror (errno)
2280d55
+					: "OK");
2280d55
+	    /* Avoid the silent `delayed SIGSTOP' handling.  */
2280d55
+	    lp->signalled = 0;
2280d55
+	  }
2280d55
+
2280d55
 	 return NULL;
2280d55
        }
2280d55
     }