From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53951 invoked by alias); 21 Sep 2017 15:11:53 -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 53938 invoked by uid 89); 21 Sep 2017 15:11:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=thoroughly 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; Thu, 21 Sep 2017 15:11:51 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4382BC08EC04 for ; Thu, 21 Sep 2017 15:11:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4382BC08EC04 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.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 EEABA60242; Thu, 21 Sep 2017 15:11:45 +0000 (UTC) Subject: Re: [PATCH] Use "switch_to_thread" more thoroughly on gdbserver To: Sergio Durigan Junior References: <20170915043357.26094-1-sergiodj@redhat.com> <6f36073a-eed8-123d-94ec-8922aa0aa648@redhat.com> <87r2v7akfz.fsf@redhat.com> Cc: GDB Patches From: Pedro Alves Message-ID: Date: Thu, 21 Sep 2017 15:11: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: <87r2v7akfz.fsf@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00641.txt.bz2 On 09/15/2017 07:25 PM, Sergio Durigan Junior wrote: > On Friday, September 15 2017, Pedro Alves wrote: > >> Do you remember why that check is there in switch_to_thread in the >> first place, as opposed to, say, an assertion? > > I tried to do some archaeology here and find the patch that implemented > this feature, and it seems to me that the patch always used 'if' instead > of an 'assert'. Yeah, gdbserver's switch_to_thread was added with your fork inferior sharing series. > Maybe that's because GDB's version of switch_to_thread > also doesn't assert that ptid != minus_one_ptid... Except it does: static void switch_to_thread (thread_info *thr) { gdb_assert (thr != NULL); ^^^^^^^^^^^^^^^^^^^^^^^^ ... Called from: void switch_to_thread (ptid_t ptid) { if (ptid == null_ptid) switch_to_no_thread (); else switch_to_thread (find_thread_ptid (ptid)); } ... and find_thread_ptid returns NULL because there's never a thread with ptid == minus_one_ptid. Thanks, Pedro Alves