From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90821 invoked by alias); 3 Jun 2016 11:55:48 -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 90811 invoked by uid 89); 3 Jun 2016 11:55:47 -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,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 03 Jun 2016 11:55:46 +0000 Received: from EUSAAHC001.ericsson.se (Unknown_Domain [147.117.188.75]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id 22.18.09012.C3761575; Fri, 3 Jun 2016 13:17:16 +0200 (CEST) Received: from elxa4wqvvz1 (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.75) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 3 Jun 2016 07:55:43 -0400 References: <1464876960-23372-1-git-send-email-antoine.tremblay@ericsson.com> User-agent: mu4e 0.9.17; emacs 24.4.1 From: Antoine Tremblay To: Pedro Alves CC: Antoine Tremblay , Subject: Re: [PATCH] Fix failure to detach if threads exit while detaching on linux In-Reply-To: Date: Fri, 03 Jun 2016 11:55:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00054.txt.bz2 Pedro Alves writes: > 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. > Oops I tought ptrace was linux specific, seems like bsd uses it too.. I think I can replace this with a try catch over linux_ops->to_detach (ops, args, from_tty); can call the rest of inf_ptrace_detach from there I'll try it out... >> * 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); > Done. > 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++) > > Done. >> + >> +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? > I did that because I though they could not detach... Any suggestion on how to limit this to targets that can detach ?.. call detach see if it suceeds or there's a better way ? Thanks, Antoine