Patchwork [v2,15/23] Implement all-stop on top of a target running non-stop mode

login
register
mail settings
Submitter Pedro Alves
Date April 8, 2015, 7:41 p.m.
Message ID <55258478.8090909@redhat.com>
Download mbox | patch
Permalink /patch/6096/
State New
Headers show

Comments

Pedro Alves - April 8, 2015, 7:41 p.m.
On 04/08/2015 08:35 PM, Pedro Alves wrote:
> On 04/08/2015 12:08 PM, Pedro Alves wrote:
>>
>> Hmm.  Looks like the assertion caught a pre-existing problem.
>> This sets up the thread to re-hit the breakpoint at PC once the
>> signal handler returns, and lets _all_ threads run.  But, what if had
>> _other_ threads that needed a step-over too?  Those will run too,
>> and immediately re-trap the same breakpoint, but GDB will re-report them.
> 
> I thought it'd be easy to test that with multiple-step-overs.exp test, and
> indeed, bad things happened.  I filed bugs and pushed the test in upfront,
> as managing all these patch dependencies is getting complicated... 
> 
>  [pushed] Add test for PR18214 and PR18216 - multiple step-overs with queued signals
>  https://sourceware.org/ml/gdb-patches/2015-04/msg00293.html
> 
>> Maybe we should set a step-resume breakpoint on _all_ threads that need
>> a step-over, not just the current.  I'll need to think a bit about this.
> 
> That works.  I tested it with native | remote, all-stop | non-stop,
> software | hardware single-step, and all pass now.

Oh, I almost forgot, I also needed to move the pending waitstatus handling
to restart_threads.  The "If some thread needs to start a step-over
at this point" assertion just below triggers otherwise.  I'll fold this
into the "Teach non-stop to do in-line step-overs" patch.

Patch

diff --git a/gdb/infrun.c b/gdb/infrun.c
index cce29fe..3a12c2b 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4918,6 +4918,18 @@  restart_threads (struct thread_info *event_thread)
 	  continue;
 	}
 
+
+      if (tp->suspend.waitstatus_pending_p)
+	{
+	  if (debug_infrun)
+	    fprintf_unfiltered (gdb_stdlog,
+				"infrun: restart threads: "
+				"[%s] has pending status\n",
+				target_pid_to_str (tp->ptid));
+	  tp->resumed = 1;
+	  continue;
+	}
+
       /* If some thread needs to start a step-over at this point, it
 	 should still be in the step-over queue, and thus skipped
 	 above.  */
@@ -6504,6 +6516,8 @@  keep_going_stepped_thread (struct thread_info *tp)
 
   if (tp->suspend.waitstatus_pending_p)
     {
+      abort ();
+
       if (debug_infrun)
 	{
 	  char *statstr;