[review] Make last_wait_event static

Message ID gerrit.1574788288000.I67ea86e1d2ede0b4e0fb96761261ece01ef514b2@gnutoolchain-gerrit.osci.io
State New, archived
Headers

Commit Message

Simon Marchi (Code Review) Nov. 26, 2019, 5:11 p.m. UTC
  Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/720
......................................................................

Make last_wait_event static

Now that last_wait_event is entirely handled in nat/windows-nat.c, it
can be made static.

2019-11-26  Tom Tromey  <tromey@adacore.com>

	* nat/windows-nat.h (last_wait_event): Don't declare.
	(wait_for_debug_event): Update comment.
	* nat/windows-nat.c (last_wait_event): Now static.

Change-Id: I67ea86e1d2ede0b4e0fb96761261ece01ef514b2
---
M gdb/ChangeLog
M gdb/nat/windows-nat.c
M gdb/nat/windows-nat.h
3 files changed, 15 insertions(+), 9 deletions(-)
  

Comments

Simon Marchi (Code Review) Nov. 27, 2019, 1:04 a.m. UTC | #1
Luis Machado has posted comments on this change.

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


Patch Set 1: Code-Review+1

LGTM
  
Simon Marchi (Code Review) Nov. 29, 2019, 8:55 p.m. UTC | #2
Pedro Alves has posted comments on this change.

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


Patch Set 1: Code-Review+2
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index afe6ae9..f859445 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@ 
 2019-11-26  Tom Tromey  <tromey@adacore.com>
 
+	* nat/windows-nat.h (last_wait_event): Don't declare.
+	(wait_for_debug_event): Update comment.
+	* nat/windows-nat.c (last_wait_event): Now static.
+
+2019-11-26  Tom Tromey  <tromey@adacore.com>
+
 	* windows-nat.c (wait_for_debug_event): Move to
 	nat/windows-nat.c.
 	* nat/windows-nat.h (wait_for_debug_event): Declare.
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 8b00142..8206edd 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -28,7 +28,14 @@ 
 DWORD main_thread_id;
 enum gdb_signal last_sig = GDB_SIGNAL_0;
 DEBUG_EVENT current_event;
-DEBUG_EVENT last_wait_event;
+
+/* The most recent event from WaitForDebugEvent.  Unlike
+   current_event, this is guaranteed never to come from a pending
+   stop.  This is important because only data from the most recent
+   event from WaitForDebugEvent can be used when calling
+   ContinueDebugEvent.  */
+static DEBUG_EVENT last_wait_event;
+
 windows_thread_info *current_windows_thread;
 DWORD desired_stop_thread_id = -1;
 std::vector<pending_stop> pending_stops;
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
index ebdbacd..5c99c43 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -155,13 +155,6 @@ 
    stop.  */
 extern DEBUG_EVENT current_event;
 
-/* The most recent event from WaitForDebugEvent.  Unlike
-   current_event, this is guaranteed never to come from a pending
-   stop.  This is important because only data from the most recent
-   event from WaitForDebugEvent can be used when calling
-   ContinueDebugEvent.  */
-extern DEBUG_EVENT last_wait_event;
-
 /* Info on currently selected thread */
 extern windows_thread_info *current_windows_thread;
 
@@ -231,7 +224,7 @@ 
 extern BOOL continue_last_debug_event (DWORD continue_status,
 				       bool debug_events);
 
-/* A simple wrapper for WaitForDebugEvent that also sets
+/* A simple wrapper for WaitForDebugEvent that also sets the internal
    'last_wait_event' on success.  */
 
 extern BOOL wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout);