From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62323 invoked by alias); 15 Sep 2017 12:53:06 -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 61321 invoked by uid 89); 15 Sep 2017 12:53:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=meaningless, hesitating, kick X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 12:53:03 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v8FCquER009616 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Sep 2017 08:53:01 -0400 Received: by simark.ca (Postfix, from userid 112) id 65EA91ECF0; Fri, 15 Sep 2017 08:52:56 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 8B4751EA9D; Fri, 15 Sep 2017 08:52:55 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 15 Sep 2017 12:53:00 -0000 From: Simon Marchi To: Sergio Durigan Junior Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] gdbserver: Remove duplicate functions to find any thread of process In-Reply-To: <87efr8txfy.fsf@redhat.com> References: <1505074275-1662-1-git-send-email-simon.marchi@ericsson.com> <1505074275-1662-2-git-send-email-simon.marchi@ericsson.com> <87efr8txfy.fsf@redhat.com> Message-ID: <3a7403a6edfa38cf515b423913f73dc5@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 15 Sep 2017 12:52:56 +0000 X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00404.txt.bz2 On 2017-09-15 06:09, Sergio Durigan Junior wrote: > On Sunday, September 10 2017, Simon Marchi wrote: > >> We have about 6 functions/callbacks to find_inferior meant to find a >> thread that belongs to a given pid. Remove all but >> find_any_thread_of_pid and replace their uses with >> find_any_thread_of_pid. > > Thanks for doing. gdbserver is really confusing when dealing with > threads and their data structures, so this patch is a nice step towards > a better interface. One thing I'm working one is getting rid of inferior_list/inferior_list_entry. The patch is pretty much complete, but I keep hesitating about meaningless details... I should just kick myself and submit what I have. > I think this can go in as is, because it is a self contained cleanup, > but I would like us to move yet another step ahead: recently I've > implemente gdbserver's version of "switch_to_thread", and I couldn't > help but think that a "switch_to_any_thread_of_pid" would be good to > have, because that's what's happening most of the time in this patch. Ok, sounds like implementing that would just be find_any_thread_of_pid + switch_to_thread. > I know I have to bite the bullet and convert places where > "current_thread = find_thread_ptid (ptid)" is still being used so that > "switch_to_thread" is used globally. I intend to submit a patch for > that. Seems like you already did! > Anyway, this looks good to me. Thanks for the review, I'll push it in. Simon