From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4432 invoked by alias); 22 Mar 2017 01:22:21 -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 4381 invoked by uid 89); 22 Mar 2017 01:22:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=reaches X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Mar 2017 01:22:16 +0000 Received: by simark.ca (Postfix, from userid 33) id 02E181E165; Tue, 21 Mar 2017 21:22:15 -0400 (EDT) To: Pedro Alves Subject: Re: [PATCH] Remove lwp -> pid conversion in linux_nat_xfer_partial X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 22 Mar 2017 01:22:00 -0000 From: Simon Marchi Cc: Simon Marchi , gdb-patches@sourceware.org In-Reply-To: References: <20170321221744.20567-1-simon.marchi@ericsson.com> <3da10b16ca20d771c39f07a73235c7d3@polymtl.ca> Message-ID: <15f668b8e6bfe802bad5671738f7ef3b@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.4 X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00386.txt.bz2 On 2017-03-21 21:00, Pedro Alves wrote: > Nope. If you call "exit", then yes. The kernel kills the whole thread > group in response to that system call. If the leader does > pthread_exit, then no, the thread group stays around until all children > exit too. The kernel won't report the main thread's exit status (i.e., > we can't reap that zombie, and we'd hang if we tried a blocking > waitpid) > until all the children are reaped first. That's why we have > linux-nat.c:check_zombie_leaders (and the equivalent in gdbserver). Oh ok, in my testing I was just letting main return, but I guess it reaches a point where the libc calls the exit syscall. When I call pthread_exit, the process stays alive. >>> So if possible to switch those spots too, I'd recommend/prefer it. >> >> Ok, I'll just replace ptid_get_pid with get_ptrace_pid* in this patch > > Since this is linux-specific code, you should be able to use > ptid_get_lwp directly. Ok. >> 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. Thanks, I'm sending an updated patch. Simon