From patchwork Tue May 19 19:19:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 6796 Received: (qmail 93888 invoked by alias); 19 May 2015 19:19:19 -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 93878 invoked by uid 89); 19 May 2015 19:19:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no 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; Tue, 19 May 2015 19:19:18 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id B0A64AC7B4; Tue, 19 May 2015 19:19:16 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4JJJEoD002179; Tue, 19 May 2015 15:19:15 -0400 Message-ID: <555B8CB2.50600@redhat.com> Date: Tue, 19 May 2015 20:19:14 +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: Doug Evans CC: gdb-patches@sourceware.org Subject: Re: [PATCH v3 10/17] Implement all-stop on top of a target running non-stop mode References: <089e0122eb54b0c5c6051661dd3e@google.com> In-Reply-To: <089e0122eb54b0c5c6051661dd3e@google.com> 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)