From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94868 invoked by alias); 11 Apr 2017 18:43:43 -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 94850 invoked by uid 89); 11 Apr 2017 18:43:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy= X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Apr 2017 18:43:39 +0000 Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 2E08510A82D for ; Tue, 11 Apr 2017 14:43:39 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org Subject: Re: [PATCH v2] PR threads/20743: Don't attempt to suspend or resume exited threads. Date: Tue, 11 Apr 2017 18:43:00 -0000 Message-ID: <6171449.MXByV3puWo@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20170404173258.6512-1-jhb@FreeBSD.org> References: <20170404173258.6512-1-jhb@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00291.txt.bz2 Ping? On Tuesday, April 04, 2017 10:32:58 AM John Baldwin wrote: > When resuming a native FreeBSD process, ignore exited threads when > suspending/resuming individual threads prior to continuing the process. > > gdb/ChangeLog: > > PR threads/20743 > * fbsd-nat.c (resume_one_thread_cb): Remove. > (resume_all_threads_cb): Remove. > (fbsd_resume): Use ALL_NON_EXITED_THREADS instead of > iterate_over_threads. > --- > gdb/ChangeLog | 8 ++++++++ > gdb/fbsd-nat.c | 60 +++++++++++++++++++++++++--------------------------------- > 2 files changed, 34 insertions(+), 34 deletions(-) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index fc8dbe18da..a1927f5e2e 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,3 +1,11 @@ > +2017-04-04 John Baldwin > + > + PR threads/20743 > + * fbsd-nat.c (resume_one_thread_cb): Remove. > + (resume_all_threads_cb): Remove. > + (fbsd_resume): Use ALL_NON_EXITED_THREADS instead of > + iterate_over_threads. > + > 2017-04-04 Simon Marchi > > * remote.c (set_general_thread, set_continue_thread): Use ptid_t > diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c > index d99f436070..f80a47ba42 100644 > --- a/gdb/fbsd-nat.c > +++ b/gdb/fbsd-nat.c > @@ -653,38 +653,6 @@ fbsd_next_vfork_done (void) > #endif > #endif > > -static int > -resume_one_thread_cb (struct thread_info *tp, void *data) > -{ > - ptid_t *ptid = (ptid_t *) data; > - int request; > - > - if (ptid_get_pid (tp->ptid) != ptid_get_pid (*ptid)) > - return 0; > - > - if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (*ptid)) > - request = PT_RESUME; > - else > - request = PT_SUSPEND; > - > - if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1) > - perror_with_name (("ptrace")); > - return 0; > -} > - > -static int > -resume_all_threads_cb (struct thread_info *tp, void *data) > -{ > - ptid_t *filter = (ptid_t *) data; > - > - if (!ptid_match (tp->ptid, *filter)) > - return 0; > - > - if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1) > - perror_with_name (("ptrace")); > - return 0; > -} > - > /* Implement the "to_resume" target_ops method. */ > > static void > @@ -711,13 +679,37 @@ fbsd_resume (struct target_ops *ops, > if (ptid_lwp_p (ptid)) > { > /* If ptid is a specific LWP, suspend all other LWPs in the process. */ > - iterate_over_threads (resume_one_thread_cb, &ptid); > + struct thread_info *tp; > + int request; > + > + ALL_NON_EXITED_THREADS (tp) > + { > + if (ptid_get_pid (tp->ptid) != ptid_get_pid (ptid)) > + continue; > + > + if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (ptid)) > + request = PT_RESUME; > + else > + request = PT_SUSPEND; > + > + if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1) > + perror_with_name (("ptrace")); > + } > } > else > { > /* If ptid is a wildcard, resume all matching threads (they won't run > until the process is continued however). */ > - iterate_over_threads (resume_all_threads_cb, &ptid); > + struct thread_info *tp; > + > + ALL_NON_EXITED_THREADS (tp) > + { > + if (!ptid_match (tp->ptid, ptid)) > + continue; > + > + if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1) > + perror_with_name (("ptrace")); > + } > ptid = inferior_ptid; > } > super_resume (ops, ptid, step, signo); > -- John Baldwin