From patchwork Tue Nov 26 17:11:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36219 Received: (qmail 94373 invoked by alias); 26 Nov 2019 17:11:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 94255 invoked by uid 89); 26 Nov 2019 17:11:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=sk:desired X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Nov 2019 17:11:56 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 5D7722053D; Tue, 26 Nov 2019 12:11:54 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id E961B20C06 for ; Tue, 26 Nov 2019 12:11:31 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id D707928173 for ; Tue, 26 Nov 2019 12:11:31 -0500 (EST) X-Gerrit-PatchSet: 1 Date: Tue, 26 Nov 2019 12:11:31 -0500 From: "Tom Tromey (Code Review)" To: gdb-patches@sourceware.org Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] Call CloseHandle from ~windows_thread_info X-Gerrit-Change-Id: I4bae7f2551aa55be2bc5bd93d566a5c2e369247f X-Gerrit-Change-Number: 706 X-Gerrit-ChangeURL: X-Gerrit-Commit: 0729d06f2d5ca12e63f0096b270da8cec0f1b64d References: Reply-To: tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/706 ...................................................................... Call CloseHandle from ~windows_thread_info Add a destructor to windows_thread_info that calls CloseHandle. gdb/ChangeLog 2019-11-26 Tom Tromey * nat/windows-nat.h (struct windows_thread_info): Declare destructor. * nat/windows-nat.c (~windows_thread_info): New. gdb/gdbserver/ChangeLog 2019-11-26 Tom Tromey * win32-low.c (delete_thread_info): Don't call CloseHandle. Change-Id: I4bae7f2551aa55be2bc5bd93d566a5c2e369247f --- M gdb/ChangeLog M gdb/gdbserver/ChangeLog M gdb/gdbserver/win32-low.c M gdb/nat/windows-nat.c M gdb/nat/windows-nat.h 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bb441a1..08d2ecb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2019-11-26 Tom Tromey + * nat/windows-nat.h (struct windows_thread_info): Declare + destructor. + * nat/windows-nat.c (~windows_thread_info): New. + +2019-11-26 Tom Tromey + PR gdb/22992 * windows-nat.c (current_event): Update comment. (last_wait_event, desired_stop_thread_id): New globals. diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 99b949a..6dcb274 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,9 @@ 2019-11-26 Tom Tromey + * win32-low.c (delete_thread_info): Don't call CloseHandle. + +2019-11-26 Tom Tromey + * win32-low.c (win32_require_context, suspend_one_thread): Use windows_thread_info::suspend. (continue_one_thread): Use windows_thread_info::resume. diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c index 59749f0..9d69af7 100644 --- a/gdb/gdbserver/win32-low.c +++ b/gdb/gdbserver/win32-low.c @@ -219,7 +219,6 @@ windows_thread_info *th = (windows_thread_info *) thread_target_data (thread); remove_thread (thread); - CloseHandle (th->h); delete th; } diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index 59b0fac..e5a12c3 100644 --- a/gdb/nat/windows-nat.c +++ b/gdb/nat/windows-nat.c @@ -19,6 +19,11 @@ #include "gdbsupport/common-defs.h" #include "nat/windows-nat.h" +windows_thread_info::~windows_thread_info () +{ + CloseHandle (h); +} + void windows_thread_info::suspend () { diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index d64ef8e..8535a15 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -32,6 +32,8 @@ { } + ~windows_thread_info (); + DISABLE_COPY_AND_ASSIGN (windows_thread_info); /* Ensure that this thread has been suspended. */