From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3176 invoked by alias); 24 Nov 2007 05:44:11 -0000 Received: (qmail 3166 invoked by uid 22791); 24 Nov 2007 05:44:11 -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; Sat, 24 Nov 2007 05:44:06 +0000 Received: by ednor.cgf.cx (Postfix, from userid 201) id 519A72B352; Sat, 24 Nov 2007 00:44:05 -0500 (EST) Date: Sat, 24 Nov 2007 05:44: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: <20071124054405.GB4214@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> <20071123011754.GB31180@ednor.casa.cgf.cx> <006201c82dec$de431850$9ac948f0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <006201c82dec$de431850$9ac948f0$@u-strasbg.fr> 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/msg00446.txt.bz2 On Fri, Nov 23, 2007 at 05:21:14PM +0100, Pierre Muller wrote: > Following Christopher and Pedro's comments, >I added a new variable called fake_create_used >to record if the current_process_handle is >coming from OpenProcess called in fake_create_process, >in which case we should close the handle, or >coming from the CREATE_PROCESS_DEBUG_EVENT, >which is closed by the system. > >Pierre > >ChangeLog entry: > >2007-11-23 Pierre Muller > > *win32-nat.c (fake_create_used): New static variable. > (win32_init_thread_list): Remove call to CloseHandle for thread. > (win32_delete_thread): Ditto. > (fake_create_process): Set fake_create_used if OpenProcess call > is successful. > (get_win32_debug_event): Do not close process handle. > (do_initial_win32_stuff): Set fake_create_used to zero. > (win32_mourn_inferior): Call CloseHandle for current_process_handle > if fake_create_process is set. > (win32_kill_inferior): Do not close process and main_thread handles. I'd prefer if you called the flag variable "open_process_used" since I think that's more descriptive. Also, rather than using printf_unfiltered, shouldn't you be using error, like the rest of the code? And, the GNU C coding standard seems to imply that braces around single line statements after an `if' are not required. Most of the code in win32-nat.c follows this convention so I would appreciate if you would eliminate this use of braces where appropriate. Other than that, the patch looks good. cgf