public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] Call CloseHandle from ~windows_thread_info
@ 2019-11-26 17:12 Tom Tromey (Code Review)
  2019-11-29 19:08 ` Pedro Alves (Code Review)
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-26 17:12 UTC (permalink / raw)
  To: gdb-patches

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  <tromey@adacore.com>

	* 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  <tromey@adacore.com>

	* 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  <tromey@adacore.com>
 
+	* nat/windows-nat.h (struct windows_thread_info): Declare
+	destructor.
+	* nat/windows-nat.c (~windows_thread_info): New.
+
+2019-11-26  Tom Tromey  <tromey@adacore.com>
+
 	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  <tromey@adacore.com>
 
+	* win32-low.c (delete_thread_info): Don't call CloseHandle.
+
+2019-11-26  Tom Tromey  <tromey@adacore.com>
+
 	* 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.  */

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I4bae7f2551aa55be2bc5bd93d566a5c2e369247f
Gerrit-Change-Number: 706
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange

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

* [review] Call CloseHandle from ~windows_thread_info
  2019-11-26 17:12 [review] Call CloseHandle from ~windows_thread_info Tom Tromey (Code Review)
@ 2019-11-29 19:08 ` Pedro Alves (Code Review)
  0 siblings, 0 replies; 4+ messages in thread
From: Pedro Alves (Code Review) @ 2019-11-29 19:08 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

Pedro Alves has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/706
......................................................................


Patch Set 1: Code-Review+2


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I4bae7f2551aa55be2bc5bd93d566a5c2e369247f
Gerrit-Change-Number: 706
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Pedro Alves <palves@redhat.com>
Gerrit-Comment-Date: Fri, 29 Nov 2019 19:08:45 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

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

* [review] Call CloseHandle from ~windows_thread_info
  2019-10-29 18:05 Tom Tromey (Code Review)
@ 2019-11-26 22:51 ` Luis Machado (Code Review)
  0 siblings, 0 replies; 4+ messages in thread
From: Luis Machado (Code Review) @ 2019-11-26 22:51 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

Luis Machado has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/415
......................................................................


Patch Set 1: Code-Review+1

LGTM


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I640a0e770e103a5f44754ea8a758123807790d04
Gerrit-Change-Number: 415
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-Comment-Date: Tue, 26 Nov 2019 22:51:40 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

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

* [review] Call CloseHandle from ~windows_thread_info
@ 2019-10-29 18:05 Tom Tromey (Code Review)
  2019-11-26 22:51 ` Luis Machado (Code Review)
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-10-29 18:05 UTC (permalink / raw)
  To: gdb-patches

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/415
......................................................................

Call CloseHandle from ~windows_thread_info

Add a destructor to windows_thread_info that calls CloseHandle.

Change-Id: I4bae7f2551aa55be2bc5bd93d566a5c2e369247f

gdb/ChangeLog
2019-10-29  Tom Tromey  <tromey@adacore.com>

	* nat/windows-nat.h (struct windows_thread_info): Declare
	destructor.
	* nat/windows-nat.c (~windows_thread_info): New.

gdb/gdbserver/ChangeLog
2019-10-29  Tom Tromey  <tromey@adacore.com>

	* win32-low.c (delete_thread_info): Don't call CloseHandle.

Change-Id: I640a0e770e103a5f44754ea8a758123807790d04
---
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 ecabb25..2a63867 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2019-10-29  Tom Tromey  <tromey@adacore.com>
 
+	* nat/windows-nat.h (struct windows_thread_info): Declare
+	destructor.
+	* nat/windows-nat.c (~windows_thread_info): New.
+
+2019-10-29  Tom Tromey  <tromey@adacore.com>
+
 	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 2f31755..fb1c7bc 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,9 @@
 2019-10-29  Tom Tromey  <tromey@adacore.com>
 
+	* win32-low.c (delete_thread_info): Don't call CloseHandle.
+
+2019-10-29  Tom Tromey  <tromey@adacore.com>
+
 	* 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 a98ff42..2a0e3a3 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 b51279b..d1bdea2 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.  */

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I640a0e770e103a5f44754ea8a758123807790d04
Gerrit-Change-Number: 415
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange

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

end of thread, other threads:[~2019-11-29 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 17:12 [review] Call CloseHandle from ~windows_thread_info Tom Tromey (Code Review)
2019-11-29 19:08 ` Pedro Alves (Code Review)
  -- strict thread matches above, loose matches on Subject: below --
2019-10-29 18:05 Tom Tromey (Code Review)
2019-11-26 22:51 ` Luis Machado (Code Review)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).