From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106536 invoked by alias); 15 Sep 2017 11:14:48 -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 106517 invoked by uid 89); 15 Sep 2017 11:14:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 11:14:43 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E52C17E422 for ; Fri, 15 Sep 2017 11:14:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E52C17E422 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 538BC702F3; Fri, 15 Sep 2017 11:14:39 +0000 (UTC) Subject: Re: [PATCH] Use "switch_to_thread" more thoroughly on gdbserver To: Sergio Durigan Junior , GDB Patches References: <20170915043357.26094-1-sergiodj@redhat.com> From: Pedro Alves Message-ID: <6f36073a-eed8-123d-94ec-8922aa0aa648@redhat.com> Date: Fri, 15 Sep 2017 11:14:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170915043357.26094-1-sergiodj@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00400.txt.bz2 On 09/15/2017 05:33 AM, Sergio Durigan Junior wrote: > diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c > index 752646310a..2226dc802d 100644 > --- a/gdb/gdbserver/target.c > +++ b/gdb/gdbserver/target.c > @@ -26,14 +26,11 @@ struct target_ops *the_target; > int > set_desired_thread (int use_general) > { > - struct thread_info *found; > - > if (use_general == 1) > - found = find_thread_ptid (general_thread); > + switch_to_thread (general_thread); > else > - found = find_thread_ptid (cont_thread); > + switch_to_thread (cont_thread); > > - current_thread = found; > return (current_thread != NULL); Did you double-check whether this is equivalent? Off hand, I'd think it is, but the minus_one_ptid check in switch_to_thread gave me pause. there's a 'set_continue_thread (minus_one_ptid)' in gdb in early connection setup. Looks like we never call 'set_desired_thread(0)' nowadays though. [Hc predates vCont]. Do you remember why that check is there in switch_to_thread in the first place, as opposed to, say, an assertion? Thanks, Pedro Alves