Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFA] gdb/win32-nat.c: do not call CloseHandle on process and thread handles
Date: Thu, 22 Nov 2007 12:49:00 -0000	[thread overview]
Message-ID: <002801c82d06$21bdf510$6539df30$@u-strasbg.fr> (raw)

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





             reply	other threads:[~2007-11-22 12:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-22 12:49 Pierre Muller [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002801c82d06$21bdf510$6539df30$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox