Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] gdb/win32-nat.c: do not call CloseHandle on process and thread handles
@ 2007-11-22 12:49 Pierre Muller
  2007-11-22 12:56 ` Pedro Alves
  0 siblings, 1 reply; 10+ messages in thread
From: Pierre Muller @ 2007-11-22 12:49 UTC (permalink / raw)
  To: gdb-patches

  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  <muller@ics.u-strasbg.fr>

	*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? */
 }





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-12-02  5:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-22 12:49 [RFA] gdb/win32-nat.c: do not call CloseHandle on process and thread handles Pierre Muller
2007-11-22 12:56 ` Pedro Alves
2007-11-22 13:56   ` Pierre Muller
2007-11-22 14:37     ` Pedro Alves
2007-11-23  1:18       ` Christopher Faylor
2007-11-23 16:21         ` Pierre Muller
2007-11-24  5:44           ` Christopher Faylor
2007-11-26  9:21             ` [RFA 2] " Pierre Muller
2007-12-02  5:46               ` Christopher Faylor
2007-11-23 16:33         ` [RFA] " Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox