From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54806 invoked by alias); 3 Jun 2016 11:43:40 -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 54776 invoked by uid 89); 3 Jun 2016 11:43:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Say 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 03 Jun 2016 11:43:38 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9234A47075; Fri, 3 Jun 2016 11:43:37 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u53BhaNE025950; Fri, 3 Jun 2016 07:43:36 -0400 Subject: Re: [PATCH] Fix failure to detach if threads exit while detaching on linux To: Antoine Tremblay , gdb-patches@sourceware.org References: <1464876960-23372-1-git-send-email-antoine.tremblay@ericsson.com> From: Pedro Alves Message-ID: Date: Fri, 03 Jun 2016 11:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <1464876960-23372-1-git-send-email-antoine.tremblay@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-06/txt/msg00052.txt.bz2 On 06/02/2016 03:16 PM, Antoine Tremblay wrote: > gdb/ChangeLog: > > * inf-ptrace.c: include nat/linux-procfs.h. > (inf_ptrace_detach): Report an error only if the thread is not gone. Can't do this. inf-ptrace.c is a shared file used by non-Linux ports too. > * gdb.threads/detach-gone-thread.c: New file. > * gdb.threads/detach-gone-thread.ex: New test. Typo: ".ex". Say "New file" for that one too. > + _exit(0); Space before parenthesis. > +{ > + pthread_t threads[256]; > + int res; > + int i; > + > + pthread_barrier_init (&barrier, NULL, 257); > + > + for (i = 0; i < 256; i++) Please add: #define NTHREADS 256 and thus write: pthread_t threads[NTHREADS]; int res; int i; pthread_barrier_init (&barrier, NULL, NTHREADS + 1); for (i = 0; i < NTHREADS; i++) > + > +if $use_gdb_stub { Do this at the top, and call the new use_gdb_stub procedure instead: if [use_gdb_stub] { > + # This test is about testing detaching from a process, > + # so it doesn't make sense to run it if the target is stub-like. > + unsupported "This test is not supported for GDB stub targets." But in any case, I'm not so sure about this. Stub targets can detach too. What problem did you find that needed this? Thanks, Pedro Alves