* [review] Move wait_for_debug_event to nat/windows-nat.c
@ 2019-10-29 17:58 Tom Tromey (Code Review)
2019-11-21 18:41 ` Pedro Alves (Code Review)
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-10-29 17:58 UTC (permalink / raw)
To: gdb-patches
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/428
......................................................................
Move wait_for_debug_event to nat/windows-nat.c
This moves the wait_for_debug_event helper function to
nat/windows-nat.c, and changes gdbserver to use it.
wait_for_debug_event is a wrapper for WaitForDebugEvent that also sets
last_wait_event when appropriate. This is needed to properly handle
queued stops.
Change-Id: I94347cefeeab99cacf713b1f8f09427319da0caa
gdb/ChangeLog
2019-10-29 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.
* nat/windows-nat.c (wait_for_debug_event): Move from
windows-nat.c. No longer static.
gdb/gdbserver/ChangeLog
2019-10-29 Tom Tromey <tromey@adacore.com>
* win32-low.c (win32_kill, get_child_debug_event): Use
wait_for_debug_event.
Change-Id: I74ad1eccae65859a7dbaa5910bc424838a4175bc
---
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
M gdb/windows-nat.c
6 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e4bdd16..6ac74cd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2019-10-29 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.
+ * nat/windows-nat.c (wait_for_debug_event): Move from
+ windows-nat.c. No longer static.
+
+2019-10-29 Tom Tromey <tromey@adacore.com>
+
* windows-nat.c (get_windows_debug_event): Use
fetch_pending_stop.
* nat/windows-nat.h (fetch_pending_stop): Declare.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 40262d0..c36dcb0 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,10 @@
2019-10-29 Tom Tromey <tromey@adacore.com>
+ * win32-low.c (win32_kill, get_child_debug_event): Use
+ wait_for_debug_event.
+
+2019-10-29 Tom Tromey <tromey@adacore.com>
+
* win32-low.c (child_continue): Call continue_last_debug_event.
2019-10-29 Tom Tromey <tromey@adacore.com>
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index b58f6f6..10b14df 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -785,7 +785,7 @@
{
if (!child_continue (DBG_CONTINUE, -1))
break;
- if (!WaitForDebugEvent (¤t_event, INFINITE))
+ if (!wait_for_debug_event (¤t_event, INFINITE))
break;
if (current_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT)
break;
@@ -1219,7 +1219,7 @@
happen is the user will see a spurious breakpoint. */
current_event.dwDebugEventCode = 0;
- if (!WaitForDebugEvent (¤t_event, 0))
+ if (!wait_for_debug_event (¤t_event, 0))
{
OUTMSG2(("no attach events left\n"));
fake_breakpoint_event ();
@@ -1234,7 +1234,7 @@
/* Keep the wait time low enough for comfortable remote
interruption, but high enough so gdbserver doesn't become a
bottleneck. */
- if (!WaitForDebugEvent (¤t_event, 250))
+ if (!wait_for_debug_event (¤t_event, 250))
{
DWORD e = GetLastError();
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 7ac06f4..133fc9c 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -363,5 +363,15 @@
continue_status);
}
+/* See nat/windows-nat.h. */
+
+BOOL
+wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout)
+{
+ BOOL result = WaitForDebugEvent (event, timeout);
+ if (result)
+ last_wait_event = *event;
+ return result;
+}
}
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
index 2a5d4a1..3ab1af6 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -228,6 +228,11 @@
extern BOOL continue_last_debug_event (DWORD continue_status,
bool debug_events);
+/* A simple wrapper for WaitForDebugEvent that also sets
+ 'last_wait_event' on success. */
+
+extern BOOL wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout);
+
}
#endif
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index e91e052..3e91b89 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1276,17 +1276,6 @@
return TRUE;
}
-/* A wrapper for WaitForDebugEvent that sets "last_wait_event"
- appropriately. */
-static BOOL
-wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout)
-{
- BOOL result = WaitForDebugEvent (event, timeout);
- if (result)
- last_wait_event = *event;
- return result;
-}
-
/* Get the next event from the child. Returns a non-zero thread id if the event
requires handling by WFI (or whatever). */
static int
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I74ad1eccae65859a7dbaa5910bc424838a4175bc
Gerrit-Change-Number: 428
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange
^ permalink raw reply [flat|nested] 4+ messages in thread
* [review] Move wait_for_debug_event to nat/windows-nat.c
2019-10-29 17:58 [review] Move wait_for_debug_event to nat/windows-nat.c Tom Tromey (Code Review)
@ 2019-11-21 18:41 ` Pedro Alves (Code Review)
0 siblings, 0 replies; 4+ messages in thread
From: Pedro Alves (Code Review) @ 2019-11-21 18:41 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/+/428
......................................................................
Patch Set 1: Code-Review+2
OK.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I74ad1eccae65859a7dbaa5910bc424838a4175bc
Gerrit-Change-Number: 428
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Pedro Alves <palves@redhat.com>
Gerrit-Comment-Date: Thu, 21 Nov 2019 18:41:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 4+ messages in thread
* [review] Move wait_for_debug_event to nat/windows-nat.c
2019-11-26 17:21 Tom Tromey (Code Review)
@ 2019-11-29 20:10 ` Pedro Alves (Code Review)
0 siblings, 0 replies; 4+ messages in thread
From: Pedro Alves (Code Review) @ 2019-11-29 20:10 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/+/719
......................................................................
Patch Set 1: Code-Review+2
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I94347cefeeab99cacf713b1f8f09427319da0caa
Gerrit-Change-Number: 719
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Pedro Alves <palves@redhat.com>
Gerrit-Comment-Date: Fri, 29 Nov 2019 20:10:55 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 4+ messages in thread
* [review] Move wait_for_debug_event to nat/windows-nat.c
@ 2019-11-26 17:21 Tom Tromey (Code Review)
2019-11-29 20:10 ` Pedro Alves (Code Review)
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-26 17:21 UTC (permalink / raw)
To: gdb-patches
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/719
......................................................................
Move wait_for_debug_event to nat/windows-nat.c
This moves the wait_for_debug_event helper function to
nat/windows-nat.c, and changes gdbserver to use it.
wait_for_debug_event is a wrapper for WaitForDebugEvent that also sets
last_wait_event when appropriate. This is needed to properly handle
queued stops.
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.
* nat/windows-nat.c (wait_for_debug_event): Move from
windows-nat.c. No longer static.
gdb/gdbserver/ChangeLog
2019-11-26 Tom Tromey <tromey@adacore.com>
* win32-low.c (win32_kill, get_child_debug_event): Use
wait_for_debug_event.
Change-Id: I94347cefeeab99cacf713b1f8f09427319da0caa
---
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
M gdb/windows-nat.c
6 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 29ef0db..afe6ae9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
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.
+ * nat/windows-nat.c (wait_for_debug_event): Move from
+ windows-nat.c. No longer static.
+
+2019-11-26 Tom Tromey <tromey@adacore.com>
+
* windows-nat.c (get_windows_debug_event): Use
fetch_pending_stop.
* nat/windows-nat.h (fetch_pending_stop): Declare.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index b31abf1..d05734a 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,10 @@
2019-11-26 Tom Tromey <tromey@adacore.com>
+ * win32-low.c (win32_kill, get_child_debug_event): Use
+ wait_for_debug_event.
+
+2019-11-26 Tom Tromey <tromey@adacore.com>
+
* win32-low.c (child_continue): Call continue_last_debug_event.
2019-11-26 Tom Tromey <tromey@adacore.com>
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index d41e0e0..7b5ae07 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -785,7 +785,7 @@
{
if (!child_continue (DBG_CONTINUE, -1))
break;
- if (!WaitForDebugEvent (¤t_event, INFINITE))
+ if (!wait_for_debug_event (¤t_event, INFINITE))
break;
if (current_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT)
break;
@@ -1219,7 +1219,7 @@
happen is the user will see a spurious breakpoint. */
current_event.dwDebugEventCode = 0;
- if (!WaitForDebugEvent (¤t_event, 0))
+ if (!wait_for_debug_event (¤t_event, 0))
{
OUTMSG2(("no attach events left\n"));
fake_breakpoint_event ();
@@ -1234,7 +1234,7 @@
/* Keep the wait time low enough for comfortable remote
interruption, but high enough so gdbserver doesn't become a
bottleneck. */
- if (!WaitForDebugEvent (¤t_event, 250))
+ if (!wait_for_debug_event (¤t_event, 250))
{
DWORD e = GetLastError();
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 126a329..8b00142 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -365,5 +365,15 @@
continue_status);
}
+/* See nat/windows-nat.h. */
+
+BOOL
+wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout)
+{
+ BOOL result = WaitForDebugEvent (event, timeout);
+ if (result)
+ last_wait_event = *event;
+ return result;
+}
}
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
index 702aebc..ebdbacd 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -231,6 +231,11 @@
extern BOOL continue_last_debug_event (DWORD continue_status,
bool debug_events);
+/* A simple wrapper for WaitForDebugEvent that also sets
+ 'last_wait_event' on success. */
+
+extern BOOL wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout);
+
}
#endif
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index bbae172..7fd6589 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1298,17 +1298,6 @@
return TRUE;
}
-/* A wrapper for WaitForDebugEvent that sets "last_wait_event"
- appropriately. */
-static BOOL
-wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout)
-{
- BOOL result = WaitForDebugEvent (event, timeout);
- if (result)
- last_wait_event = *event;
- return result;
-}
-
/* Get the next event from the child. Returns a non-zero thread id if the event
requires handling by WFI (or whatever). */
static int
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I94347cefeeab99cacf713b1f8f09427319da0caa
Gerrit-Change-Number: 719
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 20:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 17:58 [review] Move wait_for_debug_event to nat/windows-nat.c Tom Tromey (Code Review)
2019-11-21 18:41 ` Pedro Alves (Code Review)
2019-11-26 17:21 Tom Tromey (Code Review)
2019-11-29 20:10 ` Pedro Alves (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).