From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15471 invoked by alias); 22 Nov 2007 12:49:41 -0000 Received: (qmail 15461 invoked by uid 22791); 22 Nov 2007 12:49:40 -0000 X-Spam-Check-By: sourceware.org Received: from ics.u-strasbg.fr (HELO ics.u-strasbg.fr) (130.79.112.250) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 22 Nov 2007 12:49:16 +0000 Received: from ICSMULLER (laocoon.u-strasbg.fr [130.79.112.72]) by ics.u-strasbg.fr (Postfix) with ESMTP id B2FC218701A for ; Thu, 22 Nov 2007 13:53:47 +0100 (CET) From: "Pierre Muller" To: Subject: [RFA] gdb/win32-nat.c: do not call CloseHandle on process and thread handles Date: Thu, 22 Nov 2007 12:49:00 -0000 Message-ID: <002801c82d06$21bdf510$6539df30$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-us 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/msg00407.txt.bz2 Following the discussion http://sourceware.org/ml/gdb/2007-10/msg00131.html and http://sourceware.org/ml/gdb-patches/2007-10/msg00502.html I resubmit a part of my original patch that only contains the removal of all calls to the win32 API CloseHandle with thread or process handles. This patch allows to debug gdb with itself on mingw32 port. The patch was tested for cygwin target, by running the testsuite with and without this patch. The testsuite shows no changes. Pierre Muller PS: I am unsure about the proper way to decribe the change in the ChangeLog... ChangeLog entry: 2007-11-22 Pierre Muller *win32-nat.c: Remove calls to CloseHandle for thread and process handles. (win32_init_thread_list): Ditto. (win32_delete_thread): Ditto. (get_win32_debug_event): Ditto. (win32_create_inferior): Ditto. (win32_kill_inferior): Ditto. Index: gdb/win32-nat.c =================================================================== RCS file: /cvs/src/src/gdb/win32-nat.c,v retrieving revision 1.139 diff -u -p -r1.139 win32-nat.c --- gdb/win32-nat.c 16 Nov 2007 04:53:46 -0000 1.139 +++ gdb/win32-nat.c 22 Nov 2007 10:07:30 -0000 @@ -316,7 +316,6 @@ win32_init_thread_list (void) { thread_info *here = th->next; th->next = here->next; - (void) CloseHandle (here->h); xfree (here); } thread_head.next = NULL; @@ -341,7 +340,6 @@ win32_delete_thread (DWORD id) { thread_info *here = th->next; th->next = here->next; - CloseHandle (here->h); xfree (here); } } @@ -1323,7 +1321,6 @@ get_win32_debug_event (int pid, struct t CloseHandle (current_event.u.CreateProcessInfo.hFile); if (++saw_create != 1) { - CloseHandle (current_event.u.CreateProcessInfo.hProcess); break; } @@ -1346,7 +1343,6 @@ get_win32_debug_event (int pid, struct t break; ourstatus->kind = TARGET_WAITKIND_EXITED; ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode; - CloseHandle (current_process_handle); retval = main_thread_id; break; @@ -1876,9 +1872,6 @@ win32_create_inferior (char *exec_file, error (_("Error creating process %s, (error %d)."), exec_file, (unsigned) GetLastError ()); - CloseHandle (pi.hThread); - CloseHandle (pi.hProcess); - if (useshell && shell[0] != '\0') saw_create = -1; else @@ -1950,11 +1943,6 @@ win32_kill_inferior (void) break; } - CHECK (CloseHandle (current_process_handle)); - - /* this may fail in an attached process so don't check. */ - if (current_thread && current_thread->h) - (void) CloseHandle (current_thread->h); target_mourn_inferior (); /* or just win32_mourn_inferior? */ }