This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] gdb/win32-nat.c: do not call CloseHandle on process and thread handles
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 <muller@ics.u-strasbg.fr>
>
> *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