From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39983 invoked by alias); 12 Apr 2017 18:12:01 -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 39253 invoked by uid 89); 12 Apr 2017 18:11:53 -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,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Wed, 12 Apr 2017 18:11:51 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtp id 1cyMkA-0000ZR-VG from Luis_Gustavo@mentor.com ; Wed, 12 Apr 2017 11:11:50 -0700 Received: from [172.30.1.75] (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; Wed, 12 Apr 2017 11:11:47 -0700 Subject: Re: [PATCH v2] PR threads/20743: Don't attempt to suspend or resume exited threads. References: <20170404173258.6512-1-jhb@FreeBSD.org> To: John Baldwin , From: Luis Machado Reply-To: Luis Machado Message-ID: <62fcaaa0-35e3-2bed-fb5e-336a5c5ffbf4@codesourcery.com> Date: Wed, 12 Apr 2017 18:12:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170404173258.6512-1-jhb@FreeBSD.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SVR-ORW-MBX-09.mgc.mentorg.com (147.34.90.209) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00353.txt.bz2 On 04/04/2017 12:32 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): Remove. > (resume_all_threads_cb): Remove. > (fbsd_resume): Use ALL_NON_EXITED_THREADS instead of > iterate_over_threads. ... > @@ -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")); > + } Identation of the ALL_NON_EXITED_THREADS block is off. I'd check the identation of the entire block to make sure it is sane. A question i have is why did we have to remove the original functions. Couldn't we have checked the non-exited-ness of the threads inside the callback? Another bit... Since we're changing this code, might as well improve the perror message so it is more meaningful? > } > 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")); > + } Identation is off too. Same as above for the error message. Otherwise i have no further comments. I assume you ran gdb's testsuite against this change and verified the results are sane? Other folks can chime in.