From patchwork Wed Apr 8 19:41:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 6096 Received: (qmail 5337 invoked by alias); 8 Apr 2015 19:41:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 5327 invoked by uid 89); 8 Apr 2015 19:41:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 08 Apr 2015 19:41:47 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 1F8FA8EB29; Wed, 8 Apr 2015 19:41:46 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t38Jfi64014285; Wed, 8 Apr 2015 15:41:45 -0400 Message-ID: <55258478.8090909@redhat.com> Date: Wed, 08 Apr 2015 20:41:44 +0100 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH v2 15/23] Implement all-stop on top of a target running non-stop mode References: <1428410990-28560-1-git-send-email-palves@redhat.com> <1428410990-28560-16-git-send-email-palves@redhat.com> <86r3rvvu8c.fsf@gmail.com> <5524FA77.50900@redhat.com> <55250C1D.4090304@redhat.com> <552582F3.1060106@redhat.com> In-Reply-To: <552582F3.1060106@redhat.com> 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. 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;