From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52201 invoked by alias); 23 Dec 2016 21:43:27 -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 52192 invoked by uid 89); 23 Dec 2016 21:43:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Baldwin, baldwin, D*FreeBSD.org, jhbfreebsdorg X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Dec 2016 21:43:24 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtp id 1cKXcZ-000353-51 from Luis_Gustavo@mentor.com ; Fri, 23 Dec 2016 13:43:23 -0800 Received: from [172.30.6.17] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 23 Dec 2016 13:43:20 -0800 Subject: Re: [PATCH] PR threads/20743: Don't attempt to suspend or resume exited threads. References: <20161223212842.42715-1-jhb@FreeBSD.org> To: John Baldwin , Reply-To: Luis Machado From: Luis Machado Message-ID: <74b6668b-e98e-6034-99bd-fee9834fe9d4@codesourcery.com> Date: Fri, 23 Dec 2016 21:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161223212842.42715-1-jhb@FreeBSD.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00413.txt.bz2 On 12/23/2016 03:28 PM, 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): Ignore exited threads. > (resume_all_threads_cb): Likewise. > (fbsd_resume): Assert resuming thread has not exited. > --- > gdb/ChangeLog | 7 +++++++ > gdb/fbsd-nat.c | 7 +++++++ > 2 files changed, 14 insertions(+) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index db6e913..4fb3732 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,3 +1,10 @@ > +2016-12-23 John Baldwin > + > + PR threads/20743 > + * fbsd-nat.c (resume_one_thread_cb): Ignore exited threads. > + (resume_all_threads_cb): Likewise. > + (fbsd_resume): Assert resuming thread has not exited. > + > 2016-12-22 Doug Evans > > * infrun.c (set_step_over_info): Add comment. > diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c > index ade62f1..7cd08c6 100644 > --- a/gdb/fbsd-nat.c > +++ b/gdb/fbsd-nat.c > @@ -662,6 +662,9 @@ resume_one_thread_cb (struct thread_info *tp, void *data) > if (ptid_get_pid (tp->ptid) != ptid_get_pid (*ptid)) > return 0; > > + if (is_exited (tp->ptid)) > + return 0; > + > if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (*ptid)) > request = PT_RESUME; > else > @@ -680,6 +683,9 @@ resume_all_threads_cb (struct thread_info *tp, void *data) > if (!ptid_match (tp->ptid, *filter)) > return 0; > > + if (is_exited (tp->ptid)) > + return 0; > + > if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1) > perror_with_name (("ptrace")); > return 0; > @@ -711,6 +717,7 @@ fbsd_resume (struct target_ops *ops, > if (ptid_lwp_p (ptid)) > { > /* If ptid is a specific LWP, suspend all other LWPs in the process. */ > + gdb_assert (!is_exited (ptid)); If we're asserting on this (since supposedly it shouldn't happen), do we need to check for is_exited on the two functions above? Also, is there a reason why we're not detecting a thread that has exited? Aren't all threads stopped at this point (for all-stop mode at least)? > iterate_over_threads (resume_one_thread_cb, &ptid); > } > else >