This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 10/17] Implement all-stop on top of a target running non-stop mode


On 05/18/2015 10:27 PM, Doug Evans wrote:

>   >  	  /* On all-stop, shouldn't have resumed unless we needed a
>   >  	     step over.  */
>   > @@ -2383,7 +2384,10 @@ resume (enum gdb_signal sig)
>   >  	      insert_single_step_breakpoint (gdbarch, aspace, pc);
>   >  	      insert_breakpoints ();
>   >
>   > -	      resume_ptid = user_visible_resume_ptid (user_step);
>   > +	      if (target_is_non_stop_p ())
>   > +		resume_ptid = inferior_ptid;
>   > +	      else
>   > +		resume_ptid = user_visible_resume_ptid (user_step);
> 
> Hi.
> For my own education, why is this change needed?

Please see the comment tweaks below.

> This takes a bit of reading to grok (the difference
> b/w non_stop and target_is_non_stop_p).
> Can you copy the comment below (marked XYZ) here?

Done (in all places).

Let me know what you think.

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 82fa526..2f8a708 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2384,6 +2384,11 @@ resume (enum gdb_signal sig)
 	      insert_single_step_breakpoint (gdbarch, aspace, pc);
 	      insert_breakpoints ();
 
+	      /* In non-stop, we always control threads individually.
+		 Note that the target may always work in non-stop mode
+		 even with "set non-stop off", in which case
+		 user_visible_resume_ptid could return a wildcard
+		 ptid.  */
 	      if (target_is_non_stop_p ())
 		resume_ptid = inferior_ptid;
 	      else
@@ -2946,7 +2951,8 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
     }
   else if (!non_stop && target_is_non_stop_p ())
     {
-      /* Start all other threads that are implicitly resumed too.  */
+      /* In all-stop, but the target is always in non-stop mode.
+	 Start all other threads that are implicitly resumed too.  */
       ALL_NON_EXITED_THREADS (tp)
         {
 	  /* Ignore threads of processes we're not resuming.  */
@@ -5670,13 +5676,15 @@ handle_signal_stop (struct execution_control_state *ecs)
 
 	  if (target_is_non_stop_p ())
 	    {
+	      /* Either "set non-stop" is "on", or the target is
+		 always in non-stop mode.  In this case, we have a bit
+		 more work to do.  Resume the current thread, and if
+		 we had paused all threads, restart them while the
+		 signal handler runs.  */
 	      keep_going (ecs);
 
-	      /* The step-over has been canceled temporarily while the
-		 signal handler executes.  */
 	      if (was_in_line)
 		{
-		  /* We had paused all threads, restart them.  */
 		  restart_threads (ecs->event_thread);
 		}
 	      else if (debug_infrun)
-- 
1.9.3



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]