From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72429 invoked by alias); 28 May 2015 18:56:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 72418 invoked by uid 89); 28 May 2015 18:56:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-ob0-f172.google.com Received: from mail-ob0-f172.google.com (HELO mail-ob0-f172.google.com) (209.85.214.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 28 May 2015 18:56:07 +0000 Received: by obcnx10 with SMTP id nx10so34987537obc.2 for ; Thu, 28 May 2015 11:56:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=MjQPNxq1YiO7EURlZ8c7Z0jiSa4Erh6yMDRAkXawgbA=; b=VpTYmkQuriWA/3JpJAeWz6Z2R10qlcCEC2EsxamdTiiYMBN8sjuP2d5s+kRb/liIbh GrE8LEGedTK5zNhiBTEtBkjsedMep44IeHZ6Qu+R3Za+2ziRGjMjUHjGYWQyrJlgBRc6 0ACADVpUOhj67ELjJHB1yQYiWCNkecr0pHkduCGjJdVg6sJ0OBXTbHpNWNn8PTkvktKA DYEvfwF40n+RTcDwJNRg0zWC2t/tZoUWJ3aRcXxinIeZ7dbLQXLtqN6nyZKeR3bDQnbk 8N50PcTIqAvy1NXu+DB7bwPNsaf8Xh62n3P9wFeGRqnD0Zt/6CS0xiSlUha5hh+coa1x KY4w== X-Gm-Message-State: ALoCoQnpZRr8ggx8lpLiqCEsmX7JT3l5iOJiWDzZKaBYW4Lj0ky4XMaeFC8LrGBwsVGuV+8DLmfm MIME-Version: 1.0 X-Received: by 10.60.155.97 with SMTP id vv1mr3796310oeb.15.1432839365542; Thu, 28 May 2015 11:56:05 -0700 (PDT) Received: by 10.182.89.99 with HTTP; Thu, 28 May 2015 11:56:05 -0700 (PDT) In-Reply-To: <55609CB8.3050104@redhat.com> References: <047d7b2e4e86aaa0ff0516afeb5c@google.com> <55609CB8.3050104@redhat.com> Date: Thu, 28 May 2015 18:56:00 -0000 Message-ID: Subject: Re: [PATCH 11/18] Implement all-stop on top of a target running non-stop mode From: Doug Evans To: Pedro Alves Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00693.txt.bz2 On Sat, May 23, 2015 at 8:28 AM, Pedro Alves wrote: > On 05/22/2015 07:35 PM, Doug Evans wrote: > >> I found another instance in keep_going_stepped_thread: >> >> if (target_is_non_stop_p ()) >> resume_ptid = inferior_ptid; >> else >> resume_ptid = user_visible_resume_ptid >> (tp->control.stepping_command); >> >> Can you add a comment here too? >> Thanks. >> [An alternative would be to add a utility function that >> contained this code and then put the comment there, >> but I'll leave it to you to decide if you want >> such a function.] > > That's a good idea. How about this? I'll fold it in > if it looks good. > > --- > gdb/infrun.c | 53 ++++++++++++++++++++++++++--------------------------- > 1 file changed, 26 insertions(+), 27 deletions(-) > > diff --git a/gdb/infrun.c b/gdb/infrun.c > index d9fc4e5..fe48c91 100644 > --- a/gdb/infrun.c > +++ b/gdb/infrun.c > @@ -2173,6 +2173,25 @@ user_visible_resume_ptid (int step) > return resume_ptid; > } > > +/* Return a ptid representing the set of threads that we will resume, > + in the perspective of the target, assuming run control handling > + does not require leaving some threads stopped (e.g., stepping past > + breakpoint). USER_STEP indicates whether we're about to start the > + target for a stepping command. */ > + > +static ptid_t > +internal_resume_ptid (int user_step) > +{ > + /* 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 ()) > + return inferior_ptid; > + else > + return user_visible_resume_ptid (user_step); > +} > + > /* Wrapper for target_resume, that handles infrun-specific > bookkeeping. */ > > @@ -2384,15 +2403,7 @@ 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 > - resume_ptid = user_visible_resume_ptid (user_step); > + resume_ptid = internal_resume_ptid (user_step); > do_target_resume (resume_ptid, 0, GDB_SIGNAL_0); > discard_cleanups (old_cleanups); > tp->resumed = 1; > @@ -2501,20 +2512,9 @@ resume (enum gdb_signal sig) > use singlestep breakpoint. */ > gdb_assert (!(thread_has_single_step_breakpoints_set (tp) && step)); > > - /* Decide the set of threads to ask the target to resume. Start > - by assuming everything will be resumed, than narrow the set > - by applying increasingly restricting conditions. */ > - resume_ptid = user_visible_resume_ptid (user_step); > - > - /* Maybe resume a single thread after all. */ > - if (target_is_non_stop_p ()) > - { > - /* If non-stop mode, threads are always controlled > - individually. */ > - resume_ptid = inferior_ptid; > - } > - else if ((step || thread_has_single_step_breakpoints_set (tp)) > - && tp->control.trap_expected) > + /* Decide the set of threads to ask the target to resume. */ > + if ((step || thread_has_single_step_breakpoints_set (tp)) > + && tp->control.trap_expected) > { > /* We're allowing a thread to run past a breakpoint it has > hit, by single-stepping the thread with the breakpoint > @@ -2523,6 +2523,8 @@ resume (enum gdb_signal sig) > breakpoint if allowed to run. */ > resume_ptid = inferior_ptid; > } > + else > + resume_ptid = internal_resume_ptid (user_step); > > if (execution_direction != EXEC_REVERSE > && step && breakpoint_inserted_here_p (aspace, pc)) > @@ -6833,10 +6835,7 @@ keep_going_stepped_thread (struct thread_info *tp) > stop_pc); > > tp->resumed = 1; > - if (target_is_non_stop_p ()) > - resume_ptid = inferior_ptid; > - else > - resume_ptid = user_visible_resume_ptid (tp->control.stepping_command); > + resume_ptid = internal_resume_ptid (tp->control.stepping_command); > do_target_resume (resume_ptid, 0, GDB_SIGNAL_0); > } > else "works for me" Thanks.