From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23335 invoked by alias); 26 Aug 2003 19:17:29 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 23300 invoked from network); 26 Aug 2003 19:17:17 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 26 Aug 2003 19:17:17 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 083F2800355; Tue, 26 Aug 2003 14:43:24 -0400 (EDT) Message-ID: <3F4BAA4B.6050508@redhat.com> Date: Tue, 26 Aug 2003 19:17:00 -0000 From: "J. Johnston" Organization: Red Hat Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: lin-lwp and exiting threads References: <20030826175135.GA25329@nevyn.them.org> <20030826175418.GA25424@nevyn.them.org> In-Reply-To: <20030826175418.GA25424@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-08/txt/msg00451.txt.bz2 Daniel Jacobowitz wrote: > On Tue, Aug 26, 2003 at 01:51:35PM -0400, Daniel Jacobowitz wrote: > >>Hi Jeff, >> >>I'm doing some work in lin-lwp.c and I saw this bit you recently committed: >> >>+ /* Check if the current LWP has previously exited. For nptl threads, >>+ there is no exit signal issued for LWPs that are not the >>+ main thread so we should check whenever the thread is stopped. */ >>+ if (!lin_lwp_thread_alive (lp->ptid)) >>+ { >>+ if (in_thread_list (lp->ptid)) >>+ { >>+ /* Core GDB cannot deal with us deleting the current >>+ thread. */ >>+ if (!ptid_equal (lp->ptid, inferior_ptid)) >>+ delete_thread (lp->ptid); >>+ printf_unfiltered ("[%s exited]\n", >>+ target_pid_to_str (lp->ptid)); >>+ } >>+ if (debug_lin_lwp) >>+ fprintf_unfiltered (gdb_stdlog, >>+ "SWC: %s already exited.\n", >> target_pid_to_str (lp->ptid)); >> >> >>This is right after waitpid has returned a non-exiting stopped status for >>lp->ptid. Were you just being thorough, or do you have some reason to >>believe that waitpid would ever return WIFSTOPPED (status) and yet the >>thread would be dead? > In the early days of nptl, the kernel wasn't always doing what it was expected to. This appears to be leftover code as I attempted to ensure we caught the thread exiting one way or another. > > Also, there's: > pid = waitpid (GET_LWP (lp->ptid), &status, 0); > if (pid == -1 && errno == ECHILD) > { > pid = waitpid (GET_LWP (lp->ptid), &status, __WCLONE); > if (pid == -1 && errno == ECHILD) > { > /* The thread has previously exited. We need to delete it now > because in the case of NPTL threads, there won't be an > exit event unless it is the main thread. */ > if (debug_lin_lwp) > fprintf_unfiltered (gdb_stdlog, > "SWC: %s exited.\n", > target_pid_to_str (lp->ptid)); > delete_lwp (lp->ptid); > return 0; > } > } > > Is there some reason you don't also call delete_thread? > Hmm, appears to be an oversight on my part. Do you want to make these changes? -- Jeff J.