From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30356 invoked by alias); 23 Nov 2007 01:18:05 -0000 Received: (qmail 30342 invoked by uid 22791); 23 Nov 2007 01:18:04 -0000 X-Spam-Check-By: sourceware.org Received: from pool-70-20-17-24.bstnma.fios.verizon.net (HELO ednor.cgf.cx) (70.20.17.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 23 Nov 2007 01:17:55 +0000 Received: by ednor.cgf.cx (Postfix, from userid 201) id 47FE42B352; Thu, 22 Nov 2007 20:17:54 -0500 (EST) Date: Fri, 23 Nov 2007 01:18:00 -0000 From: Christopher Faylor To: gdb-patches@sourceware.org Subject: Re: [RFA] gdb/win32-nat.c: do not call CloseHandle on process and thread handles Message-ID: <20071123011754.GB31180@ednor.casa.cgf.cx> Mail-Followup-To: gdb-patches@sourceware.org References: <002801c82d06$21bdf510$6539df30$@u-strasbg.fr> <4053daab0711220456q46cca9b4m3714c35bcc805518@mail.gmail.com> <002c01c82d0f$8c789050$a569b0f0$@u-strasbg.fr> <4053daab0711220637h2bc01450ra45a19f4013fd44d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4053daab0711220637h2bc01450ra45a19f4013fd44d@mail.gmail.com> User-Agent: Mutt/1.5.16 (2007-06-09) 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 X-SW-Source: 2007-11/txt/msg00416.txt.bz2 On Thu, Nov 22, 2007 at 02:37:26PM +0000, Pedro Alves wrote: >Don't know, you'll have to check, but I doubt it. It just might be >easier to always open a handle to the process (OpenProcess), and not >touch the one coming on the event. Then you would always close the >process handle, because you know you're the one who opened it. OTTOMH, >gdbserver does something similar, but leaks. This uses an extra handle >on the normal case, but I don't think I'd care, as long as there are no >leaks. Otherwise, you'll just have to keep a flag somewhere. Are you sure that it's always possible for the debugger to open a handle to the process? It is a given that there will always be a handle available via the debugging interface but I don't know that it is a given that a nonprivileged process would necessarily be able to open a handle to a privileged process. I think I'd prefer a flag. And, it should be easy to create a program which has no main thread. Just write a program which has two threads, exit the main thread and attach to the program. cgf