From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26309 invoked by alias); 22 Mar 2017 01:13:47 -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 26286 invoked by uid 89); 22 Mar 2017 01:13:44 -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=inadvertent, dance 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; Wed, 22 Mar 2017 01:13: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 024DE6330E; Wed, 22 Mar 2017 01:13:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 024DE6330E Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 024DE6330E Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 245A55C464; Wed, 22 Mar 2017 01:13:42 +0000 (UTC) Subject: Re: [PATCH] Remove lwp -> pid conversion in linux_nat_xfer_partial To: Simon Marchi References: <20170321221744.20567-1-simon.marchi@ericsson.com> <3da10b16ca20d771c39f07a73235c7d3@polymtl.ca> Cc: Simon Marchi , gdb-patches@sourceware.org From: Pedro Alves Message-ID: <72ddffe2-813d-d857-e16a-cc0c0086c0e3@redhat.com> Date: Wed, 22 Mar 2017 01:13: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: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-03/txt/msg00385.txt.bz2 On 03/22/2017 01:00 AM, Pedro Alves wrote: >> and look at using /proc//task/ after. When doing the latter, >> do I still have to consider cases where ptid is a single-process/thread >> ptid (lwp == 0)? From my experience, there's always a lwp on Linux, but >> perhaps there are some setups I don't know about with which it can happen? > > Right, on Linux there's always an lwp. Before NPTL, the > /proc//task/ path didn't exist at all, but we no longer > support LinuxThreads. I think I read the question all backwards. I understood you were asking whether the in that /proc patch would be 0 in some cases... Sorry. So trying again: In linux-nat.c, you only see a ptid without an lwp filled in during early child process startup, either while attaching (see thread_change_ptid call in linux_nat_attach), or while doing the first iteration of the fork-child.c:startup_inferior dance. The lwp is filled in at the top of linux_nat_wait_1 [1]. I don't think we access /proc between the initial fork and that spot. If we did, we'd be accessing the process while it was still executing the shell, and startup_inferior was invented exactly to prevent that sort of inadvertent access. [1] And that is another inferior_ptid hack that we should get rid of ... somehow ... Thanks, Pedro Alves